Index: trunk/ToBeReviewed/CALCULS/curl.pro
===================================================================
--- trunk/CALCULS/curl.pro	(revision 2)
+++ trunk/ToBeReviewed/CALCULS/curl.pro	(revision 25)
@@ -61,4 +61,8 @@
    tempsun = systime(1)         ; pour key_performance
 ;
+   IF finite(glamu[0])*finite(gphiu[0])*finite(glamv[0])*finite(gphiv[0]) EQ 0 THEN $
+     return, report(['This version of curl is based on Arakawa C-grid.' $
+                     , 'U and V grids must therefore be defined'])
+;
    u = litchamp(uu)
    v = litchamp(vv)
@@ -71,9 +75,9 @@
 ; on trouve les points que u et v ont en communs
 ;------------------------------------------------------------
-   indicexu = (lindgen(jpi))[premierxu:premierxu+nxu-1]
-   indicexv = (lindgen(jpi))[premierxv:premierxv+nxv-1]
+   indicexu = (lindgen(jpi))[firstxu:firstxu+nxu-1]
+   indicexv = (lindgen(jpi))[firstxv:firstxv+nxv-1]
    indicex = inter(indicexu, indicexv)
-   indiceyu = (lindgen(jpj))[premieryu:premieryu+nyu-1]
-   indiceyv = (lindgen(jpj))[premieryv:premieryv+nyv-1]
+   indiceyu = (lindgen(jpj))[firstyu:firstyu+nyu-1]
+   indiceyv = (lindgen(jpj))[firstyv:firstyv+nyv-1]
    indicey = inter(indiceyu, indiceyv)
    nx = n_elements(indicex) 
@@ -95,8 +99,8 @@
              (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 
             case 1 of
-               nxu NE nx:if indicex[0] EQ premierxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *]
-               nxv NE nx:if indicex[0] EQ premierxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *]
-               nyu NE ny:if indicey[0] EQ premieryu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *]
-               nyv NE ny:if indicey[0] EQ premieryv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *]
+               nxu NE nx:if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *]
+               nxv NE nx:if indicex[0] EQ firstxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *]
+               nyu NE ny:if indicey[0] EQ firstyu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *]
+               nyv NE ny:if indicey[0] EQ firstyv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *]
                ELSE :
             endcase
@@ -114,5 +118,5 @@
          coefu = (e1u[indice2d])[*]#replicate(1, nzt)
          coefu = reform(coefu, nx, ny, nzt, /over)
-         coefu = coefu*(umask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]
+         coefu = coefu*(umask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, firstzt:lastzt]
          terreu = where(coefu EQ 0)
          if terreu[0] NE -1 then coefu[temporary(terreu)] = !values.f_nan
@@ -120,9 +124,9 @@
          coefv = (e2v[indice2d])[*]#replicate(1, nzt)
          coefv = reform(coefv, nx, ny, nzt, /over)
-         coefv = coefv*(vmask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]
+         coefv = coefv*(vmask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, firstzt:lastzt]
          terrev = where(coefv EQ 0)
          if terrev[0] NE -1 then coefv[temporary(terrev)] = !values.f_nan
 
-         tabf = (fmask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]
+         tabf = (fmask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, firstzt:lastzt]
          div = (e1f[indice2d]*e2f[indice2d])[*]#replicate(1, nzt)
          div = reform(div, nx, ny, nzt, /over)
@@ -137,5 +141,5 @@
 ; mise a !values.f_nan de la bordure
 ;------------------------------------------------------------
-         if NOT keyword_set(key_periodique)  OR nx NE jpi then begin
+         if NOT keyword_set(key_periodic)  OR nx NE jpi then begin
             psi(0, *, *) = !values.f_nan
             psi(nx-1, *, *) = !values.f_nan
@@ -150,6 +154,6 @@
 ; pour le trace graphique
 ;------------------------------------------------------------
-         domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], prof1, prof2, grille = ['t', 'f']
-         if keyword_set(direc) then psi = moyenne(psi,direc,/nan, boite = boite)
+         domdef, (glagmt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], vert1, vert2, gridtype = ['t', 'f']
+         if keyword_set(direc) then psi = moyenne(psi,direc,/nan)
 
 ;----------------------------------------------------------------------------
@@ -170,11 +174,11 @@
              (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 
                if nxu NE nx then $
-                if indicex[0] EQ premierxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] 
+                if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] 
                IF nxv NE nx THEN $
-                if indicex[0] EQ premierxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *]
+                if indicex[0] EQ firstxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *]
                IF nyu NE ny THEN $
-                if indicey[0] EQ premieryu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *] 
+                if indicey[0] EQ firstyu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *] 
                IF nyv NE ny THEN $
-                if indicey[0] EQ premieryv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *]
+                if indicey[0] EQ firstyv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *]
             END
             (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $
@@ -191,5 +195,5 @@
 ; calcul du rotationnel
 ;----------------------------------------------------------------------------
-         coefu = e1u[indice2d]*(umask())[indice2d+jpi*jpj*premierzt]
+         coefu = e1u[indice2d]*(umask())[indice2d+jpi*jpj*firstzt]
          terreu = where(coefu EQ 0)
          if terreu[0] NE -1 then coefu[temporary(terreu)] = !values.f_nan
@@ -197,5 +201,5 @@
          coefu = reform(coefu, nx, ny, jpt, /over)
 ;
-         coefv = e2v[indice2d]*(vmask())[indice2d+jpi*jpj*premierzt]
+         coefv = e2v[indice2d]*(vmask())[indice2d+jpi*jpj*firstzt]
          terrev = where(coefv EQ 0)
          if terrev[0] NE -1 then coefv[temporary(terrev)] = !values.f_nan
@@ -203,5 +207,5 @@
          coefv = reform(coefv, nx, ny, jpt, /over)
 ;
-         tabf = (fmask())[indice2d+jpi*jpj*premierzt]/(e1f[indice2d]*e2f[indice2d])
+         tabf = (fmask())[indice2d+jpi*jpj*firstzt]/(e1f[indice2d]*e2f[indice2d])
          tabf = temporary(tabf[*])#replicate(1, jpt)
          tabf = reform(tabf, nx, ny, jpt, /over)
@@ -217,5 +221,5 @@
 ; mise a !values.f_nan de la bordure
 ;------------------------------------------------------------
-         if NOT keyword_set(key_periodique) OR nx NE jpi then begin
+         if NOT keyword_set(key_periodic) OR nx NE jpi then begin
             psi(0, *, *) = !values.f_nan
             psi(nx-1, *, *) = !values.f_nan
@@ -227,6 +231,6 @@
          if terref[0] NE -1 then psi[temporary(terref)] = valmask
 ;----------------------------------------------------------------------------
-         domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], prof1, prof2, grille = ['t', 'f']
-         if keyword_set(direc) then psi = grossemoyenne(psi,direc,/nan, boite = boite)
+         domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], vert1, vert2, gridtype = ['t', 'f']
+         if keyword_set(direc) then psi = grossemoyenne(psi,direc,/nan)
 ;----------------------------------------------------------------------------
       END
@@ -255,11 +259,11 @@
              (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 
                if nxu NE nx then $
-                if indicex[0] EQ premierxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *] 
+                if indicex[0] EQ firstxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *] 
                IF nxv NE nx THEN $
-                if indicex[0] EQ premierxv then v = v[0:nx-1, *] ELSE v = v[1: nx, *]
+                if indicex[0] EQ firstxv then v = v[0:nx-1, *] ELSE v = v[1: nx, *]
                IF nyu NE ny THEN $
-                if indicey[0] EQ premieryu then u = u[*, 0:ny-1] ELSE u = u[*, 1: ny] 
+                if indicey[0] EQ firstyu then u = u[*, 0:ny-1] ELSE u = u[*, 1: ny] 
                IF nyv NE ny THEN $
-                if indicey[0] EQ premieryv then v = v[*, 0:ny-1] ELSE v = v[*, 1: ny]
+                if indicey[0] EQ firstyv then v = v[*, 0:ny-1] ELSE v = v[*, 1: ny]
             END
             (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $
@@ -273,11 +277,11 @@
 ; calcul du rotationnel
 ;------------------------------------------------------------
-         coefu = e1u[indice2d]*(umask())[indice2d+jpi*jpj*premierzt]
+         coefu = e1u[indice2d]*(umask())[indice2d+jpi*jpj*firstzt]
          terreu = where(coefu EQ 0)
          if terreu[0] NE -1 then coefu[temporary(terreu)] = !values.f_nan
-         coefv = e2v[indice2d]*(vmask())[indice2d+jpi*jpj*premierzt]
+         coefv = e2v[indice2d]*(vmask())[indice2d+jpi*jpj*firstzt]
          terrev = where(coefv EQ 0)
          if terrev[0] NE -1 then coefv[temporary(terrev)] = !values.f_nan
-         tabf = (fmask())[indice2d+jpi*jpj*premierzt]/(e1f[indice2d]*e2f[indice2d])
+         tabf = (fmask())[indice2d+jpi*jpj*firstzt]/(e1f[indice2d]*e2f[indice2d])
 ;
          zu = u*temporary(coefu)
@@ -290,5 +294,5 @@
 ; mise a !values.f_nan de la bordure
 ;------------------------------------------------------------
-         if  NOT keyword_set(key_periodique) OR nx NE jpi then begin
+         if  NOT keyword_set(key_periodic) OR nx NE jpi then begin
             psi(0, *) = !values.f_nan
             psi(nx-1, *) = !values.f_nan
@@ -303,7 +307,6 @@
 ; pour le trace graphique
 ;------------------------------------------------------------
-         domdef, (glamt[indice2d])[0, 0], (glamf[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphif[indice2d])[0, ny-1], prof1, prof2, grille = ['t', 'f']
-         if keyword_set(direc) then psi = moyenne(psi,direc,/nan, boite = boite)
-
+         domdef, (glamt[indice2d])[0, 0], (glamf[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphif[indice2d])[0, ny-1], vert1, vert2, gridtype = ['t', 'f']
+         if keyword_set(direc) then psi = moyenne(psi,direc,/nan)
 
       END
