Index: /trunk/FIG_bar_transp_write.pro
===================================================================
--- /trunk/FIG_bar_transp_write.pro	(revision 2)
+++ /trunk/FIG_bar_transp_write.pro	(revision 2)
@@ -0,0 +1,175 @@
+PRO FIG_bar_transp_write,iyear,ian 
+@init2
+@initorca2_bab
+
+; draw the vertically integrated transport
+
+
+@common
+
+ian='01'
+iyear='1993'
+
+e_exp='ESS'
+;e_exp0='FRI'
+;e_year0='10'
+key_portrait = 0
+; stockage des fichiers brut 
+  ioDATA='/usr/work/sur/fvi/OPA/ORCA2/'+e_exp
+  file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 
+  print, file_U
+  file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 
+  print, file_V
+
+; title
+     t_exp= e_exp
+;     t_exp0= e_exp0
+     t_bt  = 'bar_transp'
+ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2'
+;facteur d'echelle vertical  for partial steps
+e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+
+
+
+; vertical integration:
+e3t3d=make_array(jpi,jpj,jpk)   
+        for k=0, jpk-1 do begin              &$
+          for j=0,jpj-1 do begin              &$      
+            for i=0,jpi-1 do begin             &$
+              e3t3d(i,j,k) = e3t(k)    &$
+            endfor                     &$
+          endfor                      &$
+        endfor
+jpt = 73
+
+;vud = make_array(jpi,jpj,jpt)   
+;vvd = make_array(jpi, jpj, jpt)
+
+; ouverture des fichiers dans lesquels on va écrire 
+id3=NCDF_OPEN('/usr/work/sur/fvi/geomag/U_5d_'+iyear+'_grid_T.nc',/write)
+id4=NCDF_OPEN('/usr/work/sur/fvi/geomag/V_5d_'+iyear+'_grid_T.nc',/write)
+
+FOR jt = 0, jpt-1 DO BEGIN &$   
+
+; ouverture des fichiers et stockage en memoire partial steps
+  vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$   
+  vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$   
+
+  
+
+; Somme sur la verticale partial steps
+                vum=total( vu*e3u3d*umask(),3 )  &$   
+                vvm=total( vv*e3v3d*vmask(),3 )  &$   
+
+; Shit sur la grille T partial steps
+             vut= (vum+shift(vum,1,0) )*0.5   &$   
+             vvt= (vvm+shift(vvm,0,1) )*0.5   &$
+; Bande de recouvrement 
+             vut(0, *) = vut(jpi-2, *)
+             vvt(*, 0) = 0.
+; stockage dans le fichier de sortie 
+NCDF_VARPUT, id3,'sossheig',vut, offset = [0, 0, jt]
+NCDF_VARPUT, id4,'sossheig',vvt, offset = [0, 0, jt]
+
+print,  jt
+
+ENDFOR  
+; on ferme le NetCDF
+NCDF_CLOSE,id3
+NCDF_CLOSE,id4
+
+
+
+
+;     z_ext=[0.,200.,10]
+;    plt, vut, min=z_ext[0], max=z_ext[1], int=z_ext[2], window = 1.,cell_fill = 2,/landscape, $
+;           title=varname+' - Experiment-',lct=64, boite=[20, 380, -79, 90],  /nocontour
+; ;, $    vecteur = {u:vum0, v:vvm0},vectcolor = 0, vectmin = 0.01, normeref =200, $
+; ;    GRILLE = 'T', unvectsur = [n1, n2]
+
+;    plt, vvt, min=z_ext[0], max=z_ext[1], int=z_ext[2], window = 2.,cell_fill = 2,/landscape, $
+;           title=varname+' - Experiment-',lct=64, boite=[20, 380, -79, 90],  /nocontour
+; ;, $    vecteur = {u:vum, v:vvm},vectcolor = 0, vectmin = 0.01, normeref =200, $
+; ;    GRILLE = 'T', unvectsur = [n1, n2]
+
+
+
+; Nom
+;    iodir1 = '/home/alb/IDL_DATA/INTER/ESS/'
+;    idout = NCDF_CREATE(iodir1+'U_V_5d_1993_grid_T.nc',/clobber)
+;    print, 'Creation du fichier Netcdf'
+;    NCDF_CONTROL, idout, /nofill
+; Dimension
+;    xidout = NCDF_DIMDEF(idout, 'x', jpiglo)
+;    yidout = NCDF_DIMDEF(idout, 'y', jpjglo)
+;    didout = NCDF_DIMDEF(idout, 'deptht', 1)
+;    tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
+
+   
+; Attributs globaux
+;    id0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ], /FLOAT)
+;    id1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ], /FLOAT)
+;    id2  = NCDF_VARDEF(idout, 'deptht'      , [                didout        ], /FLOAT)
+;    id3  = NCDF_VARDEF(idout, 'time_counter', [                        tidout], /DOUBLE)
+;    id4  = NCDF_VARDEF(idout, 'vozocrtx'    , [xidout, yidout,         tidout], /FLOAT)
+;    id5  = NCDF_VARDEF(idout, 'vomecrty'    , [xidout, yidout,         tidout], /FLOAT)
+; Variable 0
+;    NCDF_ATTPUT, idout, id0, 'units', 'degrees_east'
+;    NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude'
+;    NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid'
+; Variable 1
+;    NCDF_ATTPUT, idout, id1, 'units', 'degrees_north'
+;    NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude'
+;    NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid'
+; Variable 2
+;    NCDF_ATTPUT, idout, id2, 'units','meters'
+;    NCDF_ATTPUT, idout, id2, 'long_name','Depth'
+;    NCDF_ATTPUT, idout, id2, 'nav_model','Default grid'
+; Variable3
+;    NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-01 00:00:00 '
+;    NCDF_ATTPUT, idout, id3, 'calendar','noleap'
+;    NCDF_ATTPUT, idout, id3, 'title', 'Time'
+;    NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis'
+;    NCDF_ATTPUT, idout, id3, 'time_origin','0001-JAN-01 00:00:00'
+; Variable4
+;    NCDF_ATTPUT, idout, id4, 'units', 'm/s'
+;    NCDF_ATTPUT, idout, id4, 'title', 'vozocrtx'
+;    NCDF_ATTPUT, idout, id4, 'long_name', 'zonal current summmed on vertical'
+; Variable5
+;    NCDF_ATTPUT, idout, id5, 'units', 'm/s'
+;    NCDF_ATTPUT, idout, id5, 'title', 'vomecrty'
+;    NCDF_ATTPUT, idout, id5, 'long_name', 'meridian current summmed on vertical'
+ 
+;    NCDF_CONTROL, idout, /ENDEF
+
+; Creation de la longitude
+;    NCDF_VARPUT, idout, id0, glamt
+; Creation de la latitude
+;    NCDF_VARPUT, idout, id1, gphit
+; Creation de la profondeur 
+;    prof=1.
+;    NCDF_VARPUT, idout, id2, prof 
+; Creation du calendrier
+;   temps = findgen(jpt)*5.*86400. +julday(1, 1, 1)
+;    jpt = 73
+;    temps = findgen(jpt)
+;    print, temps
+;    NCDF_VARPUT, idout, id3, temps
+
+   
+; Ecriture des donnees
+
+; Ecriture de la salinite de surface de Levitus
+
+;    NCDF_VARPUT, idout, id4 , vut, offset = [0, 0, jt]
+;    NCDF_VARPUT, idout, id5 , vvt, offset = [0, 0, jt]
+
+;    NCDF_CLOSE, idout
+
+
+
+
+
+
+END
Index: /trunk/INTERP2/check_inside.pro
===================================================================
--- /trunk/INTERP2/check_inside.pro	(revision 2)
+++ /trunk/INTERP2/check_inside.pro	(revision 2)
@@ -0,0 +1,106 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: check_inside.pro
+;
+; PURPOSE: Find in which grid cell stands a given longitude/latitude position
+;
+; CATEGORY : Subroutine
+;
+; CALLING SEQUENCE : pro check_inside, xx,yy,zz, x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,result
+;
+; INPUTS :
+;         xx,yy,zz : cartesian coordinates of P the point that has to be located
+;         in grid.
+;         x1,y1,z1 : coordinates of A point of grid (See
+;         documentation)
+;         x2,y2,z2 : coordinates of B point of grid (See
+;         documentation)
+;         x3,y3,z3 : coordinates of C point of grid (See
+;         documentation)
+;         x4,y4,z4 : coordinates of D point of grid (See
+;         documentation)
+; OUTPUTS :
+;         result : location of the P point in grid
+; COMMON BLOCKS:
+;         None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
+;
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+pro check_inside, xx,yy,zz, x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,result
+
+
+
+ABx=x2-x1
+ABy=y2-y1
+
+BPx=xx-x2
+BPy=yy-y2
+BPz=zz-z2
+
+
+
+AB_Vect_BP=ABx*BPy-BPx*ABy
+BP=sqrt(BPx*BPx+BPy*BPy+BPz*BPz)
+
+
+BCx=x3-x2
+BCy=y3-y2
+
+CPx=xx-x3
+CPy=yy-y3
+CPz=zz-z3
+
+
+BC_Vect_CP=BCx*CPy-BCy*CPx
+CP=sqrt(CPx*CPx+CPy*CPy+CPz*CPz)
+
+CDx=x4-x3
+CDy=y4-y3
+
+DPx=xx-x4
+DPy=yy-y4
+DPz=zz-z4
+
+
+CD_Vect_DP=CDx*DPy-CDy*DPx
+DP=sqrt(DPx*DPx+DPy*DPy+DPz*DPz)
+
+DAx=x1-x4
+DAy=y1-y4
+
+APx=xx-x1
+APy=yy-y1
+APz=zz-z1
+
+DA_Vect_AP=DAx*APy-DAy*APx
+AP=sqrt(APx*APx+APy*APy+APz*APz)
+
+Dist=AP+BP+CP+DP
+
+
+
+result= where( ( (AB_Vect_BP LE 0.) AND (BC_Vect_CP LE 0.) AND (CD_Vect_DP LE 0.) AND (DA_Vect_AP LE 0.) ) OR      $
+               ( (AB_Vect_BP GE 0.) AND (BC_Vect_CP GE 0.) AND (CD_Vect_DP GE 0.) AND (DA_Vect_AP GE 0.) )  )                        
+
+
+
+Dist_result=Dist(result)
+
+min_dist=where(Dist_result EQ min(Dist_result))
+
+result=result(min_dist)
+
+
+end
Index: /trunk/INTERP2/for_createpro.pro
===================================================================
--- /trunk/INTERP2/for_createpro.pro	(revision 2)
+++ /trunk/INTERP2/for_createpro.pro	(revision 2)
@@ -0,0 +1,4 @@
+pro for_createpro
+@/usr/work/sur/fvi/OPA/geomag/INTERP2/initorca_reg
+return
+end
Index: /trunk/INTERP2/get_fullmesh.pro
===================================================================
--- /trunk/INTERP2/get_fullmesh.pro	(revision 2)
+++ /trunk/INTERP2/get_fullmesh.pro	(revision 2)
@@ -0,0 +1,43 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: get_fullmesh.pro
+;
+; PURPOSE: Enables getting the full mesh for longitude & latitude
+;
+; CATEGORY : Subroutine
+;
+; CALLING SEQUENCE : get_fullmesh, glamt_full,gphit_full
+;
+; INPUTS :
+;         A meshmask file
+; OUTPUTS :
+;         Longitude and latitude fields that include extra stripes
+; COMMON BLOCKS:
+;         None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
+;
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+pro get_fullmesh, glamt_full,gphit_full
+
+@initorca_grand
+
+glamt_full=glamt
+gphit_full=gphit
+
+@initorca
+
+
+end
+
Index: /trunk/INTERP2/init.pro
===================================================================
--- /trunk/INTERP2/init.pro	(revision 2)
+++ /trunk/INTERP2/init.pro	(revision 2)
@@ -0,0 +1,130 @@
+; on lance l''aide en ligne
+
+;
+; partie a modifier
+;
+;----------------------------------------------------------
+; extension du path
+
+!path=expand_path('+/usr/home/smasson/IDL_RD')+':'+expand_path('+'+!dir)
+
+@common
+;----------------------------------------------------------
+; pour l''impression si vous utiliser imprime depuis le lodyc,
+; l''ipsl, l''idris.
+; loginipsl='smlod'
+; machipsl = 'cook'
+loginlodyc='fvi'
+machlodyc = 'leto'
+;----------------------------------------------------------
+; definition de differentes directories
+;----------------------------------------------------------
+homedir = '/usr/work/sur/fvi/OPA/geomag/'
+iodir = '/usr/work/sur/fvi/OPA/ORCA2/'
+animdir =iodir
+psdir = '/usr/work/sur/fvi/IDL/IDL_PS/'
+imagedir = iodir
+;
+; fin de la partie a modifier
+;
+
+;homedir = isadirectory(io = homedir, title = 'Bad definition of homedir')
+;workdir = isadirectory(io = workdir, title = 'Bad definition of workdir', /nopath)
+;tmpdir = isadirectory(io = tmpdir, title = 'Bad definition of tmpdir', /nopath)
+;iodir = isadirectory(io = iodir, title = 'Bad definition of iodir', /nopath)
+;animdir = isadirectory(io = animdir, title = 'Bad definition of animdir', /nopath)
+psdir = isadirectory(io = psdir, title = 'Bad definition of psdir', /nopath)
+;imagedir = isadirectory(io = imagedir, title = 'Bad definition of imagedir', /nopath)
+;----------------------------------------------------------
+; environnement graphique (window et ps)
+;----------------------------------------------------------
+if (((!D.Name EQ 'X') OR (!D.NAME EQ 'MAC')) $
+AND (!D.N_Colors GE 256L)) then $
+DEVICE, True_Color=24, decompose=0 $
+else begin & window, colors=100 & wdelete & $
+device, pseudo_color=8 & endelse
+;
+; DEVICE, True_Color=24, decompose=0
+;
+loadct,39
+tvlct, rouge,vert,bleu, /get
+coefpalit= 1
+key_portrait = 0
+; SET UP COLOR TABLES FOR X11 ENVIRONMENT
+;
+;DEVICE, TRUE_COLOR = 24
+;DEVICE, Decomposed=0
+;DEVICE, Bypass_Translation=0
+;DEVICE, RETAIN=2
+;
+;----------------------------------------------------------
+c_lab=0
+c_cote=0
+c_cont = (!d.n_colors-1) < 255
+;----------------------------------------------------------
+grandfeuille = 29.7
+petitfeuille = 21.
+ccwindowsize = 1
+;----------------------------------------------------------
+!except = 2
+sauveps = 0
+;--------------------------------------------------------
+;   definition par defaut du fichier que l''on traite
+;------------------------------------------------------
+year=1
+month=1
+day=1
+niveau=1
+
+;
+prefix=' '
+;
+vargrid = 'T'
+varname = ' '
+vardate= '0'
+varexp = ' '
+varunit = ' '
+;----------------------------------------------------------
+;----------------------------------------------------------
+jpiglo = 1
+jpjglo = 1
+jpkglo = 1
+jpidta = jpiglo
+jpjdta = jpjglo
+jpkdta = jpjglo
+jpi = 1
+jpj = 1
+jpk = 1
+jpt = 1
+ixminmesh  =-1
+ixmaxmesh  =-1
+iyminmesh  =-1
+iymaxmesh  =-1
+izminmesh  =-1
+izmaxmesh  =-1
+ixmindta = 0
+ixmaxdta = jpidta-1
+iymindta = 0
+iymaxdta = jpjdta-1
+izmindta = 0
+izmaxdta = jpkdta-1
+key_shift = 0
+key_periodique = 0
+ccmeshparameters ={filename:'meshmask.nc', filetype:'nothing' $
+, jpiglo:jpiglo, jpjglo:jpjglo, jpkglo:jpkglo $
+, jpi:jpi, jpj:jpj, jpk:jpk $
+, ixminmesh:ixminmesh, ixmaxmesh:ixmaxmesh $
+, iyminmesh:iyminmesh, iymaxmesh:iymaxmesh $
+, izminmesh:izminmesh, izmaxmesh:izmaxmesh $
+, key_shift:key_shift, key_periodique:key_periodique $
+, triangulation:0, boundary:[-180, 180]}
+ccreadparameters = {funclec_name:'No File' $
+, jpidta:jpidta, jpjdta:jpjdta, jpkdta:jpkdta $
+, ixmindta:ixmindta, ixmaxdta:ixmaxdta $
+, iymindta:iymindta, iymaxdta:iymaxdta $
+, izmindta:izmindta, izmaxdta:izmaxdta $
+}
+lon1 = 0
+lon2 = 1
+lat1 = 0
+lat2 = 1
Index: /trunk/INTERP2/init_path2.pro
===================================================================
--- /trunk/INTERP2/init_path2.pro	(revision 2)
+++ /trunk/INTERP2/init_path2.pro	(revision 2)
@@ -0,0 +1,107 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: init_path2.pro
+;
+; PURPOSE: File Path required for INTERP2
+;
+; CATEGORY : Namelist
+;
+; CALLING SEQUENCE : @init_path2
+;
+; COMMON BLOCKS:
+;         None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
+;
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+
+;---------------------------------------------------
+; INTERP2 : PATH INITIALISATIONS                            *
+;---------------------------------------------------
+;
+; 1. Directories
+; ==============
+;
+
+   input_dir = '/usr/work/sur/fvi/OPA/ORCA2'
+   output_dir = '/usr/work/sur/fvi/OPA/ORCA2'
+
+;
+; 2. Input information 
+; ====================
+;
+;  2.1. Data file name
+;  -------------------
+;
+ 
+
+   datafile = 'ForcageMOED_5d_1993_grid_T.nc'
+   outputfile = 'ForcMOED_Sigma_1993_reg.nc'
+
+;   datafile = 'DivBustar_5d_1993_grid_T.nc'
+;   outputfile = 'DivBustar_5d_1993_reg.nc'
+;   datafile = 'Sigma_5d_1998_grid_T.nc'
+;   outputfile = 'Sigma_5d_1998_reg.nc'
+;
+;  2.2. Input ORCA Meshmask file name
+;  ------------------------
+;
+
+   inputmesh = 'meshmask_bab.nc'
+
+;
+; 3. Output information  
+; =====================
+;
+;  3.1. Output geogrid meshmask (please print the name you want to
+;  give to this file, even if you do not have it yet)
+;  ----------------------------
+;
+   outputgrid = 'mask_reg.nc'
+
+;  3.2. Weight file required for interpolation (please print the name you want to
+;  give to this file, even if you do not have it yet)
+;  ----------------------------
+;
+   weightfile = 'weight_ORCA2_grid_T.nc'
+
+
+;
+;  3.3. Output file name
+;  ---------------------
+;
+;;;;   outputfile = 'DivBustar_5d_1998_reg.nc'
+ 
+
+;
+;  3.4  Error file in weight calculation
+;  -------------------------------------
+;
+
+   errorfile='error_wT'
+   
+;*************** END OF USER'S PART *******************
+;********DO NOT MODIFY ANYTHING BELLOW THIS LINE*******
+;******************************************************
+
+
+datafile   = string(input_dir,'/',datafile)
+inputmesh  = string(input_dir,'/',inputmesh)
+outputgrid = string(output_dir,'/',outputgrid)
+weightfile = string(output_dir,'/',weightfile)
+outputfile = string(output_dir,'/',outputfile)
+errorfile  = string(output_dir,'/',errorfile)
+
+
+;*****************************************************
+
Index: /trunk/INTERP2/initorca.pro
===================================================================
--- /trunk/INTERP2/initorca.pro	(revision 2)
+++ /trunk/INTERP2/initorca.pro	(revision 2)
@@ -0,0 +1,43 @@
+;
+;
+@common
+@init_path2
+;---------------------------------------------------------
+; bornes de la grille
+;----------------------------------------------------------
+ixminmesh  =1
+ixmaxmesh  =180
+;
+iyminmesh  =0
+iymaxmesh  =147
+;
+izminmesh  =-1
+izmaxmesh  =-1
+;
+jpt = 1
+time = 0
+;------------------------------------------------------
+; lecture de la grille
+;------------------------------------------------------
+iodir = input_dir
+key_shift = 0
+key_stride = [1, 1, 1]
+ncdf_meshlec, 'meshmask.nc', glamboundary = [80, 440]
+;-------------------------------------------------------------
+domdef
+;
+key_periodique = 1
+triangles = triangule()
+;----------------------------------------------------------
+; bornes pour la lecture des donnees
+;----------------------------------------------------------
+jpidta = jpiglo
+jpjdta = jpjglo
+jpkdta = jpkglo
+ixmindta = 0
+ixmaxdta = jpidta-1
+iymindta = 0
+iymaxdta = jpjdta-1
+izmindta = 0
+izmaxdta = jpkdta-1
+
Index: /trunk/INTERP2/initorca_grand.pro
===================================================================
--- /trunk/INTERP2/initorca_grand.pro	(revision 2)
+++ /trunk/INTERP2/initorca_grand.pro	(revision 2)
@@ -0,0 +1,43 @@
+;
+;
+@common
+@init_path2
+;---------------------------------------------------------
+; bornes de la grille
+;----------------------------------------------------------
+ixminmesh  =0
+ixmaxmesh  =181
+;
+iyminmesh  =0
+iymaxmesh  =148
+;
+izminmesh  =-1
+izmaxmesh  =-1
+;
+jpt = 1
+time = 0
+;------------------------------------------------------
+; lecture de la grille
+;------------------------------------------------------
+iodir = input_dir
+key_shift = 0
+key_stride = [1, 1, 1]
+ncdf_meshlec, 'meshmask.nc', glamboundary = [80, 440]
+;-------------------------------------------------------------
+domdef
+;
+key_periodique = 1
+triangles = triangule()
+;----------------------------------------------------------
+; bornes pour la lecture des donnees
+;----------------------------------------------------------
+jpidta = jpiglo
+jpjdta = jpjglo
+jpkdta = jpkglo
+ixmindta = 0
+ixmaxdta = jpidta-1
+iymindta = 0
+iymaxdta = jpjdta-1
+izmindta = 0
+izmaxdta = jpkdta-1
+
Index: /trunk/INTERP2/initorca_reg.pro
===================================================================
--- /trunk/INTERP2/initorca_reg.pro	(revision 2)
+++ /trunk/INTERP2/initorca_reg.pro	(revision 2)
@@ -0,0 +1,45 @@
+;
+;
+@common
+@init_path2
+;---------------------------------------------------------
+; bornes de la grille
+;----------------------------------------------------------
+
+
+ixminmesh  =1
+ixmaxmesh  =180
+;
+iyminmesh  =0
+iymaxmesh  =147
+;
+izminmesh  =-1
+izmaxmesh  =-1
+;
+jpt = 1
+time = 0
+;------------------------------------------------------
+; lecture de la grille
+;------------------------------------------------------
+iodir = input_dir
+key_shift = 0
+key_stride = [1, 1, 1]
+ncdf_meshlec, 'mask_reg.nc', glamboundary = [80, 440]
+;-------------------------------------------------------------
+domdef
+;
+key_periodique = 1
+triangles = triangule()
+;----------------------------------------------------------
+; bornes pour la lecture des donnees
+;----------------------------------------------------------
+jpidta = jpiglo
+jpjdta = jpjglo
+jpkdta = jpkglo
+ixmindta = 0
+ixmaxdta = jpidta-1
+iymindta = 0
+iymaxdta = jpjdta-1
+izmindta = 0
+izmaxdta = jpkdta-1
+
Index: /trunk/INTERP2/interp2.pro
===================================================================
--- /trunk/INTERP2/interp2.pro	(revision 2)
+++ /trunk/INTERP2/interp2.pro	(revision 2)
@@ -0,0 +1,78 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: interp2.pro
+;
+; PURPOSE: Enables interpolation from a given ORCA grid to its
+; closest geographical equivalent grid
+;
+; CATEGORY : Subroutine
+;
+; CALLING SEQUENCE : interp2
+;
+; INPUTS :
+;         A full ORCA grid file + a 1D or 2D field on this grid 
+; OUTPUTS :
+;        - A grid file for the geographical equivalent to the given
+;         ORCA grid   
+;        - The interpolated field on this new grid + the weights and
+;          pointers required to creat it.
+;
+; COMMON BLOCKS:
+;
+;         None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS: REQUIRES SAXO TOOL
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
+;
+;------------------------------------------------------------
+pro interp2
+
+
+
+@initorca
+@naminterp2
+
+
+
+;----------------------------------------------------------
+; GEOGRID COMPUTATION (Grid & Mask)
+;----------------------------------------------------------
+
+
+if geogrid_mesh EQ 0 then begin
+
+     print, 'Geogrid will be calculated, this may take a while, please wait...'
+
+     make_geogrid
+
+endif
+
+;----------------------------------------------------------
+; WEIGHT & POINTER FILE COMPUTATION
+;----------------------------------------------------------
+
+if weight_file EQ 0 then begin
+
+     print, 'Weight file must calculated, this will take quite a while...'
+
+     make_weight
+
+endif
+
+;----------------------------------------------------------
+; Output fields calculation
+;----------------------------------------------------------
+
+     newinterp
+
+
+end
+
+
Index: /trunk/INTERP2/make_geogrid.pro
===================================================================
--- /trunk/INTERP2/make_geogrid.pro	(revision 2)
+++ /trunk/INTERP2/make_geogrid.pro	(revision 2)
@@ -0,0 +1,716 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: make_geogrid.pro
+;
+; PURPOSE: Creates for a given ORCA grid, ORCA_GEO which is
+; the closest geographical grid to this ORCA grid
+;
+; CATEGORY : Subroutine
+;
+; CALLING SEQUENCE : make_geogrid
+;
+; INPUTS :
+;         All the variables of a given ORCA meshmask file
+; OUTPUTS :
+;         A netcdf format meshmask file that has the same size as the
+;         one given in input and contains exactly the same variable,
+;         although they describe another grid.
+;
+; COMMON BLOCKS:
+;         None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
+;
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+
+pro make_geogrid
+
+@initorca
+@init_path2
+@naminterp2
+
+;------------------------------------------------------------
+; Creation of a regular grid based on a given ORCA grid
+;------------------------------------------------------------
+
+
+;******************************************
+; 0. DEFINE OUTPUT VALUES
+;******************************************
+
+
+; Output values are set to input values
+
+  glamt_reg=glamt
+  glamu_reg=glamu
+  glamv_reg=glamv
+  glamf_reg=glamf
+
+  gphit_reg=gphit
+  gphiu_reg=gphiu
+  gphiv_reg=gphiv
+  gphif_reg=gphif
+
+  e1t_reg=e1t
+  e1u_reg=e1u
+  e1v_reg=e1v
+  e1f_reg=e1f
+
+  e2t_reg=e2t
+  e2u_reg=e2u
+  e2v_reg=e2v
+  e2f_reg=e2f
+  
+  tmask_reg=tmask
+  umask_reg=tmask
+  vmask_reg=tmask
+  fmask_reg=tmask
+
+
+;*****************************************************************
+; 1. FIRST STEP : DEFINE  THE LATITUDE, LONGITUDE & SCALE FACTORS
+;*****************************************************************
+
+; Let's get our reference latitude. Search for northernmost place
+; of the ORCA grid that is still geographical
+
+northernmost=where(gphit EQ max(gphit))
+
+jnorth=northernmost/jpi
+
+inorth=min(northernmost-jnorth*jpi)
+
+ref_latitude=gphit(inorth,*)
+
+; Let's get the reference longitude
+
+equador=where(abs(gphit) EQ  min(abs(gphit)) )
+
+ref_longitude=glamt(equador)
+
+; Duplication for all T points
+
+glamt_reg=ref_longitude#replicate(1,n_elements(ref_latitude))
+
+
+gphit_reg=replicate(1,n_elements(ref_longitude))#ref_latitude
+
+; COMPUTATION OF LONGITUDES AND LATITUDES AT ALL POINTS
+
+; From this we can deduce glamu_reg and gphiu_reg
+
+glamu_reg=glamt_reg+grid_def/2.
+gphiu_reg=gphit_reg
+
+; As well as glamv_reg and gphiv_reg
+
+glamv_reg=glamt_reg
+gphiv_reg=gphit_reg+(gphit_reg-shift(gphit_reg,0,-1))/2.
+gphiv_reg(*,jpj-1)=gphit_reg(*,jpj-1)+(gphit_reg(*,jpj-1)-gphit_reg(*,jpj-2))/2.
+
+; Same thing for glamf_reg and gphif_reg
+
+glamf_reg=glamu_reg
+gphif_reg=gphiv_reg
+
+
+; COMPUTATION OF SCALE FACTORS
+
+
+
+; Scale factor at equator
+
+eq_j=where(gphit(inorth,*) EQ 0.)
+
+e1t_eq=e1t(*,eq_j)
+
+; E1t scale factor
+
+e1t_reg=( e1t_eq#replicate(1.,jpj) )*(replicate(1.,jpi)#cos(!PI*gphit(inorth,*)/180.))
+
+
+; E2t scale factor
+
+e2t_reg=replicate(1.,jpi)#e2t(inorth,*)
+
+
+; E1u scale factor
+; e1u_reg=e1t_reg because the grid is fully regular along x axis
+; Same remark for e2u
+
+e1u_reg=e1t_reg
+e2u_reg=e2t_reg
+
+;E1v scale factor
+
+e1v_reg=( e1t_eq#replicate(1.,jpj) )*(replicate(1.,jpi)#cos(!PI*gphiv(inorth,*)/180.))
+
+; E2v scale factor
+
+e2v_reg=replicate(1.,jpi)#e2v(inorth,*)
+
+;E1f scale factor
+
+e1f_reg=( e1t_eq#replicate(1.,jpj) )*(replicate(1.,jpi)#cos(!PI*gphit(inorth,*)/180.))
+
+;E2f scale factor
+
+e2f_reg=replicate(1.,jpi)#e2f(inorth,*)
+
+
+;************************************************
+;  2nd STEP : Define the mask of the outpût grid
+;************************************************
+
+
+; We now need to define the grid mask...
+
+
+mask_reg=tmask
+
+; Let's get entire coordinates of meshmask
+
+
+sph_coord=replicate(1.,3,jpi*jpj)
+
+; We put some crazy values of radius on half of the North Fold line in order
+; to avoid any problem
+
+sph_coord(2,jpj*jpi-1-jpi/2:jpj*jpi-1)=10. 
+
+sph_coord(0,*)=reform(glamt,jpi*jpj)
+sph_coord(1,*)=reform(gphit,jpi*jpj)
+
+rec_grid=cv_coord(/DEGREES,FROM_SPHERE=sph_coord,/TO_RECT)
+
+xx_grid=rec_grid(0,*)
+yy_grid=rec_grid(1,*)   
+zz_grid=rec_grid(2,*)
+  
+
+not_found=1
+for jj=0, jpj-1 do begin
+
+   lat_max_ORCA=max( gphit(*,jj)     )
+   lat_max_reg =max( gphit_reg(*,jj) )
+
+
+   if ((lat_max_ORCA NE lat_max_reg) AND (not_found EQ 1)) then begin
+   jpj_start=jj-2
+   not_found=0
+   endif
+
+end
+
+
+
+; Loop on all elements of our geo grid
+
+for jj=jpj/2,jpj-1 do begin
+    for ji=0,jpi-1 do begin
+   
+
+; Coordinates of our point
+
+    xx=glamt_reg(ji,jj)
+    yy=gphit_reg(ji,jj)
+   
+    sph_coord=replicate(1.,3)
+    sph_coord(0)=xx
+    sph_coord(1)=yy
+
+; Convert them into cartesian 
+    
+    rec_coord=cv_coord(/DEGREES,FROM_SPHERE=sph_coord,/TO_RECT)
+
+    xx_bis=replicate(rec_coord(0),jpi*jpj)
+    yy_bis=replicate(rec_coord(1),jpi*jpj)
+    zz_bis=replicate(rec_coord(2),jpi*jpj)
+
+    modules=sqrt((xx_grid-xx_bis)*(xx_grid-xx_bis)  $
+                +(yy_grid-yy_bis)*(yy_grid-yy_bis)  $
+                +(zz_grid-zz_bis)*(zz_grid-zz_bis))
+    
+
+    sort_mod=where(modules EQ min(modules))
+
+    answj=sort_mod(0)/jpi   
+
+    answi=sort_mod(0)-answj*jpi
+
+
+    mask_reg(ji,jj,*)=tmask(answi,answj,*)
+    
+ 
+    endfor
+endfor
+
+;*****************************************
+; 3rd STEP : PUT VALUES INTO ATTRIBUTES
+;*****************************************
+
+;********** T MASK*********************
+
+; Create Global Mask file for T point
+
+    tmask_reg_glo=replicate(0.,jpiglo,jpjglo,jpk)
+
+    tmask_reg_glo(1:jpiglo-2,0:jpjglo-2, *)=mask_reg
+
+
+; Data Duplication
+
+; North
+
+    tmask_reg_glo(*,jpjglo-1,*)=tmask_reg_glo(*,jpjglo-2,*)
+;E/W
+
+    tmask_reg_glo(0,*,*)=tmask_reg_glo(jpiglo-2,*,*)
+    tmask_reg_glo(jpiglo-1,*,*)=tmask_reg_glo(1,*,*)
+
+; Global T mask in created
+
+; Creates U mask, V mask and F mask
+
+
+   umask_reg=tmask_reg_glo(1:jpiglo-2,0:jpjglo-2,*)*tmask_reg_glo(2:jpiglo-1,0:jpjglo-2,*)
+
+   vmask_reg=tmask_reg_glo(1:jpiglo-2,0:jpjglo-2,*)*tmask_reg_glo(1:jpiglo-2,1:jpjglo-1,*)
+
+   fmask_reg=tmask_reg_glo(1:jpiglo-2,0:jpjglo-2,*)*tmask_reg_glo(2:jpiglo-1,0:jpjglo-2,*) $
+            *tmask_reg_glo(1:jpiglo-2,1:jpjglo-1,*)*tmask_reg_glo(2:jpiglo-1,1:jpjglo-1,*)
+
+; Create Global Mask file for U,V & F points
+
+    umask_reg_glo=replicate(0.,jpiglo,jpjglo,jpk)
+    umask_reg_glo(1:jpiglo-2,0:jpjglo-2, *)=umask_reg
+
+    vmask_reg_glo=replicate(0.,jpiglo,jpjglo,jpk)
+    vmask_reg_glo(1:jpiglo-2,0:jpjglo-2, *)=vmask_reg
+
+    fmask_reg_glo=replicate(0.,jpiglo,jpjglo,jpk)
+    fmask_reg_glo(1:jpiglo-2,0:jpjglo-2, *)=fmask_reg
+
+; Data Duplication
+
+; North
+
+    umask_reg_glo(*,jpjglo-1,*)=umask_reg_glo(*,jpjglo-2,*)
+    vmask_reg_glo(*,jpjglo-1,*)=vmask_reg_glo(*,jpjglo-2,*)
+    fmask_reg_glo(*,jpjglo-1,*)=fmask_reg_glo(*,jpjglo-2,*)
+
+;E/W
+
+    umask_reg_glo(0,*,*)=umask_reg_glo(jpiglo-2,*,*)
+    umask_reg_glo(jpiglo-1,*,*)=umask_reg_glo(1,*,*)
+
+    vmask_reg_glo(0,*,*)=vmask_reg_glo(jpiglo-2,*,*)
+    vmask_reg_glo(jpiglo-1,*,*)=vmask_reg_glo(1,*,*)
+
+    fmask_reg_glo(0,*,*)=fmask_reg_glo(jpiglo-2,*,*)
+    fmask_reg_glo(jpiglo-1,*,*)=fmask_reg_glo(1,*,*)
+
+; ***** NAV_LON & NAV_LAT **********
+
+
+; Create Global longitude and latitude
+
+    glamt_reg_glo=replicate(0.,jpiglo,jpjglo)
+
+    glamt_reg_glo(1:jpiglo-2,0:jpjglo-2)=glamt_reg
+
+    gphit_reg_glo=replicate(0.,jpiglo,jpjglo)
+
+    gphit_reg_glo(1:jpiglo-2,0:jpjglo-2)=gphit_reg
+
+    nav_lon_reg_glo=replicate(0.,jpiglo,jpjglo)
+
+    nav_lat_reg_glo=replicate(0.,jpiglo,jpjglo)
+
+    nav_lon_reg_glo=glamt_reg_glo
+
+    nav_lat_reg_glo=gphit_reg_glo
+
+; Data Duplication
+
+; E/W Transition
+
+    nav_lon_reg_glo(0,*)=nav_lon_reg_glo(jpiglo-2,*)
+    nav_lon_reg_glo(jpiglo-1,*)=nav_lon_reg_glo(1,*)
+
+    nav_lat_reg_glo(0,*)=nav_lat_reg_glo(jpiglo-2,*)
+    nav_lat_reg_glo(jpiglo-1,*)=nav_lat_reg_glo(1,*)
+
+; North
+
+    nav_lon_reg_glo(*,jpjglo-1)= nav_lon_reg_glo(*,jpjglo-2)
+    nav_lat_reg_glo(*,jpjglo-1)= nav_lat_reg_glo(*,jpjglo-2)
+
+; ***** GLAMT *****
+; We don't do it to save memory :  same as nav_lon 
+
+; ***** GLAMU *****
+
+    glamu_reg_glo=replicate(0.,jpiglo,jpjglo)
+    glamu_reg_glo(1:jpiglo-2,0:jpjglo-2)=glamu_reg
+
+; North
+
+    glamu_reg_glo(*,jpjglo-1)=glamu_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    glamu_reg_glo(0,*)=glamu_reg_glo(jpiglo-2,*)
+    glamu_reg_glo(jpiglo-1,*)=glamu_reg_glo(1,*)
+    
+; ***** GLAMV *****
+
+    glamv_reg_glo=replicate(0.,jpiglo,jpjglo)
+    glamv_reg_glo(1:jpiglo-2,0:jpjglo-2)=glamv_reg
+
+; North
+
+    glamv_reg_glo(*,jpjglo-1)=glamv_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    glamv_reg_glo(0,*)=glamv_reg_glo(jpiglo-2,*)
+    glamv_reg_glo(jpiglo-1,*)=glamv_reg_glo(1,*)
+
+
+; ***** GLAMF *****
+
+    glamf_reg_glo=replicate(0.,jpiglo,jpjglo)
+    glamf_reg_glo(1:jpiglo-2,0:jpjglo-2)=glamf_reg
+
+; North
+
+    glamf_reg_glo(*,jpjglo-1)=glamf_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    glamf_reg_glo(0,*)=glamf_reg_glo(jpiglo-2,*)
+    glamf_reg_glo(jpiglo-1,*)=glamf_reg_glo(1,*)
+
+
+; ***** GPHIT *****
+; We don't do it to save memory :  same as nav_lat 
+
+; ***** GPHIU *****
+
+    gphiu_reg_glo=replicate(0.,jpiglo,jpjglo)
+    gphiu_reg_glo(1:jpiglo-2,0:jpjglo-2)=gphiu_reg
+
+; North
+
+    gphiu_reg_glo(*,jpjglo-1)=gphiu_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    gphiu_reg_glo(0,*)=gphiu_reg_glo(jpiglo-2,*)
+    gphiu_reg_glo(jpiglo-1,*)=gphiu_reg_glo(1,*)
+    
+; ***** GPHIV *****
+
+    gphiv_reg_glo=replicate(0.,jpiglo,jpjglo)
+    gphiv_reg_glo(1:jpiglo-2,0:jpjglo-2)=gphiv_reg
+
+; North
+
+    gphiv_reg_glo(*,jpjglo-1)=gphiv_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    gphiv_reg_glo(0,*)=gphiv_reg_glo(jpiglo-2,*)
+    gphiv_reg_glo(jpiglo-1,*)=gphiv_reg_glo(1,*)
+
+
+; ***** GPHIF *****
+
+    gphif_reg_glo=replicate(0.,jpiglo,jpjglo)
+    gphif_reg_glo(1:jpiglo-2,0:jpjglo-2)=gphif_reg
+
+; North
+
+    gphif_reg_glo(*,jpjglo-1)=gphif_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    gphif_reg_glo(0,*)=gphif_reg_glo(jpiglo-2,*)
+    gphif_reg_glo(jpiglo-1,*)=gphif_reg_glo(1,*)
+
+; ***** FF *******
+
+    omega = 2.0 * !PI / 86164.0
+    
+    ff_reg_glo = 2.*omega*sin(gphif_reg_glo*!PI/180.) 
+    
+
+; *********** E1T***************
+    
+    e1t_reg_glo=replicate(0.,jpiglo,jpjglo)
+    e1t_reg_glo(1:jpiglo-2,0:jpjglo-2)=e1t_reg
+
+; North
+
+    e1t_reg_glo(*,jpjglo-1)=e1t_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    e1t_reg_glo(0,*)=e1t_reg_glo(jpiglo-2,*)
+    e1t_reg_glo(jpiglo-1,*)=e1t_reg_glo(1,*)
+
+
+
+; *********** E2T***************
+    
+    e2t_reg_glo=replicate(0.,jpiglo,jpjglo)
+    e2t_reg_glo(1:jpiglo-2,0:jpjglo-2)=e2t_reg
+
+; North
+
+    e2t_reg_glo(*,jpjglo-1)=e2t_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    e2t_reg_glo(0,*)=e2t_reg_glo(jpiglo-2,*)
+    e2t_reg_glo(jpiglo-1,*)=e2t_reg_glo(1,*)
+
+; *********** E1U***************
+    
+    e1u_reg_glo=replicate(0.,jpiglo,jpjglo)
+    e1u_reg_glo(1:jpiglo-2,0:jpjglo-2)=e1u_reg
+
+; North
+
+    e1u_reg_glo(*,jpjglo-1)=e1u_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    e1u_reg_glo(0,*)=e1u_reg_glo(jpiglo-2,*)
+    e1u_reg_glo(jpiglo-1,*)=e1u_reg_glo(1,*)
+
+
+; *********** E2U***************
+    
+    e2u_reg_glo=replicate(0.,jpiglo,jpjglo)
+    e2u_reg_glo(1:jpiglo-2,0:jpjglo-2)=e2u_reg
+
+; North
+
+    e2u_reg_glo(*,jpjglo-1)=e2u_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    e2u_reg_glo(0,*)=e2u_reg_glo(jpiglo-2,*)
+    e2u_reg_glo(jpiglo-1,*)=e2u_reg_glo(1,*)
+
+; *********** E1V***************
+    
+    e1v_reg_glo=replicate(0.,jpiglo,jpjglo)
+    e1v_reg_glo(1:jpiglo-2,0:jpjglo-2)=e1v_reg
+
+; North
+
+    e1v_reg_glo(*,jpjglo-1)=e1v_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    e1v_reg_glo(0,*)=e1v_reg_glo(jpiglo-2,*)
+    e1v_reg_glo(jpiglo-1,*)=e1v_reg_glo(1,*)
+
+; *********** E2V***************
+    
+    e2v_reg_glo=replicate(0.,jpiglo,jpjglo)
+    e2v_reg_glo(1:jpiglo-2,0:jpjglo-2)=e2v_reg
+
+; North
+
+    e2v_reg_glo(*,jpjglo-1)=e2v_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    e2v_reg_glo(0,*)=e2v_reg_glo(jpiglo-2,*)
+    e2v_reg_glo(jpiglo-1,*)=e2v_reg_glo(1,*)
+
+; *********** E1F **************
+
+    e1f_reg_glo=replicate(0.,jpiglo,jpjglo)
+    e1f_reg_glo(1:jpiglo-2,0:jpjglo-2)=e1f_reg
+
+; North
+
+    e1f_reg_glo(*,jpjglo-1)=e1f_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    e1f_reg_glo(0,*)=e1f_reg_glo(jpiglo-2,*)
+    e1f_reg_glo(jpiglo-1,*)=e1f_reg_glo(1,*)
+
+; *********** E2F***************
+    
+    e2f_reg_glo=replicate(0.,jpiglo,jpjglo)
+    e2f_reg_glo(1:jpiglo-2,0:jpjglo-2)=e2f_reg
+
+; North
+
+    e2f_reg_glo(*,jpjglo-1)=e2f_reg_glo(*,jpjglo-2)
+    
+; E/W
+ 
+    e2f_reg_glo(0,*)=e2f_reg_glo(jpiglo-2,*)
+    e2f_reg_glo(jpiglo-1,*)=e2f_reg_glo(1,*)
+
+
+
+;****************END OF ATTRIBUTES****************
+
+ 
+;*************************************************
+; 4th STEP : CREATES NCDF MESHMASK FILE
+;*************************************************
+
+; Creates Netcdf File to save this
+
+
+   vargrid = 'T'
+
+; Name
+   idout = NCDF_CREATE(outputgrid,/clobber)
+   print, 'Creation du fichier Netcdf'
+   NCDF_CONTROL, idout, /nofill
+; Dimension
+
+   xidout = NCDF_DIMDEF(idout, 'x', jpiglo)
+   yidout = NCDF_DIMDEF(idout, 'y', jpjglo)
+   didout = NCDF_DIMDEF(idout, 'z', jpk)
+   x_a    = NCDF_DIMDEF(idout, 'x_a',1)
+   y_a    = NCDF_DIMDEF(idout, 'y_a',1)
+   z_a    = NCDF_DIMDEF(idout, 'z_a',1)
+   tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
+
+; Attributes
+     
+   id0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ],/FLOAT )
+   id1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ],/FLOAT )
+   id2  = NCDF_VARDEF(idout, 'nav_lev'     , [                didout        ],/FLOAT )
+   id3  = NCDF_VARDEF(idout, 'time'        , [                        tidout],/FLOAT )
+   id4  = NCDF_VARDEF(idout, 'time_steps'  , [                        tidout],/LONG  )
+   id5  = NCDF_VARDEF(idout, 'glamt'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id6  = NCDF_VARDEF(idout, 'glamu'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id7  = NCDF_VARDEF(idout, 'glamv'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id8  = NCDF_VARDEF(idout, 'glamf'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id9  = NCDF_VARDEF(idout, 'gphit'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id10 = NCDF_VARDEF(idout, 'gphiu'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id11 = NCDF_VARDEF(idout, 'gphiv'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id12 = NCDF_VARDEF(idout, 'gphif'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id13 = NCDF_VARDEF(idout, 'e1t'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id14 = NCDF_VARDEF(idout, 'e1u'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id15 = NCDF_VARDEF(idout, 'e1v'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id16 = NCDF_VARDEF(idout, 'e1f'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id17 = NCDF_VARDEF(idout, 'e2t'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id18 = NCDF_VARDEF(idout, 'e2u'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id19 = NCDF_VARDEF(idout, 'e2v'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id20 = NCDF_VARDEF(idout, 'e2f'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id21 = NCDF_VARDEF(idout, 'tmask'       , [xidout, yidout, didout, tidout],/DOUBLE)
+   id22 = NCDF_VARDEF(idout, 'umask'       , [xidout, yidout, didout, tidout],/DOUBLE)
+   id23 = NCDF_VARDEF(idout, 'vmask'       , [xidout, yidout, didout, tidout],/DOUBLE)
+   id24 = NCDF_VARDEF(idout, 'fmask'       , [xidout, yidout, didout, tidout],/DOUBLE)
+   id25 = NCDF_VARDEF(idout, 'ff'          , [xidout, yidout, z_a   , tidout],/DOUBLE)
+   id26 = NCDF_VARDEF(idout, 'gdept'       , [x_a   , y_a   , didout, tidout],/DOUBLE)
+   id27 = NCDF_VARDEF(idout, 'gdepw'       , [x_a   , y_a   , didout, tidout],/DOUBLE)
+   id28 = NCDF_VARDEF(idout, 'e3t'         , [x_a   , y_a   , didout, tidout],/DOUBLE)
+   id29 = NCDF_VARDEF(idout, 'e3w'         , [x_a   , y_a   , didout, tidout],/DOUBLE)
+
+; Variable 0
+   NCDF_ATTPUT, idout, id0, 'units', 'degrees_east'
+   NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude'
+   NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid'
+; Variable 1
+   NCDF_ATTPUT, idout, id1, 'units', 'degrees_north'
+   NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude'
+   NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid'
+; Variable 2
+   NCDF_ATTPUT, idout, id2, 'units','meters'
+   NCDF_ATTPUT, idout, id2, 'long_name','Depth'
+   NCDF_ATTPUT, idout, id2, 'nav_model','Default grid'
+; Variable 3
+   NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-15 12:00:00 '
+   NCDF_ATTPUT, idout, id3, 'calendar','noleap'
+   NCDF_ATTPUT, idout, id3, 'title', 'Time'
+   NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis'
+   NCDF_ATTPUT, idout, id3, 'time_origin','0000-DEC-15 00:00:00'
+
+  
+   NCDF_CONTROL, idout, /ENDEF
+
+
+
+; Writting
+
+
+   NCDF_VARPUT, idout, id0 , nav_lon_reg_glo
+   NCDF_VARPUT, idout, id1 , nav_lat_reg_glo
+   NCDF_VARPUT, idout, id2 , gdept
+   NCDF_VARPUT, idout, id3 , 1.
+   NCDF_VARPUT, idout, id4 , 1.
+   NCDF_VARPUT, idout, id5 , nav_lon_reg_glo
+
+   NCDF_VARPUT, idout, id6 , glamu_reg_glo
+   NCDF_VARPUT, idout, id7 , glamv_reg_glo
+   NCDF_VARPUT, idout, id8 , glamf_reg_glo
+   NCDF_VARPUT, idout, id9 , nav_lat_reg_glo
+   NCDF_VARPUT, idout, id10, gphiu_reg_glo
+   NCDF_VARPUT, idout, id11, gphiv_reg_glo
+   NCDF_VARPUT, idout, id12, gphif_reg_glo
+   NCDF_VARPUT, idout, id13, e1t_reg_glo
+   NCDF_VARPUT, idout, id14, e1u_reg_glo
+   NCDF_VARPUT, idout, id15, e1v_reg_glo
+   NCDF_VARPUT, idout, id16, e1f_reg_glo
+   NCDF_VARPUT, idout, id17, e2t_reg_glo
+   NCDF_VARPUT, idout, id18, e2u_reg_glo
+   NCDF_VARPUT, idout, id19, e2v_reg_glo
+   NCDF_VARPUT, idout, id20, e2f_reg_glo
+   NCDF_VARPUT, idout, id21, tmask_reg_glo
+   NCDF_VARPUT, idout, id22, umask_reg_glo
+   NCDF_VARPUT, idout, id23, vmask_reg_glo
+   NCDF_VARPUT, idout, id24, fmask_reg_glo
+   NCDF_VARPUT, idout, id25, ff_reg_glo
+
+   dummy=replicate(0.,1,1,jpk,1)
+   dummy(0,0,*,0)=gdept
+
+   NCDF_VARPUT, idout, id26, dummy
+
+    dummy=replicate(0.,1,1,jpk,1)
+    dummy(0,0,*,0)=gdepw
+
+   NCDF_VARPUT, idout, id27, dummy
+
+    dummy=replicate(0.,1,1,jpk,1)
+    dummy(0,0,*,0)=e3t
+
+   NCDF_VARPUT, idout, id28, dummy
+
+    dummy=replicate(0.,1,1,jpk,1)
+    dummy(0,0,*,0)=e3w
+
+   NCDF_VARPUT, idout, id29, dummy
+
+   NCDF_CLOSE, idout
+
+   
+
+end
+
Index: /trunk/INTERP2/make_weight.pro
===================================================================
--- /trunk/INTERP2/make_weight.pro	(revision 2)
+++ /trunk/INTERP2/make_weight.pro	(revision 2)
@@ -0,0 +1,658 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: make_weight.pro
+;
+; PURPOSE: Creates for a given ORCA grid, and its ORCA_GEO equivalent
+;          grid  the required 
+;
+; CATEGORY : Subroutine
+;
+; CALLING SEQUENCE : make_weight
+;
+; INPUTS :
+;         All the variables of a given ORCA meshmask file and its ORCA_GEO equivalent
+; OUTPUTS :
+;         Weights and pointers required to make interpolation between
+;         a field on the ORCA T grid and a field on the ORCA_GEO T grid
+;
+; COMMON BLOCKS:
+;         None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
+;
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+pro make_weight
+
+
+@initorca
+@naminterp2
+@init_path2
+
+
+;*****************************************
+; Error file opening
+;*****************************************
+
+openu, lun_err,errorfile,/get_lun
+
+;************************
+; Compute Geogrid
+;************************
+; Let's get our reference latitude
+
+northernmost=where(gphit EQ max(gphit))
+
+jnorth=northernmost/jpi
+
+inorth=min(northernmost-jnorth*jpi)
+
+ref_latitude=gphit(inorth,*)
+
+; Let's get the reference longitude
+
+equador=where(abs(gphit) EQ  min(abs(gphit)) )
+
+ref_longitude=glamt(equador)
+
+; Now we have the new grid
+
+
+glamt_reg=ref_longitude#replicate(1,n_elements(ref_latitude))
+
+
+gphit_reg=replicate(1,n_elements(ref_longitude))#ref_latitude
+
+; Get the output mask
+
+mask_reg=read_ncdf('tmask',FILENAME=outputgrid,/NOSTRUCT,/cont_nofill)
+
+; Get the latitude and longitude with extra boundary lines
+
+get_fullmesh, glamt_full,gphit_full
+
+sph_coord_full=replicate(9999.,3,jpiglo*jpjglo)
+
+sph_coord_full(0,*)=reform(glamt_full,jpiglo*jpjglo)
+sph_coord_full(1,*)=reform(gphit_full,jpiglo*jpjglo)
+sph_coord_full(2,*)=replicate(1.,jpiglo*jpjglo)
+
+rec_grid_full=cv_coord(/DEGREES,FROM_SPHERE=sph_coord_full,/TO_RECT)
+
+xx_grid_full=rec_grid_full(0,*)
+yy_grid_full=rec_grid_full(1,*)   
+zz_grid_full=rec_grid_full(2,*)
+
+
+sph_coord=replicate(9999.,3,jpi*jpj)
+
+radius=replicate(1.,jpi,jpj)
+radius(0:jpi/2,jpj-1)=1000.
+
+sph_coord(0,*)=reform(glamt,jpi*jpj)
+sph_coord(1,*)=reform(gphit,jpi*jpj)
+sph_coord(2,*)=reform(radius,jpi*jpj)
+
+rec_grid=cv_coord(/DEGREES,FROM_SPHERE=sph_coord,/TO_RECT)
+
+xx_grid=rec_grid(0,*)
+yy_grid=rec_grid(1,*)   
+zz_grid=rec_grid(2,*)
+
+
+
+; Init array to stock pointers
+
+  pointer_Tx=replicate(999,jpi,jpj,4)
+  pointer_Ty=replicate(999,jpi,jpj,4)
+; Init weight matric
+
+  weight_T=double(replicate(0.,jpi,jpj,4))
+
+; Get the latitude to start from
+
+not_found=1
+for jj=0, jpj-1 do begin
+
+   lat_max_ORCA=max( gphit(*,jj)     )
+   lat_max_reg =max( gphit_reg(*,jj) )
+
+
+   if ((lat_max_ORCA NE lat_max_reg) AND (not_found EQ 1)) then begin
+   jpj_start=jj-2
+   not_found=0
+   endif
+
+end
+
+
+    for jj=0,jpj-1 do begin
+  
+    for ji=0,jpi-1 do begin 
+
+
+    if mask_reg(ji,jj) NE 0 then begin
+
+; Coordinates of our point
+
+    xx=glamt_reg(ji,jj)
+    yy=gphit_reg(ji,jj)
+   
+    sph_coord=replicate(1.,3)
+    sph_coord(0)=xx
+    sph_coord(1)=yy
+
+; Convert them into cartesian 
+    
+    rec_coord=cv_coord(/DEGREES,FROM_SPHERE=sph_coord,/TO_RECT)
+
+    xx_bis=replicate(rec_coord(0),jpi*jpj)
+    yy_bis=replicate(rec_coord(1),jpi*jpj)
+    zz_bis=replicate(rec_coord(2),jpi*jpj)
+
+
+    
+
+;****************************************************************
+; Finds in which grid cell point stand   
+;****************************************************************
+    
+    xx_bis=reform(xx_bis,jpi,jpj)
+    yy_bis=reform(yy_bis,jpi,jpj)
+    zz_bis=reform(zz_bis,jpi,jpj)
+
+    xx_grid_full=reform(xx_grid_full,jpiglo,jpjglo)
+    yy_grid_full=reform(yy_grid_full,jpiglo,jpjglo)
+    zz_grid_full=reform(zz_grid_full,jpiglo,jpjglo)
+
+    
+    check_inside,xx_bis ,yy_bis ,zz_bis,$
+                 xx_grid_full(1:jpiglo-2,0:jpjglo-2),yy_grid_full(1:jpiglo-2,0:jpjglo-2),zz_grid_full(1:jpiglo-2,0:jpjglo-2),$
+                 xx_grid_full(2:jpiglo-1,0:jpjglo-2),yy_grid_full(2:jpiglo-1,0:jpjglo-2),zz_grid_full(2:jpiglo-1,0:jpjglo-2),$
+                 xx_grid_full(2:jpiglo-1,1:jpjglo-1),yy_grid_full(2:jpiglo-1,1:jpjglo-1),zz_grid_full(2:jpiglo-1,1:jpjglo-1),$
+                 xx_grid_full(1:jpiglo-2,1:jpjglo-1),yy_grid_full(1:jpiglo-2,1:jpjglo-1),zz_grid_full(1:jpiglo-2,1:jpjglo-1), answer
+
+    
+     
+    if answer(0) EQ -1 then begin
+
+    print, 'ERROR IN MAKE WEIGHT : POSITION NOT LOCATED ON GRID'
+    stop
+
+    endif
+    
+    
+    answer_j=answer/jpi
+    answer_i=answer-answer_j*jpi
+   
+    
+    answer_j=answer_j(where(answer_i EQ min(answer_i)))
+    answer_i=answer_i(where(answer_i EQ min(answer_i)))
+    
+    answer_j=answer_j(0)
+    answer_i=answer_i(0)    
+
+    pointer_Tx(ji,jj,0)=answer_i 
+    pointer_Ty(ji,jj,0)=answer_j
+    point_x1=answer_i
+    point_y1=answer_j
+ 
+    pointer_Tx(ji,jj,1)=answer_i+1
+    pointer_Ty(ji,jj,1)=answer_j
+    point_x2=answer_i+1
+    point_y2=answer_j
+
+    pointer_Tx(ji,jj,2)=answer_i+1
+    pointer_Ty(ji,jj,2)=answer_j+1
+    point_x3=answer_i+1
+    point_y3=answer_j+1
+
+    pointer_Tx(ji,jj,3)=answer_i
+    pointer_Ty(ji,jj,3)=answer_j+1
+    point_x4=answer_i
+    point_y4=answer_j+1
+
+   
+
+; Now we know which 4 points are located nearby our output T point.
+
+; Let's get the coordinates of this points in long and lat
+
+    glamt_ref=replicate(0.,4)
+    gphit_ref=replicate(0.,4)
+  
+  
+   
+    glamt_ref(0)=glamt_full(point_x1+1,point_y1)              
+    gphit_ref(0)=gphit_full(point_x1+1,point_y1)
+
+    glamt_ref(1)=glamt_full(point_x2+1,point_y2)              
+    gphit_ref(1)=gphit_full(point_x2+1,point_y2)
+    
+    glamt_ref(2)=glamt_full(point_x3+1,point_y3)              
+    gphit_ref(2)=gphit_full(point_x3+1,point_y3)
+
+    
+    glamt_ref(3)=glamt_full(point_x4+1,point_y4)              
+    gphit_ref(3)=gphit_full(point_x4+1,point_y4)
+  
+    
+
+; Let's make things simple for coordinates
+  
+   sph_coord_ref=replicate(0.,3,5)
+
+   sph_coord_ref(0,0)=glamt_reg(ji,jj)
+   sph_coord_ref(1,0)=gphit_reg(ji,jj)
+   sph_coord_ref(2,0)=1.
+
+   sph_coord_ref(0,1:4)=glamt_ref
+   sph_coord_ref(1,1:4)=gphit_ref
+   sph_coord_ref(2,1:4)=1.
+
+   rec_coord_ref=cv_coord(/DEGREES,FROM_SPHERE=sph_coord_ref,/TO_RECT)
+  
+   xx=rec_coord_ref(0,0)
+   yy=rec_coord_ref(1,0)
+   zz=rec_coord_ref(2,0)
+
+   x1=rec_coord_ref(0,1)
+   y1=rec_coord_ref(1,1)
+   z1=rec_coord_ref(2,1)
+ 
+   x2=rec_coord_ref(0,2)
+   y2=rec_coord_ref(1,2)
+   z2=rec_coord_ref(2,2)
+
+   x3=rec_coord_ref(0,3)
+   y3=rec_coord_ref(1,3)
+   z3=rec_coord_ref(2,3)
+
+   x4=rec_coord_ref(0,4)
+   y4=rec_coord_ref(1,4)
+   z4=rec_coord_ref(2,4)
+
+   xG=total(rec_coord_ref(0,1:4))/4.
+   yG=total(rec_coord_ref(1,1:4))/4.
+   zG=total(rec_coord_ref(2,1:4))/4.
+   
+   rec_coord_ref(0,*)=rec_coord_ref(0,*)-xG
+   rec_coord_ref(1,*)=rec_coord_ref(1,*)-yG
+   rec_coord_ref(2,*)=rec_coord_ref(2,*)-zG
+
+   XT=rec_coord_ref(*,1:4)
+ 
+   XM=MATRIX_MULTIPLY(XT,XT,/BTRANSPOSE)
+   EVAL=HQR(ELMHES(XM),/DOUBLE)
+   EVEC=EIGENVEC(XM,EVAL)
+
+   EVAL=FLOAT(EVAL)
+   EVEC=FLOAT(EVEC)
+   ORDER=SORT(EVAL)  
+   
+
+   xx=total(rec_coord_ref(*,0)*EVEC(*,ORDER(1)))
+   yy=total(rec_coord_ref(*,0)*EVEC(*,ORDER(2)))
+
+   x1=total(rec_coord_ref(*,1)*EVEC(*,ORDER(1)))
+   y1=total(rec_coord_ref(*,1)*EVEC(*,ORDER(2)))
+
+   x2=total(rec_coord_ref(*,2)*EVEC(*,ORDER(1)))
+   y2=total(rec_coord_ref(*,2)*EVEC(*,ORDER(2)))
+
+   x3=total(rec_coord_ref(*,3)*EVEC(*,ORDER(1)))
+   y3=total(rec_coord_ref(*,3)*EVEC(*,ORDER(2)))
+
+   x4=total(rec_coord_ref(*,4)*EVEC(*,ORDER(1)))
+   y4=total(rec_coord_ref(*,4)*EVEC(*,ORDER(2)))
+   
+
+;**************************************************
+; Computes i coordinate of point in the grid cell *
+;**************************************************
+
+; Calculate coordinates of j vector
+
+; Vector j0 is vector AD/(AD)
+
+xj0=x4-x1
+
+yj0=y4-y1
+
+; Normalised vector
+
+norm_j0=sqrt(xj0*xj0+yj0*yj0)
+
+xj0=xj0/norm_j0
+
+yj0=yj0/norm_j0
+
+
+; Vector j1 is vector BC/(BC)
+
+xj1=x3-x2
+
+yj1=y3-y2
+
+; Normalised vector
+
+norm_j1=sqrt(xj1*xj1+yj1*yj1)
+
+xj1=xj1/norm_j1
+
+yj1=yj1/norm_j1
+
+; Caculate coefficient for solving 2nd degree equation in i
+
+a_coeff= (x2-x1)*(yj0-yj1)-(y2-y1)*(xj0-xj1)
+
+b_coeff= -(x2-x1)*yj0-(xx-x1)*(yj0-yj1)+(yy-y1)*(xj0-xj1)+(y2-y1)*xj0
+   
+c_coeff= (xx-x1)*yj0-(yy-y1)*xj0
+
+
+delta=max([b_coeff*b_coeff-4*a_coeff*c_coeff,0])
+
+
+
+iP=999.
+
+if abs(a_coeff) GT 1.E-5 then begin
+
+sol1=(-b_coeff+sqrt(delta))/(2.*a_coeff)
+
+sol2=(-b_coeff-sqrt(delta))/(2.*a_coeff)
+
+dist_sol1=sol1*sol1+(sol1-1)*(sol1-1)
+dist_sol2=sol2*sol2+(sol2-1)*(sol2-1)
+
+iP=sol1
+
+if dist_sol1 LT dist_sol2 then iP=sol1
+if dist_sol2 LT dist_sol1 then iP=sol2
+
+
+endif else begin
+
+iP=-c_coeff/b_coeff
+
+endelse
+
+
+
+
+;**************************************************
+; Computes j coordinate of point in the grid cell *
+;**************************************************
+
+; Calculate coordinates of i vector
+
+; Vector i0 is vector AB/(AB)
+
+xi0=x2-x1
+
+yi0=y2-y1
+
+; Normalised vector
+
+norm_i0=sqrt(xi0*xi0+yi0*yi0)
+if norm_i0 LT 0. then stio
+xi0=xi0/norm_i0
+
+yi0=yi0/norm_i0
+
+
+; Vector i1 is vector DC/(DC)
+
+xi1=x3-x4
+
+yi1=y3-y4
+
+; Normalised vector
+
+norm_i1=sqrt(xi1*xi1+yi1*yi1)
+if norm_i1 LT 0. then stop
+xi1=xi1/norm_i1
+
+yi1=yi1/norm_i1
+
+; Caculate coefficient for solving 2nd degree equation in j
+
+a_coeff= (x4-x1)*(yi0-yi1)-(y4-y1)*(xi0-xi1)
+
+b_coeff= -(x4-x1)*yi0-(xx-x1)*(yi0-yi1)+(yy-y1)*(xi0-xi1)+(y4-y1)*xi0
+   
+c_coeff= (xx-x1)*yi0-(yy-y1)*xi0
+
+
+delta=max([b_coeff*b_coeff-4*a_coeff*c_coeff,0])
+
+
+jP=999.
+
+if abs(a_coeff) GT 1.E-5  then begin
+
+sol1=(-b_coeff+sqrt(delta))/(2.*a_coeff)
+
+sol2=(-b_coeff-sqrt(delta))/(2.*a_coeff)
+
+dist_sol1=sol1*sol1+(sol1-1)*(sol1-1)
+dist_sol2=sol2*sol2+(sol2-1)*(sol2-1)
+
+jP=sol1
+
+if dist_sol1 LT dist_sol2 then jP=sol1
+if dist_sol2 LT dist_sol1 then jP=sol2
+
+
+endif else begin
+
+jP=-c_coeff/b_coeff
+
+endelse
+   
+   
+   weight_T(ji,jj,0) = (1.-iP)*(1.-jP)
+
+   weight_T(ji,jj,1) = iP*(1.-jP)
+
+   weight_T(ji,jj,2) = iP*jP
+
+   weight_T(ji,jj,3) = (1.-iP)*jP
+
+   
+   if min(weight_T(ji,jj,*)) LT 0 OR max(weight_T(ji,jj,*)) GT 1 then begin
+
+      printf, lun_err,'JI=',ji,' JJ=',jj
+      printf, lun_err,'IP=',iP,' JP=',jP
+
+     
+      printf, lun_err,'XP=',xx,' YP=',yy
+      printf, lun_err,'XA=',x1,' YA=',y1
+      printf, lun_err,'XB=',x2,' YB=',y2
+      printf, lun_err,'XC=',x3,' YC=',y3
+      printf, lun_err,'XD=',x4,' YD=',y4
+      
+   endif
+  
+
+   endif
+
+  
+  end
+
+end
+
+close, lun_err
+free_lun,lun_err
+
+; Convert to full format
+
+
+  weight_full=replicate(0.,jpiglo,jpjglo,4)
+  pointer_i_full=replicate(0,jpiglo,jpjglo,4)
+  pointer_j_full=replicate(0,jpiglo,jpjglo,4)
+
+  weight_full(1:jpiglo-2,0:jpjglo-2,*)=weight_T
+  pointer_i_full(1:jpiglo-2,0:jpjglo-2,*)=pointer_Tx
+  pointer_j_full(1:jpiglo-2,0:jpjglo-2,*)=pointer_Ty
+
+
+
+
+; Let's save Weight functions and the pointer arrays
+
+
+; Creates Netcdf File to save this
+
+
+   vargrid = 'T'
+
+; Name
+   idout = NCDF_CREATE(weightfile,/clobber)
+  
+   NCDF_CONTROL, idout, /nofill
+; Dimension
+   xidout = NCDF_DIMDEF(idout, 'x', jpiglo)
+   yidout = NCDF_DIMDEF(idout, 'y', jpjglo)
+   didout = NCDF_DIMDEF(idout, 'deptht', 1)
+   tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
+
+
+
+; Attributes   
+   id_0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ], /FLOAT)
+   id_1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ], /FLOAT)
+   id_2  = NCDF_VARDEF(idout, 'deptht'      , [                didout        ], /FLOAT)
+   id_3  = NCDF_VARDEF(idout, 'time_counter', [                        tidout], /FLOAT)
+  
+   id0   = NCDF_VARDEF(idout, 'weight_1'      , [xidout, yidout,didout,tidout ], /FLOAT)
+   id1   = NCDF_VARDEF(idout, 'weight_2'      , [xidout, yidout,didout,tidout  ], /FLOAT)
+   id2   = NCDF_VARDEF(idout, 'weight_3'      , [xidout, yidout,didout,tidout  ], /FLOAT)
+   id3   = NCDF_VARDEF(idout, 'weight_4'      , [xidout, yidout,didout,tidout  ], /FLOAT)
+   id4   = NCDF_VARDEF(idout, 'pointer_1_i'     , [xidout, yidout ,didout,tidout ], /LONG)
+   id5   = NCDF_VARDEF(idout, 'pointer_2_i'     , [xidout, yidout ,didout,tidout ], /LONG)
+   id6   = NCDF_VARDEF(idout, 'pointer_3_i'     , [xidout, yidout,didout,tidout  ], /LONG)
+   id7   = NCDF_VARDEF(idout, 'pointer_4_i'     , [xidout, yidout,didout,tidout  ], /LONG)
+   id8   = NCDF_VARDEF(idout, 'pointer_1_j'     , [xidout, yidout,didout,tidout  ], /LONG)
+   id9   = NCDF_VARDEF(idout, 'pointer_2_j'     , [xidout, yidout,didout,tidout  ], /LONG)
+   id10  = NCDF_VARDEF(idout, 'pointer_3_j'     , [xidout, yidout,didout,tidout  ], /LONG)
+   id11  = NCDF_VARDEF(idout, 'pointer_4_j'     , [xidout, yidout,didout,tidout  ], /LONG)
+
+; Variable 0
+   NCDF_ATTPUT, idout, id_0, 'units', 'degrees_east'
+   NCDF_ATTPUT, idout, id_0, 'long_name', 'Longitude'
+   NCDF_ATTPUT, idout, id_0, 'nav_model', 'Default grid'
+; Variable 1
+   NCDF_ATTPUT, idout, id_1, 'units', 'degrees_north'
+   NCDF_ATTPUT, idout, id_1, 'long_name', 'Latitude'
+   NCDF_ATTPUT, idout, id_1, 'nav_model', 'Default grid'
+; Variable 2
+   NCDF_ATTPUT, idout, id_2, 'units','meters'
+   NCDF_ATTPUT, idout, id_2, 'long_name','Depth'
+   NCDF_ATTPUT, idout, id_2, 'nav_model','Default grid'
+; Variable3
+   NCDF_ATTPUT, idout, id_3, 'units', 'seconds since 0001-01-15 12:00:00 '
+   NCDF_ATTPUT, idout, id_3, 'calendar','noleap'
+   NCDF_ATTPUT, idout, id_3, 'title', 'Time'
+   NCDF_ATTPUT, idout, id_3, 'long_name', 'Time axis'
+   NCDF_ATTPUT, idout, id_3, 'time_origin','0000-DEC-15 00:00:00'
+
+
+; Variable 0
+   NCDF_ATTPUT, idout, id0, 'units','no unit'
+   NCDF_ATTPUT, idout, id0, 'long_name','W1'
+ 
+; Variable 1
+   NCDF_ATTPUT, idout, id1, 'units','no unit'
+   NCDF_ATTPUT, idout, id1, 'long_name','W2'
+; Variable 0
+   NCDF_ATTPUT, idout, id2, 'units','no unit'
+   NCDF_ATTPUT, idout, id2, 'long_name','W3'
+
+; Variable 0
+   NCDF_ATTPUT, idout, id3, 'units','no unit'
+   NCDF_ATTPUT, idout, id3, 'long_name','W4'
+
+; Variable 0
+   NCDF_ATTPUT, idout, id4, 'units','no unit'
+   NCDF_ATTPUT, idout, id4, 'long_name','i1'
+ 
+; Variable 1
+   NCDF_ATTPUT, idout, id5, 'units','no unit'
+   NCDF_ATTPUT, idout, id5, 'long_name','i2'
+; Variable 0
+   NCDF_ATTPUT, idout, id6, 'units','no unit'
+   NCDF_ATTPUT, idout, id6, 'long_name','i3'
+
+; Variable 0
+   NCDF_ATTPUT, idout, id7, 'units','no unit'
+   NCDF_ATTPUT, idout, id7, 'long_name','i4'
+
+
+; Variable 0
+   NCDF_ATTPUT, idout, id8, 'units','no unit'
+   NCDF_ATTPUT, idout, id8, 'long_name','j1'
+ 
+; Variable 1
+   NCDF_ATTPUT, idout, id9, 'units','no unit'
+   NCDF_ATTPUT, idout, id9, 'long_name','j2'
+; Variable 0
+   NCDF_ATTPUT, idout, id10, 'units','no unit'
+   NCDF_ATTPUT, idout, id10, 'long_name','j3'
+
+; Variable 0
+   NCDF_ATTPUT, idout, id11, 'units','no unit'
+   NCDF_ATTPUT, idout, id11, 'long_name','j4'
+
+
+
+
+
+
+
+   NCDF_CONTROL, idout, /ENDEF
+
+; Writting
+
+   NCDF_VARPUT, idout, id_0, glamt
+
+   NCDF_VARPUT, idout, id_1, gphit
+
+   prof=5.
+   NCDF_VARPUT, idout, id_2, prof
+   temps=lonarr(12)
+   for i=0,0 do temps[i] = 86400l*(julday(1+i,15,1)-julday(1,15,1))
+   NCDF_VARPUT, idout, id_3, temps(0)
+
+ 
+   NCDF_VARPUT, idout, id0,weight_full(*,*,0)
+   NCDF_VARPUT, idout, id1,weight_full(*,*,1)
+   NCDF_VARPUT, idout, id2,weight_full(*,*,2)
+   NCDF_VARPUT, idout, id3,weight_full(*,*,3)
+   NCDF_VARPUT, idout, id4,pointer_i_full(*,*,0)
+   NCDF_VARPUT, idout, id5,pointer_i_full(*,*,1)
+   NCDF_VARPUT, idout, id6,pointer_i_full(*,*,2)
+   NCDF_VARPUT, idout, id7,pointer_i_full(*,*,3)
+   NCDF_VARPUT, idout, id8,pointer_j_full(*,*,0)
+   NCDF_VARPUT, idout, id9,pointer_j_full(*,*,1)
+   NCDF_VARPUT, idout, id10,pointer_j_full(*,*,2)
+   NCDF_VARPUT, idout, id11,pointer_j_full(*,*,3)
+  
+
+
+   NCDF_CLOSE, idout
+
+
+
+end
Index: /trunk/INTERP2/naminterp2.pro
===================================================================
--- /trunk/INTERP2/naminterp2.pro	(revision 2)
+++ /trunk/INTERP2/naminterp2.pro	(revision 2)
@@ -0,0 +1,102 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: naminterp2.pro
+;
+; PURPOSE: Namelist required for INTERP2
+;
+; CATEGORY : Namelist
+;
+; CALLING SEQUENCE : @naminterp2
+;
+; COMMON BLOCKS:
+;         None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
+;                       03/2003 Robinson Hordoir & Christian Ethe 
+;
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;---------------------------------------------------
+; INTERP2 : NAMELIST                    
+;---------------------------------------------------
+
+
+;***************************************
+; Information about fields and grid
+;***************************************
+
+; From which ORCA grid
+; Please give geographical accuracy of your input grid 
+; (ex. for ORCA2, grid_def=2.)
+
+grid_def=2.
+
+; Name of the field for which interpolation is required
+
+name_input_field='Sigma'
+
+; Name of the time variable in the data file
+
+data_time_variable='time_counter'
+
+; Is the geogrid meshmask file already calculated ?
+; Yes = 1
+; No  = 0
+
+geogrid_mesh=1
+
+; On which point of the grid do you wish to interpolate ?
+; Please answer grid_point='T' for T point
+;               grid_point='U' for U point etc...
+
+grid_point='T'
+
+; Is the weight file for the point defined above already calculated ?
+; Yes = 1
+; No  = 0
+
+weight_file=1
+
+;****************************************
+; Information about fields dimension
+;****************************************
+
+; Number of levels 
+
+nlevel=1
+
+; Number of time steps
+
+ntimesteps=73
+
+;****************************************
+; Information about data in file
+;****************************************
+
+nlower_limit = 0
+nupper_limit = 0
+
+IF keyword_set(nlower_limit) THEN min_value = 0.
+IF keyword_set(nupper_limit) THEN max_value = 273.15
+
+; Is extrapolation on masked values required ?
+; Yes, do_rempl =1
+; No,  do_rempl = 0
+
+do_rempl = 0
+
+; If extrapolation is required, how many interations shall be done ?
+
+niterations = 10
+
+;*********************************************************
+
Index: /trunk/INTERP2/newinterp.pro
===================================================================
--- /trunk/INTERP2/newinterp.pro	(revision 2)
+++ /trunk/INTERP2/newinterp.pro	(revision 2)
@@ -0,0 +1,235 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: newinterp.pro
+;
+; PURPOSE: Uses weights to compute interpolated field
+;
+; CATEGORY : Subroutine
+;
+; CALLING SEQUENCE : newinterp
+;
+; INPUTS :
+;         ORCA_GEO grid file + ORCA_GEO weight file + Input field 
+;         on ORCA grid
+; OUTPUTS :
+;         Output field on ORCA_GEO grid
+;
+; COMMON BLOCKS:
+;         None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
+;                       03/2003 Robinson Hordoir & Christian Ethe :
+;                       Added duplication stripes + extrapolation on
+;                       land points
+;
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+
+
+pro newinterp
+
+
+@initorca_reg
+@naminterp2
+@init_path2
+
+
+; Get the output mask
+
+mask_reg=read_ncdf('tmask',FILENAME=outputgrid,/NOSTRUCT,/cont_nofill)
+
+
+; Get the Pointers and weights...
+
+weight=replicate(0.,jpi,jpj,4)
+pointer_i=replicate(999,jpi,jpj,4)
+pointer_j=replicate(999,jpi,jpj,4)
+
+weight(*,*,0)=read_ncdf('weight_1', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+weight(*,*,1)=read_ncdf('weight_2', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+weight(*,*,2)=read_ncdf('weight_3', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+weight(*,*,3)=read_ncdf('weight_4', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+
+
+pointer_i(*,*,0)=read_ncdf('pointer_1_i', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+pointer_i(*,*,1)=read_ncdf('pointer_2_i', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+pointer_i(*,*,2)=read_ncdf('pointer_3_i', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+pointer_i(*,*,3)=read_ncdf('pointer_4_i', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+
+
+pointer_j(*,*,0)=read_ncdf('pointer_1_j', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+pointer_j(*,*,1)=read_ncdf('pointer_2_j', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+pointer_j(*,*,2)=read_ncdf('pointer_3_j', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+pointer_j(*,*,3)=read_ncdf('pointer_4_j', FILENAME=weightfile,/NOSTRUCT,/cont_nofill)
+
+; Get the field to be interpolated on reg geogrid
+
+input_field=ncdf_lec(datafile,var=name_input_field)
+
+; ici mettre : continent=where(input_field GT 1.E13)
+;              input_field(continent)=0.
+
+input_mask =ncdf_lec(inputmesh,var='tmask')
+
+zmask=input_mask
+
+
+IF keyword_set(do_rempl) then begin
+
+; Extrapolate the input field on masked values
+for jt=0,ntimesteps-1 do begin
+   for jk=0, nlevel-1 do begin
+
+    not_extrap=input_field(*,*,jk,jt)
+
+    if (max(input_mask(*,*,jk)) GT 0 ) then input_field(*,*,jk,jt)=remplit(not_extrap,NITE=niterations,BASIQUE=input_mask(*,*,jk))
+
+   endfor
+endfor
+endif
+
+
+; Get the output field
+
+output_field=replicate(0.,jpi,jpj,nlevel,ntimesteps)
+
+
+for ji=0,jpi-1 do begin
+
+   for jj=0,jpj-1 do begin
+   
+   
+   if mask_reg(ji,jj,0) NE 0 then begin
+
+   output_field(ji,jj,*,*)=                  $
+                  weight(ji,jj,0)*input_field(pointer_i(ji,jj,0)+1,pointer_j(ji,jj,0),*,*) $
+                + weight(ji,jj,1)*input_field(pointer_i(ji,jj,1)+1,pointer_j(ji,jj,1),*,*) $
+                + weight(ji,jj,2)*input_field(pointer_i(ji,jj,2)+1,pointer_j(ji,jj,2),*,*) $
+                + weight(ji,jj,3)*input_field(pointer_i(ji,jj,3)+1,pointer_j(ji,jj,3),*,*)
+   
+   endif
+
+   endfor
+
+endfor
+
+; Initialisation of array for the northern boundary condition
+jplus = 1
+zdata_north = replicate(0.,jpi,jpj+jplus,nlevel,ntimesteps)
+zdata_north(*,0:jpj-1,*,*) = output_field
+zdata_inv = replicate(0.,jpi,jpj+jplus,nlevel,ntimesteps)
+; Data of the input grid is duplicated for the northern boundary condition
+
+zdata_inv(0:jpi/2 -1 ,*,*,*) = zdata_north(jpi/2:jpi-1,*,*,*) 
+zdata_inv(jpi/2:jpi-1 ,*,*,*) = zdata_north(0:jpi/2-1,*,*,*) 
+zdata_inv = reverse(zdata_inv,2)
+zdata_north(*,jpj:jpj+jplus-1,*,*) = zdata_inv(*,jpj:jpj+jplus-1,*,*)
+
+; Data of the input grid is duplicated for the West/east boundary condition
+final_output=replicate(0.,jpiglo,jpjglo,nlevel,ntimesteps)
+final_output(1:jpiglo-2,0:jpjglo-1,*,*) = zdata_north
+
+final_output(0,*,*,*) = final_output(jpiglo-2,*,*,*)
+final_output(jpiglo-1,*,*,*) = final_output(1,*,*,*)
+
+
+IF keyword_set(nlower_limit) THEN BEGIN
+    tab_min = WHERE( final_output LT min_value )
+    IF tab_min(0) NE -1 THEN final_output(tab_min) = min_value
+ENDIF
+
+IF keyword_set(nupper_limit) THEN BEGIN
+    tab_max = WHERE( final_output GT max_value )
+    IF tab_max(0) NE -1 THEN final_output(tab_max) = max_value
+ENDIF
+
+final_time=ncdf_lec(datafile,var=data_time_variable)
+
+nav_lon=ncdf_lec(outputgrid,var='nav_lon')
+nav_lat=ncdf_lec(outputgrid,var='nav_lat')
+nav_lev=ncdf_lec(outputgrid,var='nav_lev')
+
+vargrid = 'T'
+
+
+; Name
+   idout = NCDF_CREATE(outputfile,/clobber)
+   print, 'Creation du fichier Netcdf'
+   NCDF_CONTROL, idout, /nofill
+; Dimension
+
+   xidout = NCDF_DIMDEF(idout, 'x', jpiglo)
+   yidout = NCDF_DIMDEF(idout, 'y', jpjglo)
+   didout = NCDF_DIMDEF(idout, 'z', nlevel)
+   x_a    = NCDF_DIMDEF(idout, 'x_a',1)
+   y_a    = NCDF_DIMDEF(idout, 'y_a',1)
+   z_a    = NCDF_DIMDEF(idout, 'z_a',1)
+   tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
+
+; Attributes
+     
+   id0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ],/FLOAT )
+   id1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ],/FLOAT )
+   id2  = NCDF_VARDEF(idout, 'nav_lev'     , [                didout        ],/FLOAT )
+   id3  = NCDF_VARDEF(idout, 'time_counter'        , [                        tidout],/FLOAT )
+   id4  = NCDF_VARDEF(idout, 'time_steps'  , [                        tidout],/LONG  )
+   id5  = NCDF_VARDEF(idout,name_input_field,[xidout, yidout,didout,  tidout],/DOUBLE)
+
+
+; Variable 0
+   NCDF_ATTPUT, idout, id0, 'units', 'degrees_east'
+   NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude'
+   NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid'
+; Variable 1
+   NCDF_ATTPUT, idout, id1, 'units', 'degrees_north'
+   NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude'
+   NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid'
+; Variable 2
+   NCDF_ATTPUT, idout, id2, 'units','meters'
+   NCDF_ATTPUT, idout, id2, 'long_name','Depth'
+   NCDF_ATTPUT, idout, id2, 'nav_model','Default grid'
+; Variable 3
+   NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-15 12:00:00 '
+   NCDF_ATTPUT, idout, id3, 'calendar','noleap'
+   NCDF_ATTPUT, idout, id3, 'title', 'Time'
+   NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis'
+   NCDF_ATTPUT, idout, id3, 'time_origin','0000-DEC-15 00:00:00'
+
+
+  
+   NCDF_CONTROL, idout, /ENDEF
+
+; Writting
+
+   NCDF_VARPUT, idout, id0 , nav_lon
+   NCDF_VARPUT, idout, id1 , nav_lat
+   NCDF_VARPUT, idout, id2 , nav_lev(0:nlevel-1)
+   NCDF_VARPUT, idout, id3 , final_time
+   NCDF_VARPUT, idout, id4 , ntimesteps
+   NCDF_VARPUT, idout, id5 , final_output
+
+
+   NCDF_CLOSE, idout
+
+  
+   
+
+end
+
+
+
+
+
+
+
+
Index: /trunk/README
===================================================================
--- /trunk/README	(revision 2)
+++ /trunk/README	(revision 2)
@@ -0,0 +1,112 @@
+ETAPE 0 (rien a changer ici)
+=======
+1) lire B (champ magnetique), et les conductances: cond_sed, cond_oc, cond_tot, dans le  fichier condmag.nc- ce fichier a ete genere sous matlab M_lib4/geomag/MOED2D/ORCA_writenetcdf.m
+OK
+
+=======================================================================
+ETAPE 1 (a refaire pour toute nouvelle grille modele)
+========
+Cette etape consiste a interpoler sur la  grille ORCA2 (aux  points T)
+les champs B, SIGMAsed, qui ont ete crees dans un meme fichier netcdf
+lors de l'etape 0  (fichier condmag.nc).
+Pour ce faire, on suit pas a pas la doc de la routine SAXO 
+Voir toute la DOC de cette etape dans:
+http://www.lodyc.jussieu.fr/opa/INTERP/index.html
+
+On lance le programme comme ceci (cf la doc)
+idl
+@init_interp
+interpolation
+
+On va realiser 2 runs successifs de la routine d'interpolation: un
+passage pour le champ magnetique B (un fichier Br_ORCA2.nc est genere)
+et un deuxieme run  pour le champ de conductance (un  fichier
+cond_sed_ORCA2.nc est cree)
+
+Il faut donc faire quelque changements de configuration dans le
+fichiers suivant:
+>> editer interp.pro=> changer le nom de la variable du  fichier condmag.nc a interpoler (fich cree sous matlab), L91:
+   zdata=ncdf_lec('/usr/work/sur/fvi/OPA/geomag/condmag.nc',var='Br')
+>>editer naminterp.pro
+L67: ;   data_name = 'cond_sed'
+
+>>init_path.pro
+L44   outputfile = 'cond_sed_ORCA2.nc'
+
+Le meshmask est different pour chaque grille model, penser a pointer
+vers le bon fichier (idem pour l'etape 3 plus bas)
+
+==========================================================================
+ETAPE 2: (a refaire pour toute nouvelle grille modele)
+========
+C'est l'etape de calcul des forcages geomagnetiques a partir des
+sorties ORCA et des fichiers Br et conductance. Le calcul est fait sur
+la grille modele pour que le calcul de divergence soit aussi precis
+que possible. Ce point est vraiment critique.
+
+Techniquement, tout se passe dans le fichier  forcagequimarche.pro
+On lance  idl puis:
+
+@init2
+.r forcagequimarche.pro
+forcagequimarche,'1993','01'
+
+et idem pour les autres annees: forcagequimarche,'1994','01'
+
+
+Pour info, voila ce que fait le programme:
+-----------------------------------------
+1-  calcul d'une matrice 3D de conductivite sigma=f(T,S) en fonction
+de T,S de ORCA2, sur la grille T.  Formule assez  empirique, en
+siemens/m que j'ai pondu apres regression: 
+sigma(T,S)=0.02047780622061 + 0.00273147624197*T + 0.00035133182334*T^2 + 0.09139808809909*S + 0.00241425798890*S*T -0.00023998958774*S^2
+
+2- Calcul du champ 2D de conductance de l'ocean par integration verticale 
+        /
+SIGMAoc=| sigma dz
+        /
+
+3- definir SIGMA=SIGMAsed+SIGMAoc
+
+
+4-  calculer 
+           /
+Bustar= B* | sigma * u /SIGMA dz
+           /
+           /
+Bvstar= B* | sigma * v /SIGMA dz
+           /
+
+5- calculer div(Bustar,Bvstar)  ---> utilise les  routines SAXO
+(tres legerement modifiees ici pour certaines d'entre elles (divfred,
+gradfred)
+
+
+
+========================================================================
+ETAPE 3 (a refaire pour chaque nouvelle grille)
+========
+On fait une Reverse  interpolation de la grille modele vers la grille
+geographique des fichiers crees a l'etape precedente (Divergence,
+Sigma, annee par annee)
+Pour cette etape, suivre pas a pas l'aide en ligne  sur:
+http://www.lodyc.jussieu.fr/opa/REVTERP/
+
+Il faut penser a:
+1- editer /usr/work/sur/fvi/OPA/geomag/INTERP2/naminterp2.pro
+et verifier le nom de la variable que l'on veut interpoler: p. ex
+name_input_field='Sigma'
+2- editer  /usr/work/sur/fvi/OPA/geomag/INTERP2/init_path2.pro  
+changer les  datafile (sortie de l'etape 2), outputfile et le cas
+echeant   input_dir, output_dir inputmesh weightfile
+
+Pour lancer, aller dans le repertoire INTERP2:
+cd /usr/work/sur/fvi/OPA/geomag/INTERP2
+
+Puis:
+> idl
+> @init
+> interp2
+ 
+
+
Index: /trunk/angle.pro
===================================================================
--- /trunk/angle.pro	(revision 2)
+++ /trunk/angle.pro	(revision 2)
@@ -0,0 +1,93 @@
+PRO angle, glamu, gphiu, glamv, gphiv, glamf, gphif, gsinu, gsinv, gcosu, gcosv
+;;;---------------------------------------------------------------------
+;;;
+;;;                       ROUTINE angle
+;;;                     *******************
+;;;
+;;;  Purpose :
+;;;  --------
+;;;     Compute angles between grid lines and direction of the North
+;;;
+;;   Method :
+;;   -------
+;;
+;;   Input :
+;;   ------
+;;      common
+;;            /comcoh/ glamf,   : longitudes and latitudes at F-points
+;;                     gphif   
+;;
+;;   Output :
+;;   -------
+;;      common
+;;            /comcoh/ gsinu,gcosu : sinus and cosinus of the angle 
+;;                     gsinv,gcosv   between north-south direction 
+;;				     and the j-direction of the mesh
+;;
+;;   Modifications:
+;;   --------------
+;;       Original :  96-07 (O. Marti)
+;;                   98-06 (G. Madec)
+;;                   99-11 (A. Jouzeau) : Adaptation to IDL
+;;----------------------------------------------------------------------
+;;----------------------------------------------------------------------
+;
+;;;---------------------------------------------------------------------
+;;;  OPA8, LODYC (1997)
+;;;---------------------------------------------------------------------
+;
+;
+; I. Compute the cosinus and sinus
+; ================================
+;     
+;     ... north pole direction & modulous (at u-point)
+      zxnpu = 0. - fsxspp( glamu, gphiu )
+      zynpu = 0. - fsyspp( glamu, gphiu )
+      znnpu = zxnpu*zxnpu + zynpu*zynpu
+;     
+;     ... north pole direction & modulous (at v-point)
+      zxnpv = 0. - fsxspp( glamv, gphiv )
+      zynpv = 0. - fsyspp( glamv, gphiv )
+      znnpv = zxnpv*zxnpv + zynpv*zynpv
+;     
+;     ... j-direction: f-point segment direction (u-point)
+      zxffu=  fsxspp( glamf, gphif ) - fsxspp( shift(glamf, 0, 1), shift(gphif, 0, 1) )
+      zyffu=  fsyspp( glamf, gphif ) - fsyspp( shift(glamf, 0, 1), shift(gphif, 0, 1) )
+      zmnpfu= sqrt ( znnpu * ( zxffu*zxffu + zyffu*zyffu )  )
+
+     
+;     
+;     ... i-direction: f-point segment direction (v-point)
+      zxffv=  fsxspp( glamf, gphif ) - fsxspp( shift(glamf, 1, 0), shift(gphif, 1, 0) )
+      zyffv=  fsyspp( glamf, gphif ) - fsyspp( shift(glamf, 1, 0), shift(gphif, 1, 0) )
+      zmnpfv= sqrt ( znnpv * ( zxffv*zxffv + zyffv*zyffv )  )
+     
+;     
+;     ... cosinus and sinus using scalar and vectorial products
+      gsinu = ( zxnpu*zyffu - zynpu*zxffu ) / zmnpfu
+      gcosu = ( zxnpu*zxffu + zynpu*zyffu ) / zmnpfu
+
+
+;     
+;     ... cosinus and sinus using scalar and vectorial products
+;     (caution, rotation of 90 degres)
+      gsinv = ( zxnpv*zxffv + zynpv*zyffv ) / zmnpfv
+      gcosv =-( zxnpv*zyffv - zynpv*zxffv ) / zmnpfv
+
+     
+;     
+;     
+;     II. Geographic mesh
+;     ===================
+;     
+;     
+      ind = where(abs(glamf-shift(glamf, 0, 1)) LT 1.e-8)
+      gsinu(ind) = 0.d
+      gcosu(ind) = 1.d
+;     
+      ind = where(abs(gphif-shift(gphif, 1, 0)) LT 1.e-8)
+      gsinv(ind) = 0.d
+      gcosv(ind) = 1.d
+;
+return
+END 
Index: /trunk/common_interp.pro
===================================================================
--- /trunk/common_interp.pro	(revision 2)
+++ /trunk/common_interp.pro	(revision 2)
@@ -0,0 +1,31 @@
+;+
+;
+; MODIFICATION HISTORY: 11/99 A. Jouzeau
+;                       10/2001 R. Hordoir, Added variables for
+;                       boundary conditions
+;                       02/2002 R. Hordoir, Added North Pole Treatment
+;                       03/2003 R. Hordoir, Added variables for
+;                       irregular input grid
+;			
+;-
+;-----------------------------------------------------------------------
+;            COMMON OF THE INTERPOLATION PROGRAM                       *
+;-----------------------------------------------------------------------
+COMMON input_grid, jpiatm, jpjatm, south_lat, west_lon, dx, phi_input, phi_input_u, phi_input_v, $
+ pres_x, pres_y, ext_x, ext_y, lonatm, latatm, $
+ nstep, nit000, nitend, datadept, $
+ units, key_2d, lon_shift, x_axis,y_axis, y_axis_u, y_axis_v
+COMMON mutiple, add_offset, scale_factor, key_vari
+COMMON missing, nmiss, missing_val
+COMMON output_grid, jpioce, jpjoce, lon_u, lat_u, lon_v, lat_v, lon_f, lat_f, lon_t, lat_t, $
+ outdept
+COMMON tridim, jpkatm, jpkoce
+COMMON paths, input_dir, output_dir, datafile, data_u_file, data_v_file, maskfile, gridfile, $
+ outputfile, outputfile_x, outputfile_y
+COMMON datas, data_name, data_u_name, data_v_name, mask_name, lon_name, lon_u_name, $
+ lon_v_name, lon_f_name, lat_name, lat_u_name, lat_v_name, lat_f_name, $
+ datadept_name, outdept_name, time_name
+COMMON numid, nummsh, nummsk, numdta, numdta_u, numdta_v, numout
+COMMON param, nfil, ndim, nscal, ninterp, ndraw, modlam, nreverse, ndep, keydraw, nlevel, $
+ key_mask, key_ps,north_pole
+COMMON perfs, key_performance
Index: /trunk/correc_angle.pro
===================================================================
--- /trunk/correc_angle.pro	(revision 2)
+++ /trunk/correc_angle.pro	(revision 2)
@@ -0,0 +1,72 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: correc_angle.pro
+;
+; PURPOSE: Corrects angles for interpolated vectorial data.
+;          Applies a rotation of field from original geographic
+;          mesh to target curvilinear grid
+;
+; CATEGORY: Subroutine
+;
+; CALLING SEQUENCE: correc_angle, zresul_uu, zresul_uv, $
+;                    zresul_vv, zresul_vu, zresul_u, zresul_v
+;
+; INPUTS: 
+;          zresul_uu : x-component of interpolated field at 
+;                      u-point	 
+;          zresul_uv : x-component of interpolated field at 
+;                      v-point	 
+;          zresul_vv : y-component of interpolated field at 
+;                      v-point	 
+;          zresul_vu : y-component of interpolated field at 
+;                      u-point	 
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: 
+;          zresul_u : corrected x-component of interpolated 
+;                     field at u-point
+;          zresul_v : corrected y-component of interpolated 
+;                     field at v-point
+;
+; COMMON BLOCKS:
+;	common_interp.pro
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 11/99 A. Jouzeau
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+PRO correc_angle, zresul_uu, zresul_uv, zresul_vv, zresul_vu, zresul_u, zresul_v
+@common_interp
+;
+; 1. Compute angles between grid lines and direction of the North
+; ===============================================================
+;
+printf, 40, ''
+printf, 40, 'calculating angles between geographic mesh and target grid'
+angle, lon_u, lat_u, lon_v, lat_v, lon_f, lat_f, gsinu, gsinv, gcosu, gcosv
+;
+; 2. Correct the two components of the field 
+; ==========================================
+;
+printf, 40, ''
+printf, 40, 'rotating fields'
+; gcosu = reform(reform(temporary(gcosu), jpioce*jpjoce)#replicate(1, nstep), jpioce, jpjoce, nstep)
+; gcosv = reform(reform(temporary(gcosv), jpioce*jpjoce)#replicate(1, nstep), jpioce, jpjoce, nstep)
+; gsinu = reform(reform(temporary(gsinu), jpioce*jpjoce)#replicate(1, nstep), jpioce, jpjoce, nstep)
+; gsinv = reform(reform(temporary(gsinv), jpioce*jpjoce)#replicate(1, nstep), jpioce, jpjoce, nstep)
+zresul_u = zresul_uu*gcosu + zresul_vu*gsinu
+zresul_v = zresul_vv*gcosv - zresul_uv*gsinv
+;
+return
+END 
Index: /trunk/divfred.pro
===================================================================
--- /trunk/divfred.pro	(revision 2)
+++ /trunk/divfred.pro	(revision 2)
@@ -0,0 +1,311 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:div
+;
+; PURPOSE:calcule la divergence d'un champ 2D
+;
+; CATEGORY:calcule sur les matrices
+;
+; CALLING SEQUENCE:res=div(u,v)
+;
+; INPUTS:
+;       u et v deux matrices representant les coordonnes d''un
+;       champ de vecteur
+;
+; KEYWORD PARAMETERS:
+;
+; OUTPUTS:res: une matrice 2d
+;
+; COMMON BLOCKS:
+;	common.pro
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+; les matrices u et v peuvent de 2 a 4 dimensions.
+; attention pour distinger les differents configurations de u et v
+; (xy, xyz, xyt, xyzt), on regarde la variable du common 
+;        -time qui contient le calendrier en jour julien d''IDL auquel
+;        se rapportent u et v ansi que la variable 
+;        -jpt qui est le nombre de pas de temps a considerer ds time.
+; les tableaux u et v sont decoupes sur le meme domaine
+; geographique. A cause du decalage des grilles T, U, V et F il est
+; possiible que ces 2 tableaux n''aient pas la meme taille et se
+; repportent a des indices differents. Si tel est le cas les tableaux
+; sont redecoupes sur les indices qu'ils ont en commun et le dommaine
+; est redefinit pour qu'il colle a ces indices communs.
+; pour eviter ces redecoupes utiliser le mot cles /memeindice ds
+; domdef.pro
+;
+; les points sur le bord du dessin sont mis a !values.f_nan
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY:Guillaume Roullet (grlod@ipsl.jussieu.fr)
+;                      Creation : printemps 1998
+;                      Sebastien Masson (smasson@lodyc.jussieu.fr)
+;                      adaptation pour marcher avec un domaine reduit
+;                      12/1/2000
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION divfred, uu, vv
+   tempsun = systime(1)         ; pour key_performance
+@common
+   u = uu
+   v = vv
+
+   date1 = time[0]
+   if n_elements(jpt) EQ 0 then date2 = date1 ELSE date2 = time[jpt-1]
+   if (size(u))[0] NE (size(v))[0] then return,  -1
+
+;------------------------------------------------------------
+; 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]
+   indicex = inter(indicexu, indicexv)
+   indiceyu = (lindgen(jpj))[premieryu:premieryu+nyu-1]
+   indiceyv = (lindgen(jpj))[premieryv:premieryv+nyv-1]
+   indicey = inter(indiceyu, indiceyv)
+   nx = n_elements(indicex) 
+   ny = n_elements(indicey)
+   indice2d = lindgen(jpi, jpj)
+   indice2d = indice2d[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1]
+   case 1 of
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+;xyz
+;----------------------------------------------------------------------------
+      (size(u))[0] EQ 3 AND date1 EQ date2 :BEGIN 
+;------------------------------------------------------------
+; extraction de u et v sur le domaine qui convient
+;------------------------------------------------------------
+         case 1 of
+            (size(u))[0] NE 3 OR (size(v))[0] NE 3: return,  -1
+            (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $
+             (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, *]
+                  ELSE :
+               endcase
+            END
+            (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $
+             (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 
+               u = u[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *]
+               v = v[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *]
+            END
+            ELSE:BEGIN 
+               zdiv = -1
+               GOTO, sortie
+            end
+            
+         endcase
+;------------------------------------------------------------
+; calcul de la divergence
+;------------------------------------------------------------
+         zu = (e2u[indice2d])[*]#replicate(1, nzt)
+         zu = reform(zu, nx, ny, nzt, /over)
+         zu = temporary(u)*temporary(zu) $
+          *(umask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]
+         terreu = where(zu EQ 0)
+;;;         if terreu[0] NE -1 then zu[temporary(terreu)] = !values.f_nan
+;
+         zv = (e1v[indice2d])[*]#replicate(1, nzt)
+         zv = reform(zv, nx, ny, nzt, /over)
+         zv = temporary(v)*temporary(zv) $
+          *(vmask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]
+         terrev = where(zv EQ 0)
+;;;         if terrev[0] NE -1 then zv[temporary(terrev)] = !values.f_nan
+;
+         zdiv = 1e6/(e1t[indice2d]*e2t[indice2d])
+         zdiv = (zdiv)[*]#replicate(1, nzt)
+         zdiv = reform(zdiv, nx, ny, nzt, /over)
+         zdiv = temporary(zdiv)*(zu-shift(zu, 1, 0, 0)+zv-shift(zv, 0, 1, 0)) $
+          *tmask[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]
+;------------------------------------------------------------
+; mise a !values.f_nan de la bordure
+;------------------------------------------------------------
+         if  NOT keyword_set(key_periodique) OR nx NE jpi then begin
+            zdiv(0, *, *) = !values.f_nan
+            zdiv(nx-1, *, *) = !values.f_nan
+         endif
+;;         zdiv(*, 0, *) = !values.f_nan
+;;         zdiv(*, ny-1, *) = !values.f_nan
+;
+         zdiv = temporary(zdiv)
+;
+         if n_elements(valmask) EQ 0 THEN valmask = 1e20
+         terre =  where(tmask[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt] EQ 0)
+         if terre[0] NE -1 then zdiv[temporary(terre)] = valmask
+;------------------------------------------------------------
+; pour le trace graphique
+;------------------------------------------------------------
+         vargrid = 'T'
+         varname = 'div'
+         varunits = '1e6*s-1'
+         domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], prof1, prof2, grille = ['t']
+         if keyword_set(direc) then  zdiv = moyenne(zdiv,direc,/nan, boite = boite)
+      END
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+;xyt
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+      date1 NE date2 AND (size(u))[0] EQ 3 :BEGIN 
+;------------------------------------------------------------
+; extraction de u et v sur le domaine qui convient
+;------------------------------------------------------------
+         case 1 of
+            (size(u))[0] NE 3 OR (size(v))[0] NE 3: return,  -1
+            (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $
+             (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, *]
+                  ELSE :
+               endcase
+            END
+            (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $
+             (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 
+               u = u[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *]
+               v = v[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *]
+            END
+            ELSE:return,  -1
+         endcase
+;------------------------------------------------------------
+; calcul de la divergence
+;------------------------------------------------------------
+         zu = e2u[indice2d]*(umask())[indice2d+jpi*jpj*premierzt]
+         terreu = where(zu EQ 0)
+;;;         if terreu[0] NE -1 then zu[temporary(terreu)] = !values.f_nan
+         zu = (zu)[*]#replicate(1, jpt)
+         zu = reform(zu, nx, ny, jpt, /over)
+         zu = temporary(u)*temporary(zu)
+;
+         zv = e1v[indice2d]*(vmask())[indice2d+jpi*jpj*premierzt]
+         terrev = where(zv EQ 0)
+;;;         if terrev[0] NE -1 then zv[temporary(terrev)] = !values.f_nan
+         zv = (zv)[*]#replicate(1, jpt)
+         zv = reform(zv, nx, ny, jpt, /over)
+         zv = temporary(v)*temporary(zv)
+;
+         zdiv = 1e6*tmask[indice2d+jpi*jpj*premierzt]/(e1t[indice2d]*e2t[indice2d])
+         zdiv = (zdiv)[*]#replicate(1, jpt)
+         zdiv = reform(zdiv, nx, ny, jpt, /over)
+         terre =  where(zdiv EQ 0)
+         zdiv = temporary(zdiv)*(zu-shift(zu, 1, 0, 0)+zv-shift(zv, 0, 1, 0))
+;------------------------------------------------------------
+; mise a !values.f_nan de la bordure
+;------------------------------------------------------------
+         if  NOT keyword_set(key_periodique) OR nx NE jpi then begin
+            zdiv(0, *, *) = !values.f_nan
+            zdiv(nx-1, *, *) = !values.f_nan
+         endif
+;;         zdiv(*, 0, *) = !values.f_nan
+;;         zdiv(*, ny-1, *) = !values.f_nan
+;
+         if n_elements(valmask) EQ 0 THEN valmask = 1e20
+         if terre[0] NE -1 then zdiv[temporary(terre)] = valmask
+;------------------------------------------------------------
+; pour le trace graphique
+;------------------------------------------------------------
+         vargrid = 'T'
+         varname = 'div'
+         varunits = '1e6*s-1'
+         domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], prof1, prof2, grille = ['t']
+         if keyword_set(direc) then  zdiv = grossemoyenne(zdiv,direc,/nan, boite = boite)
+      END
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+;xyzt
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+      date1 NE date2 AND (size(u))[0] EQ 4:BEGIN 
+         return, report('non code!')
+      END
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+;xy
+;----------------------------------------------------------------------------
+;----------------------------------------------------------------------------
+      ELSE:BEGIN                ;xy
+         indice3d = lindgen(jpi, jpj, jpk)
+         indice3d = indice3d[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, niveau -1]
+;------------------------------------------------------------
+; extraction de u et v sur le domaine qui convient
+;------------------------------------------------------------
+         case 1 of
+            (size(u))[0] NE 2 OR (size(v))[0] NE 2: BEGIN 
+               zdiv = -1
+               GOTO, sortie
+            end
+            (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $
+             (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]
+                  ELSE :
+               endcase
+            END
+            (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $
+             (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 
+               u = u[indice2d]
+               v = v[indice2d]
+            END
+            ELSE:return,  -1
+         endcase
+;------------------------------------------------------------
+; calcul de la divergence
+;------------------------------------------------------------
+         zu = temporary(u)*e2u[indice2d]*(umask())[indice3d]
+         terreu = where(zu EQ 0)
+;;;         if terreu[0] NE -1 then zu[temporary(terreu)] = !values.f_nan
+         zv = temporary(v)*e1v[indice2d]*(vmask())[indice3d]
+         terrev = where(zv EQ 0)
+;;;         if terrev[0] NE -1 then zv[temporary(terrev)] = !values.f_nan
+         zdiv = zu-shift(zu, 1, 0)+zv-shift(zv, 0, 1)
+         zdiv = temporary(zdiv)*tmask[indice3d]/(e1t[indice2d]*e2t[indice2d])
+;------------------------------------------------------------
+; mise a !values.f_nan de la bordure
+;------------------------------------------------------------
+         if  NOT keyword_set(key_periodique) OR nx NE jpi then begin
+            zdiv(0, *) = !values.f_nan
+            zdiv(nx-1, *) = !values.f_nan
+         endif
+;;         zdiv(*, 0) = !values.f_nan
+;;         zdiv(*, ny-1) = !values.f_nan
+;
+         zdiv = temporary(zdiv)*1e6
+;
+         if n_elements(valmask) EQ 0 THEN valmask = 1e20
+         terre =  where(tmask[indice3d] EQ 0)
+         if terre[0] NE -1 then zdiv[temporary(terre)] = valmask
+;------------------------------------------------------------
+; pour le trace graphique
+;------------------------------------------------------------
+         vargrid = 'T'
+         varname = 'div'
+         varunits = '1e6*s-1'
+         domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], prof1, prof2, grille = ['t']
+         if keyword_set(direc) then  zdiv = moyenne(zdiv,direc,/nan, boite = boite)
+
+      END
+   endcase
+   
+;------------------------------------------------------------
+sortie:
+   if keyword_set(key_performance) THEN print, 'temps div', systime(1)-tempsun 
+   
+   return, zdiv
+end
Index: /trunk/draw.pro
===================================================================
--- /trunk/draw.pro	(revision 2)
+++ /trunk/draw.pro	(revision 2)
@@ -0,0 +1,39 @@
+PRO draw, field, glam, gphi, zpi, zpj, nbcol, dessin, nbdessin, title = title, zmin, zmax, LAND = land
+@common
+jpi = zpi
+jpj = zpj
+glamt = glam
+IF size(glamt, /n_dimensions) EQ 1 THEN glamt = glamt#replicate(1, jpj)
+glamf = glam
+gphit = gphi
+IF size(gphit, /n_dimensions) EQ 1 THEN gphit = replicate(1, jpi)#gphit
+gphif = gphi
+gdept = [0]
+gdepw = [0]
+tmask = replicate(1, jpi, jpj)
+
+e1t = replicate(1, jpi, jpj)
+e2t = replicate(1, jpi, jpj)
+e3t = [1]
+jpk = 1
+;
+varname = title
+domdef, grille = ['T', 'F']
+key_periodique = 1
+;
+ind = where(field GE 1.e20)
+IF n_elements(ind) GT 1 THEN field(ind) = 0.
+;
+IF size(glam, /n_dimensions) EQ 1 THEN triangles = triangule() ELSE triangulate, glamt, gphit, triangles 
+;
+IF keyword_set(land) THEN BEGIN 
+   if dessin EQ 1 then plt, field, zmin, zmax, nite = 0, /carte, petit = [nbcol, nbdessin, dessin], /remplit, div = 4, /cont_nofill, retain = 2, /nocontour, /land $
+   ELSE plt, field, zmin, zmax, nite = 0, /carte, petit = [nbcol, nbdessin, dessin], $
+    /noerase, /remplit, div = 4, /cont_nofill, /nocontour, /land
+ENDIF ELSE BEGIN 
+if dessin EQ 1 then plt, field, zmin, zmax, nite = 0, /carte, petit = [nbcol, nbdessin, dessin], /remplit, div = 4, /cont_nofill, retain = 2, /nocontour, /port $
+ELSE plt, field, zmin, zmax, nite = 0, /carte, petit = [nbcol, nbdessin, dessin], $
+ /noerase, /remplit, div = 4, /cont_nofill, /nocontour, /port
+ENDELSE 
+return
+end
Index: /trunk/extrap.pro
===================================================================
--- /trunk/extrap.pro	(revision 2)
+++ /trunk/extrap.pro	(revision 2)
@@ -0,0 +1,146 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: extrap.pro (based on remplit.pro)
+;
+; PURPOSE: Extrapolates ocean data values on land points 
+;
+; CATEGORY: Subroutine
+;
+; CALLING SEQUENCE: extrap, zdata, zmask, it, val
+;
+; INPUTS: 
+;          zdata : field to extrapolate
+;          zmask : field's mask
+;          it    : iteration
+;          val   : field value on masked points	 
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: 
+;          zdata : extrapolated field 
+;          zmask : mask after extrapolation
+;
+; COMMON BLOCKS:
+;	common_interp.pro 
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 19/11/99 Arnaud Jouzeau
+;                       25/02/00 Sebastien Masson (remplit.pro)
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+PRO extrap, z, mmmask, it, val
+@common_interp
+;
+; 1. Looking for land points
+; ==========================
+;
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; znbvoisins=shift(zmask,1,0)+shift(zmask,-1,0)+shift(zmask,0,1)+shift(zmask,0,-1) $
+;           +shift(zmask,1,1)+shift(zmask,-1,1)+shift(zmask,1,-1)+shift(zmask,-1,-1)
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+;
+; 2. Extrapolating when needed 
+; ============================
+;
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; zdfm = zdata*zmask
+; zremplit =shift(zdfm,1,0)+shift(zdfm,-1,0)+shift(zdfm,0,1)+shift(zdfm, 0,-1) $
+;          +shift(zdfm,1,1)+shift(zdfm,-1,1)+shift(zdfm,1,-1)+shift(zdfm, -1,-1)
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+;
+;  ... coastal points
+;
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; ocean = where(zmask NE 0.)
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; ind = where(znbvoisins NE 0. AND znbvoisins NE 8.)
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; znbvoisins(ind) = 1.d/temporary(znbvoisins(ind))
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; zremplit(ind) = temporary(zremplit(ind))*znbvoisins(ind)
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; zmask(ind) = 1.d
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+;
+;  ... inland points
+;
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; ocean2 = where(zmask NE 0.)
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; IF n_elements(ocean2) NE jpiatm*(jpjatm+4) THEN BEGIN 
+; land = where(zmask EQ 0.)
+; zremplit(land) = val
+; ENDIF 
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+;
+;  ... filling with ocean values
+;
+; IF keyword_set(key_performance) THEN temp = systime(1)
+; zremplit(ocean)=zdata(ocean)
+; zdata = zremplit
+; IF keyword_set(key_performance) THEN print, systime(1)-temp
+; IF keyword_set(key_performance) THEN print, 'fin iteration', it
+;
+; on trouve les points cote
+   tempdeux = systime(1)        ; pour key_performance =2
+; les points du bord du cadre ne doivent pas etre dans la cote
+   mmmask[0, *] = 1
+   mmmask[jpiatm+1, *] = 1
+   mmmask[*, 0] = 1
+   mmmask[*, jpjatm+1] = 1
+; liste des points terre restant
+   terre = where(mmmask EQ 0)
+   if terre[0] EQ -1 then GOTO, fini
+; les points du bord du cadre doivent maintenan etre dans la terre
+   mmmask[0, *] = 0
+   mmmask[jpiatm+1, *] = 0
+   mmmask[*, 0] = 0
+   mmmask[*, jpjatm+1] = 0
+; liste des voisins mer
+   voisins = shift(mmmask,-1,0)+shift(mmmask,1,0)+shift(mmmask,0,-1)+shift(mmmask,0,1) $
+    +1./sqrt(2)*(shift(mmmask,-1,-1)+shift(mmmask,1,1)+shift(mmmask,1,-1)+shift(mmmask,-1,1))
+; liste des points cote
+   cote = where(voisins[terre] GT 0)
+   cote = terre[cote]
+;
+   IF testvar(var = key_performance) EQ 2 THEN $
+    print, 'temps remplit: trouver la cote ', systime(1)-tempdeux
+;---------------------------------------------------------------
+; remplissage des points cote
+;---------------------------------------------------------------
+   tempdeux = systime(1)        ; pour key_performance =2
+; on masque z
+   z = z*mmmask
+;
+   zcote = z[1+cote]+z[-1+cote]+z[(jpiatm+2)+cote]+z[-(jpiatm+2)+cote] $
+    +1./sqrt(2)*(z[(jpiatm+2)+1+cote]+z[(jpiatm+2)-1+cote]+z[-(jpiatm+2)+1+cote]+z[-(jpiatm+2)-1+cote])
+   poids = voisins[cote]
+      
+   z[cote] = zcote/poids
+;---------------------------------------------------------------
+; IV) on reduit le masque
+;---------------------------------------------------------------
+   mmmask[cote] = 1
+   z = z*mmmask + val*(1-mmmask)
+;   print, max(z)
+;
+   IF testvar(var = key_performance) EQ 2 THEN $
+    print, 'temps remplit: une iteration ', systime(1)-tempdeux
+fini:
+
+return
+END
Index: /trunk/for_createpro.pro
===================================================================
--- /trunk/for_createpro.pro	(revision 2)
+++ /trunk/for_createpro.pro	(revision 2)
@@ -0,0 +1,4 @@
+pro for_createpro
+@/usr/work/sur/fvi/OPA/geomag/initorca2_bab
+return
+end
Index: /trunk/forcage.pro
===================================================================
--- /trunk/forcage.pro	(revision 2)
+++ /trunk/forcage.pro	(revision 2)
@@ -0,0 +1,236 @@
+PRO forcagequimarche,iyear,ian 
+@init2
+@initorca2_bab
+
+
+
+
+@common
+
+
+
+;ian='01'
+;iyear='1993'
+
+e_exp='ESS'
+rep_fred='/usr/work/sur/fvi/OPA/geomag/'
+key_portrait = 0
+; stockage des fichiers brut 
+  ioDATA='/usr/work/sur/fvi/OPA/ORCA2/'
+  file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 
+  print, file_U
+  file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 
+  print, file_V
+  file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 
+  print, file_T
+  file_Sed= rep_fred+'cond_sed_ORCA2.nc'
+  file_Br= rep_fred+'Br_ORCA2.nc'
+
+
+; title
+     t_exp= e_exp
+;     t_exp0= e_exp0
+     t_bt  = 'bar_transp'
+ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2'
+;facteur d'echelle vertical  for partial steps
+e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+SIGMAsed=read_ncdf('cond_sed',0,/timestep,/nostruct,/tout,filename=file_Sed,/cont_nofill)
+;BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br)
+BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill)
+
+
+
+
+; vertical integration:
+e3t3d=make_array(jpi,jpj,jpk)   
+        for k=0, jpk-1 do begin              &$
+          for j=0,jpj-1 do begin              &$      
+            for i=0,jpi-1 do begin             &$
+              e3t3d(i,j,k) = e3t(k)    &$
+            endfor                     &$
+          endfor                      &$
+        endfor
+jpt = 73
+
+;vud = make_array(jpi,jpj,jpt)   
+;vvd = make_array(jpi, jpj, jpt)
+divBustar = make_array(jpi, jpj, jpt)
+diver2=fltarr(jpi,jpj,1,73)
+
+; ouverture des fichiers dans lesquels on va écrire 
+;id3=NCDF_OPEN('/usr/work/sur/fvi/OPA/geomag/U_5d_'+iyear+'_grid_T.nc',/write)
+;id4=NCDF_OPEN('/usr/work/sur/fvi/OPA/geomag/V_5d_'+iyear+'_grid_T.nc',/write)
+;id4=NCDF_CREATE('/usr/work/sur/fvi/OPA/ORCA2/DivBustar_5d_'+iyear+'_grid_T.nc',/clobber)
+
+;id4=NCDF_OPEN('/usr/work/sur/fvi/OPA/ORCA2/DivBustar_5d_'+iyear+'_grid_T.nc',/write)
+
+FOR jt = 0, jpt-1 DO BEGIN &$   
+
+; ouverture des fichiers et stockage en memoire partial steps
+  vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$   
+;stop
+  vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$   
+;stop
+; lecture salinite & temperature
+  temp= read_ncdf('votemper',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T)
+;stop
+  salin=read_ncdf('vosaline',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T)
+;stop
+  conduct=0.02047780622061 + 0.00273147624197*temp + 0.00035133182334*temp*temp + 0.09139808809909*salin + 0.00241425798890*salin*temp -0.00023998958774*salin*salin
+  mask_t=where(conduct GT 1.e+19)
+  conduct(mask_t)=0.
+; Somme conduct au point T
+
+
+; Calcul SIGMA
+
+  SIGMAoc=total(conduct*e3t3d*tmask,3)
+  SIGMA=SIGMAsed+SIGMAoc
+
+
+
+  SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2.
+
+  SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2.
+
+; Calcul B en points u et v
+
+  BR_u=(BR+shift(BR,-1,0))/2.
+
+  BR_v=(BR+shift(BR,0,1))/2.
+
+
+; Calcul integrale conduct
+
+  conduct_u=(conduct+shift(conduct,-1,0,0))/2.
+
+  conduct_v=(conduct+shift(conduct,0,1,0))/2.
+  
+  u_cond_u=total( vu*conduct_u*e3u3d*umask(),3)
+
+  v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3)
+
+
+  Bu_star= BR_u*u_cond_u/SIGMA_u
+
+  Bv_star= BR_v*v_cond_v/SIGMA_v
+
+; Divergence du champ
+
+  Diver=div(Bu_star,Bv_star)
+
+Diver=Diver*1e-6
+
+;Diver=Diver*1e11
+;for jj=0,147 do begin &$
+;  for ji=0,179 do begin &$
+;   if( Diver(ji,jj) GT 1e10 ) then begin &$ 
+;	Diver(ji,jj) = 0. &$
+;   endif &$
+;  endfor &$
+;endfor 
+
+;stop
+
+ diver2(*,*,0,jt)=Diver(*,*)
+;stop
+; Somme sur la verticale partial steps
+;                vum=total( vu*e3u3d*umask(),3 )  &$   
+;                vvm=total( vv*e3v3d*vmask(),3 )  &$   
+
+; Shift sur la grille T partial steps
+;             vut= (vum+shift(vum,1,0) )*0.5   &$   
+;             vvt= (vvm+shift(vvm,0,1) )*0.5   &$
+; Bande de recouvrement 
+;             vut(0, *) = vut(jpi-2, *)
+;             vvt(*, 0) = 0.
+; stockage dans le fichier de sortie 
+;NCDF_VARPUT, id3,'sossheig',vut, offset = [0, 0, jt]
+;NCDF_VARPUT, id4,'sossheig',Diver, offset = [0, 0, jt]
+
+print,  jt
+
+
+ENDFOR  
+; on ferme le NetCDF
+;NCDF_CLOSE,id3
+;NCDF_CLOSE,id4
+
+
+
+
+temps=fltarr(73)
+temps(0)=0.
+for jt=0,71 do begin &$
+temps(jt+1)=temps(jt) +5*86400. &$
+endfor
+print,temps
+
+   vargrid = 'T'
+   iodir = '/usr/work/sur/fvi/OPA/ORCA2/'
+; Nom
+   idout = NCDF_CREATE(iodir+'DivBustar_5d_'+iyear+'_grid_T.nc',/clobber)
+   print, 'Creation du fichier Netcdf'
+   NCDF_CONTROL, idout, /nofill
+; Dimension
+   xidout = NCDF_DIMDEF(idout, 'x',jpi)
+   yidout = NCDF_DIMDEF(idout, 'y',jpj)
+   didout = NCDF_DIMDEF(idout, 'deptht',1)
+   tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
+
+   didout1 = NCDF_DIMDEF(idout, 'deptht1',jpk)
+
+
+; Attributs globaux
+   id0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ], /FLOAT)
+   id1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ], /FLOAT)
+   id2  = NCDF_VARDEF(idout, 'deptht'      , [                didout1        ], /FLOAT)
+   id3  = NCDF_VARDEF(idout, 'time_counter', [                        tidout], /FLOAT)
+   id4  = NCDF_VARDEF(idout, 'Diver'  , [xidout, yidout, didout, tidout], /DOUBLE)
+
+; Variable 0
+   NCDF_ATTPUT, idout, id0, 'units', 'degrees_east'
+   NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude'
+   NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid'
+; Variable 1
+   NCDF_ATTPUT, idout, id1, 'units', 'degrees_north'
+   NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude'
+   NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid'
+; Variable 2
+   NCDF_ATTPUT, idout, id2, 'units','meters'
+   NCDF_ATTPUT, idout, id2, 'long_name','Depth'
+   NCDF_ATTPUT, idout, id2, 'nav_model','Default grid'
+; Variable3
+   NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-01 00:00:00 '
+   NCDF_ATTPUT, idout, id3, 'calendar','noleap'
+   NCDF_ATTPUT, idout, id3, 'title', 'Time'
+   NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis'
+   NCDF_ATTPUT, idout, id3, 'time_origin','0001-JAN-01 00:00:00'
+; Variables
+   NCDF_ATTPUT, idout, id4, 'long_name', 'Divergence'
+
+
+   NCDF_CONTROL, idout, /ENDEF
+
+; Creation de la longitude
+   NCDF_VARPUT, idout, id0, glamt
+; Creation de la latitude
+   NCDF_VARPUT, idout, id1, gphit
+; Creation de la profondeur 
+   NCDF_VARPUT, idout, id2, gdept 
+; Creation du calendrier
+
+   NCDF_VARPUT, idout, id3, temps
+
+   
+; Ecriture des donnees
+
+; ecriture des glam_8 
+   NCDF_VARPUT, idout, id4 , diver2
+
+   NCDF_CLOSE, idout
+
+
+
+END
Index: /trunk/forcage.pro.save
===================================================================
--- /trunk/forcage.pro.save	(revision 2)
+++ /trunk/forcage.pro.save	(revision 2)
@@ -0,0 +1,141 @@
+PRO forcage,iyear,ian 
+@init2
+@initorca2_bab
+
+
+
+
+@common
+
+
+
+ian='01'
+iyear='1993'
+
+e_exp='ESS'
+rep_fred='/usr/work/sur/fvi/OPA/geomag/'
+key_portrait = 0
+; stockage des fichiers brut 
+  ioDATA='/usr/work/sur/fvi/OPA/ORCA2/'
+  file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 
+  print, file_U
+  file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 
+  print, file_V
+  file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 
+  print, file_T
+  file_Sed= rep_fred+'cond_sed_ORCA2.nc'
+  file_Br= rep_fred+'Br_ORCA2.nc'
+
+
+; title
+     t_exp= e_exp
+;     t_exp0= e_exp0
+     t_bt  = 'bar_transp'
+ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2'
+;facteur d'echelle vertical  for partial steps
+e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+SIGMAsed=read_ncdf('cond_sed',0,/timestep,/nostruct,/tout,filename=file_Sed,/cont_nofill)
+;BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br)
+BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill)
+
+
+
+
+; vertical integration:
+e3t3d=make_array(jpi,jpj,jpk)   
+        for k=0, jpk-1 do begin              &$
+          for j=0,jpj-1 do begin              &$      
+            for i=0,jpi-1 do begin             &$
+              e3t3d(i,j,k) = e3t(k)    &$
+            endfor                     &$
+          endfor                      &$
+        endfor
+jpt = 73
+
+;vud = make_array(jpi,jpj,jpt)   
+;vvd = make_array(jpi, jpj, jpt)
+divBustar = make_array(jpi, jpj, jpt)
+
+; ouverture des fichiers dans lesquels on va écrire 
+;id3=NCDF_OPEN('/usr/work/sur/fvi/OPA/geomag/U_5d_'+iyear+'_grid_T.nc',/write)
+;id4=NCDF_OPEN('/usr/work/sur/fvi/OPA/geomag/V_5d_'+iyear+'_grid_T.nc',/write)
+id4=NCDF_CREATE('/usr/work/sur/fvi/OPA/ORCA2/DivBustar_5d_'+iyear+'_grid_T.nc',/clobber)
+
+;id4=NCDF_OPEN('/usr/work/sur/fvi/OPA/ORCA2/DivBustar_5d_'+iyear+'_grid_T.nc',/write)
+
+FOR jt = 0, jpt-1 DO BEGIN &$   
+
+; ouverture des fichiers et stockage en memoire partial steps
+  vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$   
+  vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$   
+; lecture salinite & temperature
+  temp= read_ncdf('votemper',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T)
+  salin=read_ncdf('vosaline',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T)
+
+  conduct=0.02047780622061 + 0.00273147624197*temp + 0.00035133182334*temp*temp + 0.09139808809909*salin + 0.00241425798890*salin*temp -0.00023998958774*salin*salin
+  mask_t=where(conduct GT 1.e+19)
+  conduct(mask_t)=0.
+; Somme conduct au point T
+
+
+; Calcul SIGMA
+
+  SIGMAoc=total(conduct*e3t3d*tmask,3)
+  SIGMA=SIGMAsed+SIGMAoc
+
+  SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2.
+
+  SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2.
+
+; Calcul B en points u et v
+
+  BR_u=(BR+shift(BR,-1,0))/2.
+
+  BR_v=(BR+shift(BR,0,1))/2.
+
+
+; Calcul integrale conduct
+
+  conduct_u=(conduct+shift(conduct,-1,0,0))/2.
+
+  conduct_v=(conduct+shift(conduct,0,1,0))/2.
+  
+  u_cond_u=total( vu*conduct_u*e3u3d*umask(),3)
+
+  v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3)
+
+
+  Bu_star= BR_u*u_cond_u/SIGMA_u
+
+  Bv_star= BR_v*v_cond_v/SIGMA_v
+
+; Divergence du champ
+
+  Diver=div(Bu_star,Bv_star)
+  
+; Somme sur la verticale partial steps
+;                vum=total( vu*e3u3d*umask(),3 )  &$   
+;                vvm=total( vv*e3v3d*vmask(),3 )  &$   
+
+; Shift sur la grille T partial steps
+;             vut= (vum+shift(vum,1,0) )*0.5   &$   
+;             vvt= (vvm+shift(vvm,0,1) )*0.5   &$
+; Bande de recouvrement 
+;             vut(0, *) = vut(jpi-2, *)
+;             vvt(*, 0) = 0.
+; stockage dans le fichier de sortie 
+;NCDF_VARPUT, id3,'sossheig',vut, offset = [0, 0, jt]
+NCDF_VARPUT, id4,'sossheig',Diver, offset = [0, 0, jt]
+
+print,  jt
+
+ENDFOR  
+; on ferme le NetCDF
+;NCDF_CLOSE,id3
+NCDF_CLOSE,id4
+
+
+
+
+END
Index: /trunk/forcageforMOED.pro
===================================================================
--- /trunk/forcageforMOED.pro	(revision 2)
+++ /trunk/forcageforMOED.pro	(revision 2)
@@ -0,0 +1,237 @@
+PRO forcageforMOED
+@init2
+@initorca2_bab
+
+@common
+
+ian='01'
+iyear='1993'
+
+e_exp='ESS'
+rep_fred='/usr/work/sur/fvi/OPA/geomag/'
+key_portrait = 0
+; stockage des fichiers brut 
+  ioDATA='/usr/work/sur/fvi/OPA/ORCA2/'
+  file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 
+  print, file_U
+  file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 
+  print, file_V
+  file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 
+  print, file_T
+  file_Sed= rep_fred+'cond_sed_ORCA2.nc'
+  file_Br= rep_fred+'Br_ORCA2.nc'
+
+
+; title
+     t_exp= e_exp
+	
+     t_bt  = 'bar_transp'
+ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2'
+;facteur d'echelle vertical  for partial steps
+e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+SIGMAsed=read_ncdf('cond_sed',0,/timestep,/nostruct,/tout,filename=file_Sed,/cont_nofill)
+BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill)
+
+
+
+
+
+; vertical integration:
+e3t3d=make_array(jpi,jpj,jpk)   
+        for k=0, jpk-1 do begin              &$
+          for j=0,jpj-1 do begin              &$      
+            for i=0,jpi-1 do begin             &$
+              e3t3d(i,j,k) = e3t(k)    &$
+            endfor                     &$
+          endfor                      &$
+        endfor
+jpt = 73
+
+;vud = make_array(jpi,jpj,jpt)   
+;vvd = make_array(jpi, jpj, jpt)
+divBustar = make_array(jpi, jpj, jpt)
+diver3=replicate(0.,182,149,1,73)
+sigma3=replicate(0.,182,149,1,73)
+Jpu=replicate(0.,182,149,1,73)
+Jpv=replicate(0.,182,149,1,73)
+
+
+FOR jt = 0, jpt-1 DO BEGIN &$   
+
+; ouverture des fichiers et stockage en memoire partial steps
+  vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$   
+;stop
+  vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$   
+;stop
+; lecture salinite & temperature
+  temp= read_ncdf('votemper',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T)
+;stop
+  salin=read_ncdf('vosaline',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T)
+;stop
+  conduct=0.02047780622061 + 0.00273147624197*temp + 0.00035133182334*temp*temp + 0.09139808809909*salin + 0.00241425798890*salin*temp -0.00023998958774*salin*salin
+  mask_t=where(conduct GT 1.e+19)
+  conduct(mask_t)=0.
+; Somme conduct au point T
+
+
+; Calcul SIGMA
+
+  SIGMAoc=total(conduct*e3t3d*tmask,3)
+  SIGMA=SIGMAsed+SIGMAoc
+
+
+
+  SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2.
+
+  SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2.
+
+; Calcul B en points u et v
+
+  BR_u=(BR+shift(BR,-1,0))/2.
+
+  BR_v=(BR+shift(BR,0,1))/2.
+
+
+; Calcul integrale conduct
+
+  conduct_u=(conduct+shift(conduct,-1,0,0))/2.
+
+  conduct_v=(conduct+shift(conduct,0,1,0))/2.
+  
+  u_cond_u=total( vu*conduct_u*e3u3d*umask(),3)
+
+  v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3)
+
+
+;calcul de Jp= u_star x Fz k
+  Jpv_star= -1*BR_u*u_cond_u
+
+  Jpu_star= BR_v*v_cond_v
+
+; Divergence du champ
+
+  Diver=divfred(Jpu_star,Jpv_star)
+
+Diver=Diver*1e-6
+;stop
+lecontinent=where(Diver GT 1.E08)
+Diver(lecontinent)=0.
+
+
+
+;stop
+;bande de recouvrement::
+
+diver3(1:180,0:147,*,jt)=Diver(*,*)
+diver3(0,*,*,*)=diver3(180,*,*,*)
+diver3(181,*,*,*)=diver3(1,*,*,*)
+
+sigma3(1:180,0:147,*,jt)=SIGMA(*,*)
+sigma3(0,*,*,*)=sigma3(180,*,*,*)
+sigma3(181,*,*,*)=sigma3(1,*,*,*)
+
+Jpu(1:180,0:147,*,jt)=Jpu_star(*,*)
+Jpu(0,*,*,*)=Jpu(180,*,*,*)
+Jpu(181,*,*,*)=Jpu(1,*,*,*)
+
+Jpv(1:180,0:147,*,jt)=Jpv_star(*,*)
+Jpv(0,*,*,*)=Jpv(180,*,*,*)
+Jpv(181,*,*,*)=Jpv(1,*,*,*)
+
+
+
+
+print,  jt
+
+
+ENDFOR 
+ 
+
+
+
+temps=fltarr(73)
+temps(0)=0.
+for jt=0,71 do begin &$
+temps(jt+1)=temps(jt) +5*86400. &$
+endfor
+print,temps
+
+   vargrid = 'T'
+   iodir = '/usr/work/sur/fvi/OPA/ORCA2/'
+; Nom
+   idout = NCDF_CREATE(iodir+'ForcageMOED_5d_'+iyear+'_grid_T.nc',/clobber)
+   print, 'Creation du fichier Netcdf'
+   NCDF_CONTROL, idout, /nofill
+; Dimension
+   xidout = NCDF_DIMDEF(idout, 'x',jpiglo)
+   yidout = NCDF_DIMDEF(idout, 'y',jpjglo)
+   didout = NCDF_DIMDEF(idout, 'deptht',1)
+   tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
+
+   didout1 = NCDF_DIMDEF(idout, 'deptht1',jpk)
+
+
+; Attributs globaux
+   id0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ], /FLOAT)
+   id1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ], /FLOAT)
+   id2  = NCDF_VARDEF(idout, 'deptht'      , [                didout1        ], /FLOAT)
+   id3  = NCDF_VARDEF(idout, 'time_counter', [                        tidout], /FLOAT)
+   id4  = NCDF_VARDEF(idout, 'DivJp'  , [xidout, yidout, didout, tidout], /DOUBLE)
+   id5  = NCDF_VARDEF(idout, 'Sigma'  , [xidout, yidout, didout, tidout], /DOUBLE)
+   id6  = NCDF_VARDEF(idout, 'Jpu'  , [xidout, yidout, didout, tidout], /DOUBLE)
+   id7  = NCDF_VARDEF(idout, 'Jpv'  , [xidout, yidout, didout, tidout], /DOUBLE)
+
+; Variable 0
+   NCDF_ATTPUT, idout, id0, 'units', 'degrees_east'
+   NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude'
+   NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid'
+; Variable 1
+   NCDF_ATTPUT, idout, id1, 'units', 'degrees_north'
+   NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude'
+   NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid'
+; Variable 2
+   NCDF_ATTPUT, idout, id2, 'units','meters'
+   NCDF_ATTPUT, idout, id2, 'long_name','Depth'
+   NCDF_ATTPUT, idout, id2, 'nav_model','Default grid'
+; Variable3
+   NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-01 00:00:00 '
+   NCDF_ATTPUT, idout, id3, 'calendar','noleap'
+   NCDF_ATTPUT, idout, id3, 'title', 'Time'
+   NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis'
+   NCDF_ATTPUT, idout, id3, 'time_origin','0001-JAN-01 00:00:00'
+; Variables
+   NCDF_ATTPUT, idout, id4, 'long_name', 'Divergence Jp'
+; Variables
+   NCDF_ATTPUT, idout, id5, 'long_name', 'Total Conductance'
+   NCDF_ATTPUT, idout, id6, 'long_name', 'Jpu=u_star x B (x comp)'
+   NCDF_ATTPUT, idout, id7, 'long_name', 'Jpv=u_star x B (y comp)'
+
+
+   NCDF_CONTROL, idout, /ENDEF
+
+; Creation de la longitude
+   NCDF_VARPUT, idout, id0, glamt
+; Creation de la latitude
+   NCDF_VARPUT, idout, id1, gphit
+; Creation de la profondeur 
+   NCDF_VARPUT, idout, id2, gdept 
+; Creation du calendrier
+
+   NCDF_VARPUT, idout, id3, temps
+
+   
+; Ecriture des donnees
+
+; ecriture des glam_8 
+   NCDF_VARPUT, idout, id4 , diver3
+   NCDF_VARPUT, idout, id5 , sigma3
+   NCDF_VARPUT, idout, id6 , Jpu
+   NCDF_VARPUT, idout, id7 , Jpv
+
+
+
+   NCDF_CLOSE, idout
+
+
+END
Index: /trunk/forcagequimarche.pro
===================================================================
--- /trunk/forcagequimarche.pro	(revision 2)
+++ /trunk/forcagequimarche.pro	(revision 2)
@@ -0,0 +1,284 @@
+PRO forcagequimarche,iyear,ian 
+@init2
+@initorca2_bab
+
+
+
+
+@common
+
+
+
+;ian='01'
+;iyear='1993'
+
+e_exp='ESS'
+rep_fred='/usr/work/sur/fvi/OPA/geomag/'
+key_portrait = 0
+; stockage des fichiers brut 
+  ioDATA='/usr/work/sur/fvi/OPA/ORCA2/'
+  file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 
+  print, file_U
+  file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 
+  print, file_V
+  file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 
+  print, file_T
+  file_Sed= rep_fred+'cond_sed_ORCA2.nc'
+  file_Br= rep_fred+'Br_ORCA2.nc'
+
+
+; title
+     t_exp= e_exp
+;     t_exp0= e_exp0
+     t_bt  = 'bar_transp'
+ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2'
+;facteur d'echelle vertical  for partial steps
+e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc')
+SIGMAsed=read_ncdf('cond_sed',0,/timestep,/nostruct,/tout,filename=file_Sed,/cont_nofill)
+;BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br)
+BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill)
+
+
+
+
+; vertical integration:
+e3t3d=make_array(jpi,jpj,jpk)   
+        for k=0, jpk-1 do begin              &$
+          for j=0,jpj-1 do begin              &$      
+            for i=0,jpi-1 do begin             &$
+              e3t3d(i,j,k) = e3t(k)    &$
+            endfor                     &$
+          endfor                      &$
+        endfor
+jpt = 73
+
+;vud = make_array(jpi,jpj,jpt)   
+;vvd = make_array(jpi, jpj, jpt)
+divBustar = make_array(jpi, jpj, jpt)
+diver3=replicate(0.,182,149,1,73)
+sigma3=replicate(0.,182,149,1,73)
+
+
+FOR jt = 0, jpt-1 DO BEGIN &$   
+
+; ouverture des fichiers et stockage en memoire partial steps
+  vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$   
+;stop
+  vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$   
+;stop
+; lecture salinite & temperature
+  temp= read_ncdf('votemper',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T)
+;stop
+  salin=read_ncdf('vosaline',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T)
+;stop
+  conduct=0.02047780622061 + 0.00273147624197*temp + 0.00035133182334*temp*temp + 0.09139808809909*salin + 0.00241425798890*salin*temp -0.00023998958774*salin*salin
+  mask_t=where(conduct GT 1.e+19)
+  conduct(mask_t)=0.
+; Somme conduct au point T
+
+
+; Calcul SIGMA
+
+  SIGMAoc=total(conduct*e3t3d*tmask,3)
+  SIGMA=SIGMAsed+SIGMAoc
+
+
+
+  SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2.
+
+  SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2.
+
+; Calcul B en points u et v
+
+  BR_u=(BR+shift(BR,-1,0))/2.
+
+  BR_v=(BR+shift(BR,0,1))/2.
+
+
+; Calcul integrale conduct
+
+  conduct_u=(conduct+shift(conduct,-1,0,0))/2.
+
+  conduct_v=(conduct+shift(conduct,0,1,0))/2.
+  
+  u_cond_u=total( vu*conduct_u*e3u3d*umask(),3)
+
+  v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3)
+
+
+  Bu_star= BR_u*u_cond_u/SIGMA_u
+
+  Bv_star= BR_v*v_cond_v/SIGMA_v
+
+; Divergence du champ
+
+  Diver=divfred(Bu_star,Bv_star)
+
+Diver=Diver*1e-6
+;stop
+lecontinent=where(Diver GT 1.E08)
+Diver(lecontinent)=0.
+
+
+
+;stop
+;bande de recouvrement::
+
+diver3(1:180,0:147,*,jt)=Diver(*,*)
+diver3(0,*,*,*)=diver3(180,*,*,*)
+diver3(181,*,*,*)=diver3(1,*,*,*)
+
+sigma3(1:180,0:147,*,jt)=SIGMA(*,*)
+sigma3(0,*,*,*)=sigma3(180,*,*,*)
+sigma3(181,*,*,*)=sigma3(1,*,*,*)
+
+
+print,  jt
+
+
+ENDFOR  
+; on ferme le NetCDF
+;NCDF_CLOSE,id3
+;NCDF_CLOSE,id4
+
+
+
+
+temps=fltarr(73)
+temps(0)=0.
+for jt=0,71 do begin &$
+temps(jt+1)=temps(jt) +5*86400. &$
+endfor
+print,temps
+
+   vargrid = 'T'
+   iodir = '/usr/work/sur/fvi/OPA/ORCA2/'
+; Nom
+   idout = NCDF_CREATE(iodir+'DivBustar_5d_'+iyear+'_grid_T.nc',/clobber)
+   print, 'Creation du fichier Netcdf'
+   NCDF_CONTROL, idout, /nofill
+; Dimension
+   xidout = NCDF_DIMDEF(idout, 'x',jpiglo)
+   yidout = NCDF_DIMDEF(idout, 'y',jpjglo)
+   didout = NCDF_DIMDEF(idout, 'deptht',1)
+   tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
+
+   didout1 = NCDF_DIMDEF(idout, 'deptht1',jpk)
+
+
+; Attributs globaux
+   id0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ], /FLOAT)
+   id1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ], /FLOAT)
+   id2  = NCDF_VARDEF(idout, 'deptht'      , [                didout1        ], /FLOAT)
+   id3  = NCDF_VARDEF(idout, 'time_counter', [                        tidout], /FLOAT)
+   id4  = NCDF_VARDEF(idout, 'Diver'  , [xidout, yidout, didout, tidout], /DOUBLE)
+
+; Variable 0
+   NCDF_ATTPUT, idout, id0, 'units', 'degrees_east'
+   NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude'
+   NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid'
+; Variable 1
+   NCDF_ATTPUT, idout, id1, 'units', 'degrees_north'
+   NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude'
+   NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid'
+; Variable 2
+   NCDF_ATTPUT, idout, id2, 'units','meters'
+   NCDF_ATTPUT, idout, id2, 'long_name','Depth'
+   NCDF_ATTPUT, idout, id2, 'nav_model','Default grid'
+; Variable3
+   NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-01 00:00:00 '
+   NCDF_ATTPUT, idout, id3, 'calendar','noleap'
+   NCDF_ATTPUT, idout, id3, 'title', 'Time'
+   NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis'
+   NCDF_ATTPUT, idout, id3, 'time_origin','0001-JAN-01 00:00:00'
+; Variables
+   NCDF_ATTPUT, idout, id4, 'long_name', 'Divergence'
+
+
+   NCDF_CONTROL, idout, /ENDEF
+
+; Creation de la longitude
+   NCDF_VARPUT, idout, id0, glamt
+; Creation de la latitude
+   NCDF_VARPUT, idout, id1, gphit
+; Creation de la profondeur 
+   NCDF_VARPUT, idout, id2, gdept 
+; Creation du calendrier
+
+   NCDF_VARPUT, idout, id3, temps
+
+   
+; Ecriture des donnees
+
+; ecriture des glam_8 
+   NCDF_VARPUT, idout, id4 , diver3
+
+   NCDF_CLOSE, idout
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;meme topo pour SIGMA
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+  idout = NCDF_CREATE(iodir+'Sigma_5d_'+iyear+'_grid_T.nc',/clobber)
+   print, 'Creation du fichier Netcdf'
+   NCDF_CONTROL, idout, /nofill
+; Dimension
+   xidout = NCDF_DIMDEF(idout, 'x',jpiglo)
+   yidout = NCDF_DIMDEF(idout, 'y',jpjglo)
+   didout = NCDF_DIMDEF(idout, 'deptht',1)
+   tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
+
+   didout1 = NCDF_DIMDEF(idout, 'deptht1',jpk)
+
+
+; Attributs globaux
+   id0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ], /FLOAT)
+   id1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ], /FLOAT)
+   id2  = NCDF_VARDEF(idout, 'deptht'      , [                didout1        ], /FLOAT)
+   id3  = NCDF_VARDEF(idout, 'time_counter', [                        tidout], /FLOAT)
+   id4  = NCDF_VARDEF(idout, 'Sigma'  , [xidout, yidout, didout, tidout], /DOUBLE)
+
+; Variable 0
+   NCDF_ATTPUT, idout, id0, 'units', 'degrees_east'
+   NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude'
+   NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid'
+; Variable 1
+   NCDF_ATTPUT, idout, id1, 'units', 'degrees_north'
+   NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude'
+   NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid'
+; Variable 2
+   NCDF_ATTPUT, idout, id2, 'units','meters'
+   NCDF_ATTPUT, idout, id2, 'long_name','Depth'
+   NCDF_ATTPUT, idout, id2, 'nav_model','Default grid'
+; Variable3
+   NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-01 00:00:00 '
+   NCDF_ATTPUT, idout, id3, 'calendar','noleap'
+   NCDF_ATTPUT, idout, id3, 'title', 'Time'
+   NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis'
+   NCDF_ATTPUT, idout, id3, 'time_origin','0001-JAN-01 00:00:00'
+; Variables
+   NCDF_ATTPUT, idout, id4, 'long_name', 'Total Conductance'
+
+
+   NCDF_CONTROL, idout, /ENDEF
+
+; Creation de la longitude
+   NCDF_VARPUT, idout, id0, glamt
+; Creation de la latitude
+   NCDF_VARPUT, idout, id1, gphit
+; Creation de la profondeur 
+   NCDF_VARPUT, idout, id2, gdept 
+; Creation du calendrier
+
+   NCDF_VARPUT, idout, id3, temps
+
+   
+; Ecriture des donnees
+
+; ecriture des glam_8 
+   NCDF_VARPUT, idout, id4 , sigma3
+
+   NCDF_CLOSE, idout
+
+
+END
Index: /trunk/fsxspp.pro
===================================================================
--- /trunk/fsxspp.pro	(revision 2)
+++ /trunk/fsxspp.pro	(revision 2)
@@ -0,0 +1,12 @@
+;
+;  fsnspp: north stereographic polar projection
+;
+FUNCTION fsxspp, plam, pphi
+;
+rpi = double( 2.*asin( 1. ))
+rad = double( rpi/180.)
+;
+z = double( 2. * cos( rad*plam ) * tan( rpi/4. - rad*pphi/2. ))
+;
+return, z
+END 
Index: /trunk/fsyspp.pro
===================================================================
--- /trunk/fsyspp.pro	(revision 2)
+++ /trunk/fsyspp.pro	(revision 2)
@@ -0,0 +1,12 @@
+;
+;  fsnspp: north stereographic polar projection
+;
+FUNCTION fsyspp, plam, pphi
+;
+rpi = double( 2.*asin( 1. ))
+rad = double( rpi/180.)
+;
+z = double( 2. * sin( rad*plam ) * tan( rpi/4. - rad*pphi/2. ))
+;
+return, z
+END 
Index: /trunk/grad.pro
===================================================================
--- /trunk/grad.pro	(revision 2)
+++ /trunk/grad.pro	(revision 2)
@@ -0,0 +1,259 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:
+;
+; PURPOSE:
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:
+; 
+; INPUTS:
+;
+; KEYWORD PARAMETERS:
+;
+; OUTPUTS:
+;
+; COMMON BLOCKS:common.pro
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION grad, field, direc
+@common
+;------------------------------------------------------------
+   res = litchamp(field)
+   taille=size(res)
+   grille, mask, glam, gphi, gdep, nx, ny,nz,premierx,premiery,premierz,dernierx, derniery, dernierz     
+   if n_elements(valmask) EQ 0 then valmask = 1e20
+   case strupcase(vargrid) of
+      'T':BEGIN
+         case direc of
+            'x':BEGIN 
+               divi = e1u[premierx:dernierx, premiery:derniery]
+               newmask = (umask())[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'U'
+               domdef, glamt[premierx, 0], glamu[dernierx, 0] $
+                , gphit[0, premiery], gphiu[0, derniery], grille = ['T','U']
+            END
+            'y':BEGIN
+               divi = e2v[premierx:dernierx, premiery:derniery]
+               newmask = (vmask())[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'V'
+               domdef, glamt[premierx, 0], glamv[dernierx, 0] $
+                , gphit[0, premiery], gphiv[0, derniery], grille = ['T','V']
+            END
+            'z':BEGIN
+               divi = e3w[premierz:dernierz]
+               newmask = mask
+               vargrid = 'W'
+            END
+            ELSE:return, report('Bad definition of direction argument')
+         ENDCASE
+      END
+      'W':BEGIN
+         case direc of
+            'x':divi = e1u[premierx:dernierx, premiery:derniery]
+            'y':divi = e2v[premierx:dernierx, premiery:derniery]
+            'z':BEGIN
+               divi = e3t[premierz:dernierz]
+               newmask = mask
+               vargrid = 'T'
+            END
+            ELSE:return, report('Bad definition of direction argument')
+         endcase
+      END
+      'U':BEGIN
+         case direc of
+            'x':BEGIN
+               divi = (shift(e1t, -1, 0))[premierx:dernierx, premiery:derniery]
+               newmask = tmask[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'T'
+               domdef, glamt[premierx, 0], glamu[dernierx] $
+                , gphit[0, premiery], gphiu[0, derniery], grille = ['T','U']
+            END
+            'y':BEGIN
+               divi = e2f[premierx:dernierx, premiery:derniery]
+               newmask = (fmask())[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'F'
+               domdef, glamu[premierx, 0], glamf[dernierx, 0] $
+                , gphiu[0, premiery], gphif[0, derniery], grille = ['U','F']
+            END
+            'z':BEGIN
+               divi = e3w[premierz:dernierz]
+               newmask = mask
+               vargrid = 'W'
+            END
+            ELSE:return, report('Bad definition of direction argument')
+         endcase
+      END
+      'V':BEGIN
+         case direc of
+            'x':BEGIN
+               divi = e1f[premierx:dernierx, premiery:derniery]
+               newmask = (fmask())[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'F'
+               domdef, glamv[premierx, 0], glamf[dernierx, 0] $
+                , gphiv[0, premiery], gphif[0, derniery], grille = ['V','F']
+            END
+            'y':BEGIN
+               divi = (shift(e2t, 0, -1))[premierx:dernierx, premiery:derniery]
+               newmask = tmask[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'T'
+               domdef, glamt[premierx, 0], glamv[dernierx, 0] $
+                , gphit[0, premiery], gphiv[0, derniery], grille = ['T','V']
+            END
+            'z':BEGIN
+               divi = e3w[premierz:dernierz]
+               newmask = mask
+               vargrid = 'W'
+            END
+            ELSE:return, report('Bad definition of direction argument')
+         endcase
+      END
+;       'F':BEGIN
+;          case direc of
+;             'x':divi = (shift(e1v, -1, 0))[premierx:dernierx, premiery:derniery]
+;             'y':divi = (shift(e2u, 0, -1))[premierx:dernierx, premiery:derniery]
+;             'z':divi = e3w[premierz:dernierz]
+;             ELSE:return, report('Bad definition of direction argument')
+;          endcase
+;       END
+      ELSE:return, report('Bad definition of vargrid')
+   ENDCASE
+   res = fitintobox(res)
+   case 1 of
+;----------------------------------------------------------------------------
+;xy
+;----------------------------------------------------------------------------
+      taille[0] EQ 2:BEGIN
+         earth = where(mask[*, *, premierz] EQ 0)
+         if earth[0] NE -1 then res[earth] = !values.f_nan
+         case direc of
+            'x':BEGIN 
+               res = (shift(res, -1, 0)-res)/divi
+               if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0)
+            END
+            'y':BEGIN 
+               res = (shift(res, 0, -1)-res)/divi
+               res[*, ny-1] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'U' then res =   shift(res, 0, 1)           
+            END
+            ELSE:return,  report('Bad definition of direction argument for the type of array')
+         ENDCASE
+         earth = where(newmask[*, *, premierz] EQ 0)
+         if earth[0] NE -1 then res[earth] = valmask
+      END
+;----------------------------------------------------------------------------
+;xyt
+;----------------------------------------------------------------------------
+      taille[0] EQ 3 AND jpt NE 1:BEGIN
+         earth = where(mask[*, *, premierz] EQ 0)
+         if earth[0] NE -1 then BEGIN
+            earth = earth#replicate(1, jpt)+replicate(1, n_elements(earth))#(nx*ny*lindgen(jpt))
+            res[earth[*]] = !values.f_nan
+         ENDIF
+         divi = divi[*]#replicate(1, jpt)
+         case direc of
+            'x':BEGIN 
+               res = (shift(res, -1, 0, 0)-res)/divi
+               if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'V'  then res = shift(res, 1, 0, 0)
+            END
+            'y':BEGIN 
+               res = (shift(res, 0, -1, 0)-res)/divi
+               res[*, ny-1, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'U'  then res = shift(res, 0, 1, 0)        
+            END
+            ELSE:return,  report('Bad definition of direction argument for the type of array')
+         ENDCASE
+         earth = where(newmask[*, *, premierz] EQ 0)
+         if earth[0] NE -1 then BEGIN 
+            earth = earth#replicate(1, jpt)+replicate(1, n_elements(earth))#(nx*ny*lindgen(jpt))
+            res[earth] = valmask
+         ENDIF
+      END
+;----------------------------------------------------------------------------
+;xyz
+;----------------------------------------------------------------------------
+      taille[0] EQ 3 AND jpt EQ 1:BEGIN
+         earth = where(mask EQ 0)
+         if earth[0] NE -1 then res[earth] = !values.f_nan
+         case direc OF
+            'x':BEGIN 
+               divi = divi[*]#replicate(1, nz)
+               res = (shift(res, -1, 0, 0)-res)/divi
+               if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0, 0)
+            END
+            'y':BEGIN 
+               divi = divi[*]#replicate(1, nz)
+               res = (shift(res, 0, -1, 0)-res)/divi
+               res[*, ny-1, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'U'  then res = shift(res, 0, 1, 0)        
+            END
+            'z':BEGIN
+               divi = reform(replicate(1, nx*ny)#divi, nx, ny, nz)
+               if nx EQ 1 OR ny EQ 1 then res = reform(res, nx, ny, nz)
+               if vargrid EQ 'W' THEN BEGIN 
+                  res = (shift(res, 0, 0, 1)-res)/divi
+                  res[*, *, 0] = !values.f_nan
+               ENDIF ELSE BEGIN
+                  res = (res-shift(res, 0, 0, -1))/divi
+                  res[*, *, nz-1] = !values.f_nan
+               ENDELSE
+               if earth[0] NE -1 then res[earth] = valmask
+            END
+         ENDCASE
+      END
+;------------------------------------------------------------
+;----------------------------------------------------------------------------
+;xyzt
+;----------------------------------------------------------------------------
+      taille[0] EQ 4:BEGIN
+         earth = where((mask[*]#replicate(1, jpt)) EQ 0)
+         if earth[0] NE -1 then res[earth] = !values.f_nan
+         case direc OF
+            'z':BEGIN
+               divi = replicate(1, nx*ny)#divi
+               divi = reform(divi[*]#replicate(1, jpt), nx, ny, nz, jpt, /over)
+               if nx EQ 1 OR ny EQ 1 then res = reform(res, nx, ny, nz, jpt)
+               if vargrid EQ 'W' THEN BEGIN 
+                  res = (shift(res, 0, 0, 1, 0)-res)/divi
+                  res[*, *, 0, *] = !values.f_nan
+               ENDIF ELSE BEGIN
+                  res = (res-shift(res, 0, 0, -1, 0))/divi
+                  res[*, *, nz-1, *] = !values.f_nan
+               ENDELSE
+               if earth[0] NE -1 then res[earth] = valmask
+            END
+         ENDCASE
+      END
+;------------------------------------------------------------
+;------------------------------------------------------------
+   endcase
+   varname = 'grad of '+varname
+   varunit = varunit+'/m'
+
+
+;------------------------------------------------------------
+   return, res
+end
+
+
+
+
+
+
Index: /trunk/gradfred.pro
===================================================================
--- /trunk/gradfred.pro	(revision 2)
+++ /trunk/gradfred.pro	(revision 2)
@@ -0,0 +1,259 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:
+;
+; PURPOSE:
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:
+; 
+; INPUTS:
+;
+; KEYWORD PARAMETERS:
+;
+; OUTPUTS:
+;
+; COMMON BLOCKS:common.pro
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION grad, field, direc
+@common
+;------------------------------------------------------------
+   res = litchamp(field)
+   taille=size(res)
+   grille, mask, glam, gphi, gdep, nx, ny,nz,premierx,premiery,premierz,dernierx, derniery, dernierz     
+   if n_elements(valmask) EQ 0 then valmask = 1e20
+   case strupcase(vargrid) of
+      'T':BEGIN
+         case direc of
+            'x':BEGIN 
+               divi = e1u[premierx:dernierx, premiery:derniery]
+               newmask = (umask())[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'U'
+               domdef, glamt[premierx, 0], glamu[dernierx, 0] $
+                , gphit[0, premiery], gphiu[0, derniery], grille = ['T','U']
+            END
+            'y':BEGIN
+               divi = e2v[premierx:dernierx, premiery:derniery]
+               newmask = (vmask())[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'V'
+               domdef, glamt[premierx, 0], glamv[dernierx, 0] $
+                , gphit[0, premiery], gphiv[0, derniery], grille = ['T','V']
+            END
+            'z':BEGIN
+               divi = e3w[premierz:dernierz]
+               newmask = mask
+               vargrid = 'W'
+            END
+            ELSE:return, report('Bad definition of direction argument')
+         ENDCASE
+      END
+      'W':BEGIN
+         case direc of
+            'x':divi = e1u[premierx:dernierx, premiery:derniery]
+            'y':divi = e2v[premierx:dernierx, premiery:derniery]
+            'z':BEGIN
+               divi = e3t[premierz:dernierz]
+               newmask = mask
+               vargrid = 'T'
+            END
+            ELSE:return, report('Bad definition of direction argument')
+         endcase
+      END
+      'U':BEGIN
+         case direc of
+            'x':BEGIN
+               divi = (shift(e1t, -1, 0))[premierx:dernierx, premiery:derniery]
+               newmask = tmask[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'T'
+               domdef, glamt[premierx, 0], glamu[dernierx] $
+                , gphit[0, premiery], gphiu[0, derniery], grille = ['T','U']
+            END
+            'y':BEGIN
+               divi = e2f[premierx:dernierx, premiery:derniery]
+               newmask = (fmask())[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'F'
+               domdef, glamu[premierx, 0], glamf[dernierx, 0] $
+                , gphiu[0, premiery], gphif[0, derniery], grille = ['U','F']
+            END
+            'z':BEGIN
+               divi = e3w[premierz:dernierz]
+               newmask = mask
+               vargrid = 'W'
+            END
+            ELSE:return, report('Bad definition of direction argument')
+         endcase
+      END
+      'V':BEGIN
+         case direc of
+            'x':BEGIN
+               divi = e1f[premierx:dernierx, premiery:derniery]
+               newmask = (fmask())[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'F'
+               domdef, glamv[premierx, 0], glamf[dernierx, 0] $
+                , gphiv[0, premiery], gphif[0, derniery], grille = ['V','F']
+            END
+            'y':BEGIN
+               divi = (shift(e2t, 0, -1))[premierx:dernierx, premiery:derniery]
+               newmask = tmask[premierx:dernierx, premiery:derniery, premierz:dernierz]
+               vargrid = 'T'
+               domdef, glamt[premierx, 0], glamv[dernierx, 0] $
+                , gphit[0, premiery], gphiv[0, derniery], grille = ['T','V']
+            END
+            'z':BEGIN
+               divi = e3w[premierz:dernierz]
+               newmask = mask
+               vargrid = 'W'
+            END
+            ELSE:return, report('Bad definition of direction argument')
+         endcase
+      END
+;       'F':BEGIN
+;          case direc of
+;             'x':divi = (shift(e1v, -1, 0))[premierx:dernierx, premiery:derniery]
+;             'y':divi = (shift(e2u, 0, -1))[premierx:dernierx, premiery:derniery]
+;             'z':divi = e3w[premierz:dernierz]
+;             ELSE:return, report('Bad definition of direction argument')
+;          endcase
+;       END
+      ELSE:return, report('Bad definition of vargrid')
+   ENDCASE
+   res = fitintobox(res)
+   case 1 of
+;----------------------------------------------------------------------------
+;xy
+;----------------------------------------------------------------------------
+      taille[0] EQ 2:BEGIN
+         earth = where(mask[*, *, premierz] EQ 0)
+         if earth[0] NE -1 then res[earth] = !values.f_nan
+         case direc of
+            'x':BEGIN 
+               res = (shift(res, -1, 0)-res)/divi
+               if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0)
+            END
+            'y':BEGIN 
+               res = (shift(res, 0, -1)-res)/divi
+               res[*, ny-1] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'U' then res =   shift(res, 0, 1)           
+            END
+            ELSE:return,  report('Bad definition of direction argument for the type of array')
+         ENDCASE
+         earth = where(newmask[*, *, premierz] EQ 0)
+         if earth[0] NE -1 then res[earth] = valmask
+      END
+;----------------------------------------------------------------------------
+;xyt
+;----------------------------------------------------------------------------
+      taille[0] EQ 3 AND jpt NE 1:BEGIN
+         earth = where(mask[*, *, premierz] EQ 0)
+         if earth[0] NE -1 then BEGIN
+            earth = earth#replicate(1, jpt)+replicate(1, n_elements(earth))#(nx*ny*lindgen(jpt))
+            res[earth[*]] = !values.f_nan
+         ENDIF
+         divi = divi[*]#replicate(1, jpt)
+         case direc of
+            'x':BEGIN 
+               res = (shift(res, -1, 0, 0)-res)/divi
+               if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'V'  then res = shift(res, 1, 0, 0)
+            END
+            'y':BEGIN 
+               res = (shift(res, 0, -1, 0)-res)/divi
+               res[*, ny-1, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'U'  then res = shift(res, 0, 1, 0)        
+            END
+            ELSE:return,  report('Bad definition of direction argument for the type of array')
+         ENDCASE
+         earth = where(newmask[*, *, premierz] EQ 0)
+         if earth[0] NE -1 then BEGIN 
+            earth = earth#replicate(1, jpt)+replicate(1, n_elements(earth))#(nx*ny*lindgen(jpt))
+            res[earth] = valmask
+         ENDIF
+      END
+;----------------------------------------------------------------------------
+;xyz
+;----------------------------------------------------------------------------
+      taille[0] EQ 3 AND jpt EQ 1:BEGIN
+         earth = where(mask EQ 0)
+         if earth[0] NE -1 then res[earth] = !values.f_nan
+         case direc OF
+            'x':BEGIN 
+               divi = divi[*]#replicate(1, nz)
+               res = (shift(res, -1, 0, 0)-res)/divi
+               if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0, 0)
+            END
+            'y':BEGIN 
+               divi = divi[*]#replicate(1, nz)
+               res = (shift(res, 0, -1, 0)-res)/divi
+               res[*, ny-1, *] = !values.f_nan
+               if vargrid EQ 'T' OR vargrid EQ 'U'  then res = shift(res, 0, 1, 0)        
+            END
+            'z':BEGIN
+               divi = reform(replicate(1, nx*ny)#divi, nx, ny, nz)
+               if nx EQ 1 OR ny EQ 1 then res = reform(res, nx, ny, nz)
+               if vargrid EQ 'W' THEN BEGIN 
+                  res = (shift(res, 0, 0, 1)-res)/divi
+                  res[*, *, 0] = !values.f_nan
+               ENDIF ELSE BEGIN
+                  res = (res-shift(res, 0, 0, -1))/divi
+                  res[*, *, nz-1] = !values.f_nan
+               ENDELSE
+               if earth[0] NE -1 then res[earth] = valmask
+            END
+         ENDCASE
+      END
+;------------------------------------------------------------
+;----------------------------------------------------------------------------
+;xyzt
+;----------------------------------------------------------------------------
+      taille[0] EQ 4:BEGIN
+         earth = where((mask[*]#replicate(1, jpt)) EQ 0)
+         if earth[0] NE -1 then res[earth] = !values.f_nan
+         case direc OF
+            'z':BEGIN
+               divi = replicate(1, nx*ny)#divi
+               divi = reform(divi[*]#replicate(1, jpt), nx, ny, nz, jpt, /over)
+               if nx EQ 1 OR ny EQ 1 then res = reform(res, nx, ny, nz, jpt)
+               if vargrid EQ 'W' THEN BEGIN 
+                  res = (shift(res, 0, 0, 1, 0)-res)/divi
+                  res[*, *, 0, *] = !values.f_nan
+               ENDIF ELSE BEGIN
+                  res = (res-shift(res, 0, 0, -1, 0))/divi
+                  res[*, *, nz-1, *] = !values.f_nan
+               ENDELSE
+               if earth[0] NE -1 then res[earth] = valmask
+            END
+         ENDCASE
+      END
+;------------------------------------------------------------
+;------------------------------------------------------------
+   endcase
+   varname = 'grad of '+varname
+   varunit = varunit+'/m'
+
+
+;------------------------------------------------------------
+   return, res
+end
+
+
+
+
+
+
Index: /trunk/idlsave.pro
===================================================================
--- /trunk/idlsave.pro	(revision 2)
+++ /trunk/idlsave.pro	(revision 2)
@@ -0,0 +1,1724 @@
+; IDL Version 5.5a (linux x86)
+; Journal File for fvi@leto.lodyc.jussieu.fr
+; Working directory: /.autofs/work/sur/fvi/OPA/geomag
+; Date: Tue Dec 16 15:48:01 2003
+ 
+plt, Diver
+plt, Diver
+; % CONTOUR: Expression must be an array in this context: TRINAN.
+retall
+help, Diver
+.r forcagequimarche
+forcagequimarche,'1993','01'
+;ESS_5d_010101_011231_grid_U.nc
+;ESS_5d_010101_011231_grid_V.nc
+;ESS_5d_010101_011231_grid_T.nc
+xhelp,'tvplus'
+?tvplus
+tvscl,Diver
+; % Program caused arithmetic error: Floating illegal operand
+help, Diver
+Diver=Diver*1e8
+for jj=0,147 do begin &$
+  for ji=0,179 do begin &$
+   if( Diver(ji,jj) GT 1e10 ) then begin &$ 
+	Diver(ji,jj) = 0. &$
+   endif &$
+  endfor &$
+endfor 
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+; % Program caused arithmetic error: Floating illegal operand
+help, Diver
+tvplus, Diver
+;Bouton de gauche: position du curseur et valeur du tableau en ce point
+;Bouton du milieu: zoom
+;Bouton de droite: quitter
+;position: x=102, y= 83 valeur: NaN
Index: /trunk/init2.pro
===================================================================
--- /trunk/init2.pro	(revision 2)
+++ /trunk/init2.pro	(revision 2)
@@ -0,0 +1,133 @@
+; on lance l''aide en ligne
+
+;?
+
+;
+; partie a modifier
+;
+
+;----------------------------------------------------------
+; extension du path pour les scripts init, initgrille (ds HOME) et xxx (ds PACKAGE/WIDGET)
+
+;path smasson:
+;!path=expand_path('+/usr1/com/smasson/IDL')+':'+expand_path('+/usr1/com/smasson/IDL_RD')+':'+expand_path('+'+!dir)
+
+
+;!path=expand_path('+/home/rech/eee/reee421/IDL/HOME')+':'+expand_path('+/home/rech/eee/reee217/IDL_RD')+':'+expand_path('+'+!dir)
+;@common
+
+!path=expand_path('+/usr/work/sur/fvi/IDL')+':'+expand_path('+/usr/work/sur/fvi/IDL_RDD')+':'+expand_path('+'+!dir)
+@common
+
+;----------------------------------------------------------
+; pour l''impression si vous utilisez imprime depuis le lodyc,
+; l''ipsl, l''idris.
+
+
+
+loginlodyc='fvi'
+machlodyc = 'leto'
+
+;----------------------------------------------------------
+; definition de differentes directories
+;----------------------------------------------------------
+
+
+
+homedir = '/usr/work/sur/fvi/OPA/geomag/'
+iodir = '/usr/work/sur/fvi/OPA/ORCA2/'
+animdir =iodir 
+psdir = '/usr/work/sur/fvi/IDL/IDL_PS/'
+imagedir = iodir
+;
+; fin de la partie a modifier
+;
+
+;----------------------------------------------------------
+; environnement graphique (window et ps)
+;----------------------------------------------------------
+if (((!D.Name EQ 'X') OR (!D.NAME EQ 'MAC')) $
+AND (!D.N_Colors GE 256L)) then $
+DEVICE, True_Color=24, decompose=0 $
+else begin & window, colors=100 & wdelete & $
+device, pseudo_color=8 & endelse
+;
+;window, colors=100 & wdelete
+;if !d.n_colors gt 256 then device, decomposed = 0 $
+;ELSE device, pseudo_color=8
+
+
+loadct,39
+tvlct, rouge,vert,bleu, /get
+coefpalit= 1
+key_portrait = 0
+
+;----------------------------------------------------------
+c_lab=0
+c_cote=0
+c_cont = (!d.n_colors-1) < 255
+;----------------------------------------------------------
+ grandfeuille = 29.7
+ petitfeuille = 21.
+ ccwindowsize = 0.99
+
+
+;----------------------------------------------------------
+!except = 2
+sauveps = 0
+;--------------------------------------------------------
+;   definition par defaut du fichier que l''on traite
+;------------------------------------------------------
+year=1
+month=1
+day=1
+niveau=1
+
+;
+prefix=' '
+;
+vargrid = 'T'
+varname = ' '
+vardate= '0'
+varexp = ' '
+varunit = ' '
+;----------------------------------------------------------
+;----------------------------------------------------------
+jpiglo = 1
+jpjglo = 1
+jpkglo = 1
+jpidta = jpiglo
+jpjdta = jpjglo
+jpkdta = jpjglo
+jpi = 1
+jpj = 1
+jpk = 1
+jpt = 1
+ixminmesh  =-1
+ixmaxmesh  =-1
+iyminmesh  =-1
+iymaxmesh  =-1
+izminmesh  =-1
+izmaxmesh  =-1
+ixmindta = 0
+ixmaxdta = jpidta-1
+iymindta = 0
+iymaxdta = jpjdta-1
+izmindta = 0
+izmaxdta = jpkdta-1
+key_shift = 0
+key_periodique = 0
+ccmeshparameters ={filename:'No File', filetype:'nothing' $
+, jpiglo:jpiglo, jpjglo:jpjglo, jpkglo:jpkglo $
+, jpi:jpi, jpj:jpj, jpk:jpk $
+, ixminmesh:ixminmesh, ixmaxmesh:ixmaxmesh $
+, iyminmesh:iyminmesh, iymaxmesh:iymaxmesh $
+, izminmesh:izminmesh, izmaxmesh:izmaxmesh $
+, key_shift:key_shift, key_periodique:key_periodique $
+, triangulation:0, boundary:[-180, 180]}
+ccreadparameters = {funclec_name:'No File' $
+, jpidta:jpidta, jpjdta:jpjdta, jpkdta:jpkdta $
+, ixmindta:ixmindta, ixmaxdta:ixmaxdta $
+, iymindta:iymindta, iymaxdta:iymaxdta $
+, izmindta:izmindta, izmaxdta:izmaxdta $
+}
Index: /trunk/init_interp.pro
===================================================================
--- /trunk/init_interp.pro	(revision 2)
+++ /trunk/init_interp.pro	(revision 2)
@@ -0,0 +1,44 @@
+;------------------------------------------------------------
+; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
+;			26/5/98
+;------------------------------------------------------------
+
+!path=expand_path('+/usr/home/robin/IDL/FRED/TOOLS/INTERP')+':'+expand_path('+/usr/home/smasson/IDL_RD')+':'+expand_path('+'+!dir)
+;------------------------------------------------------------
+@common
+;--------------------------------------------------------
+;   definition par defaut du fichier que l''on traite
+;------------------------------------------------------
+vargrid = 'T'
+varname = ' '
+vardate= '0'
+varexp = ' '
+varunit = ' '
+;----------------------------------------------------------
+; environnement graphique (window et ps)
+;----------------------------------------------------------
+; travail en batch
+; ****************
+; set_plot, 'z'
+;
+; travail en interactif
+; *********************
+window, colors=100 & wdelete
+if !d.n_colors gt 256 then device,  decomposed = 0 $
+ELSE device, pseudo_color=8
+lct, 37
+c_lab=0
+c_cote=0
+c_cont = (!d.n_colors-1) < 255
+tvlct, rouge,vert,bleu, /get
+coefpalit=.3
+key_portrait = 1
+!except = 2
+;----------------------------------------------------------
+grandfeuille = 29.7
+petitfeuille = 21.
+;----------------------------------------------------------
+;----------------------------------------------------------
+sauveimage = 0
+sauveps = 0
+
Index: /trunk/init_path.pro
===================================================================
--- /trunk/init_path.pro	(revision 2)
+++ /trunk/init_path.pro	(revision 2)
@@ -0,0 +1,63 @@
+;---------------------------------------------------
+; PATHS INITIALISATIONS                            *
+;---------------------------------------------------
+;
+; 1. Directories
+; ==============
+;
+input_dir = '/usr/work/sur/fvi/OPA/geomag/'
+output_dir = '/usr/work/sur/fvi/OPA/geomag/'
+;
+; 2. Input information 
+; ====================
+;
+;  2.1. Data file name
+;  -------------------
+;
+IF keyword_set(nscal) THEN BEGIN 
+data_u_file = 'OMIP_east_west_stress.nc'
+data_v_file = 'OMIP_north_south_stress.nc'
+ENDIF ELSE BEGIN 
+   datafile = 'condmag.nc'
+ENDELSE 
+;
+;  2.2. Data mask file name
+;  ------------------------
+;
+IF keyword_set(key_mask) THEN maskfile = 'tmi99_sst_2x0.5grid.nc'
+;
+;  2.3. Target grid
+;  ----------------
+;
+gridfile = 'meshmask_bab.nc'
+;
+; 3. Output information  
+; =====================
+;
+;  3.1. Output file name
+;  ---------------------
+;
+IF keyword_set(nscal) THEN BEGIN 
+  outputfile_x = 'OMIP_east_west_stress_ORCA_R2_grid_U.nc'
+  outputfile_y = 'OMIP_north_south_stress_ORCA_R2_grid_V.nc'
+ENDIF ELSE BEGIN 
+;   outputfile = 'cond_sed_ORCA2.nc'
+   outputfile = 'Br_ORCA2.nc'
+ENDELSE 
+;
+printf, 40, ''
+IF keyword_set(nscal) THEN BEGIN 
+printf, 40, 'Data input file (x-component) : ', string(input_dir, '/', data_u_file)
+printf, 40, 'Data input file (y-component) : ', string(input_dir, '/', data_v_file)
+ENDIF ELSE BEGIN 
+printf, 40, 'Data input file  : ', string(input_dir, '/', datafile)
+ENDELSE 
+IF keyword_set(key_mask) THEN printf, 40, 'Mask input file  : ', string(input_dir, '/', maskfile)
+IF keyword_set(nscal) THEN BEGIN 
+printf, 40, 'Output file (x-component) : ', string(output_dir, '/', outputfile_x)
+printf, 40, 'Output file (y-component) : ', string(output_dir, '/', outputfile_y)
+ENDIF ELSE BEGIN 
+printf, 40, 'Output file      : ', string(output_dir, '/', outputfile)
+ENDELSE 
+printf, 40, 'Target grid file : ', string(input_dir, '/', gridfile)
+
Index: /trunk/initorca.pro
===================================================================
--- /trunk/initorca.pro	(revision 2)
+++ /trunk/initorca.pro	(revision 2)
@@ -0,0 +1,145 @@
+;------------------------------------------------------------
+; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
+;			26/5/98
+; pris le 25 janvier 99 par Maurice Imbard
+;------------------------------------------------------------
+; appelle de l''aide en ligne
+;------------------------------------------------------------
+?
+;------------------------------------------------------------
+;------------------------------------------------------------
+@common
+;------------------------------------------------------------
+;----------------------------------------------------------
+;----------------------------------------------------------
+; bornes de la grille
+;----------------------------------------------------------
+ixminmesh  =2
+ixmaxmesh  =181
+;
+iyminmesh  =0
+iymaxmesh  =147
+;
+izminmesh  =0
+izmaxmesh  =30
+;
+jptmax = 300
+time = lonarr(jptmax)
+;----------------------------------------------------------
+; bornes pour la lecture des donnees
+;----------------------------------------------------------
+;
+;--------------------------------------------------------
+;   definition par defaut du fichier que l''on traite
+;------------------------------------------------------
+year=1
+month=12
+day=31
+niveau=1
+
+;
+iodir = '/workdir/rech/cli/rcli007/'
+prefix='ST0'
+;
+vargrid = 'T'
+varname = ' '
+vardate= '0'
+varexp = ' '
+varunit = ' '
+;
+;-------------------------------------------------------
+; lecture de la grille
+;------------------------------------------------------
+ncdf_meshlec, 'meshmask.nc'
+; longitutes in [20,380]
+isign=where(glamt gt 380.)
+glamt(isign) = glamt(isign)-360.
+isign=where(glamu gt 380.)
+glamu(isign) = glamu(isign)-360.
+isign=where(glamv gt 380.)
+glamv(isign) = glamv(isign)-360.
+isign=where(glamf gt 380.)
+glamf(isign) = glamf(isign)-360.
+delvar, isign
+; correction de la position de certains points
+; t
+glamt[170:176, 94] = glamt[170:176, 93]
+gphit[170:176, 94] = gphit[179, 94]
+glamt[179, 98:102] = glamt[178, 100]+1
+gphit[179, 98:102] = gphit[178, 98:102]
+; u
+glamu[170:176, 94] = glamu[170:176, 93]
+gphiu[170:176, 94] = gphiu[179, 94]
+glamu[179, 98:102] = glamu[178, 100]+1
+gphiu[179, 98:102] = gphiu[178, 98:102]
+; v
+glamv[170:176, 94] = glamv[170:176, 93]
+gphiv[170:176, 94] = gphiv[179, 94]
+glamv[179, 98:102] = glamv[178, 100]+1
+gphiv[179, 98:102] = gphiv[178, 98:102]
+; f
+glamf[170:176, 94] = glamf[170:176, 93]
+gphif[170:176, 94] = gphif[179, 94]
+glamf[179, 98:102] = glamf[178, 100]+1
+gphif[179, 98:102] = gphif[178, 98:102]
+; shift de la grille pour qu''elle soit en grande partie comprise
+; entre 20 et 380.
+key_shift = 31
+glamt = shift(glamt,key_shift , 0)
+gphit = shift(gphit,key_shift , 0)
+e1t = shift(e1t, key_shift, 0)
+e2t = shift(e2t,key_shift , 0)
+glamu = shift(glamu, key_shift, 0)
+gphiu = shift(gphiu, key_shift, 0)
+e1u = shift(e1u,key_shift , 0)
+e2u = shift(e2u, key_shift, 0)
+glamv = shift(glamv, key_shift, 0)
+gphiv = shift(gphiv, key_shift, 0)
+e1v = shift(e1v,key_shift , 0)
+e2v = shift(e2v, key_shift, 0)
+glamf = shift(glamf, key_shift, 0)
+gphif = shift(gphif, key_shift, 0)
+e1f = shift(e1f, key_shift , 0)
+e2f = shift(e2f, key_shift, 0)
+tmask = shift(tmask, key_shift, 0,0)
+
+
+;-------------------------------------------------------------
+;irregularmask
+;-------------------------------------------------------------
+domdef
+
+key_periodique = 1
+triangles = triangule()
+
+;----------------------------------------------------------
+; directories
+;----------------------------------------------------------
+; spawn,'echo $home',homedir
+; homedir = homedir[0]+'/'
+; spawn,'echo $workdir',workdir
+; workdir = workdir[0]+'/'
+; spawn,'echo $tmpdir',tmpdir
+; tmpdir = tmpdir[0]+'/'
+;----------------------------------------------------------
+; environnement graphique (window et ps)
+;----------------------------------------------------------
+window, colors=100 & wdelete
+if !d.n_colors gt 256 then device,  decomposed = 0 $
+ELSE device, pseudo_color=8
+loadct,39
+c_lab=0
+c_cote=0
+c_cont = (!d.n_colors-1) < 255
+tvlct, rouge,vert,bleu, /get
+coefpalit=.3
+key_portrait = 0
+!except = 2
+;----------------------------------------------------------
+grandfeuille = 29.7
+petitfeuille = 21.
+;----------------------------------------------------------
+;----------------------------------------------------------
+sauveps = 0
+
+
Index: /trunk/initorca2_bab.pro
===================================================================
--- /trunk/initorca2_bab.pro	(revision 2)
+++ /trunk/initorca2_bab.pro	(revision 2)
@@ -0,0 +1,55 @@
+;
+;
+@common
+;---------------------------------------------------------
+; bornes de la grille
+;----------------------------------------------------------
+;ixminmesh  =2
+;ixmaxmesh  =181
+; ;
+; iyminmesh  =0
+; iymaxmesh  =147
+
+ixminmesh  =1
+ixmaxmesh  =180
+
+;ixminmesh  =0
+;ixmaxmesh  =179
+;
+iyminmesh  =0
+iymaxmesh  =147
+;
+izminmesh  =-1
+izmaxmesh  =-1
+;
+jpt = 1
+time = 0
+;------------------------------------------------------
+; lecture de la grille
+;------------------------------------------------------
+iodir = '/usr/work/sur/fvi/OPA/ORCA2/'
+
+;key_shift = 31
+key_shift = 0
+key_stride = [1, 1, 1]
+ncdf_meshlec, 'meshmask_bab.nc', glamboundary = [20, 380]
+;, glamboundary = [20, 380]
+;,/checkdat
+;-------------------------------------------------------------
+domdef
+;
+key_periodique = 1
+triangles = triangule()
+;----------------------------------------------------------
+; bornes pour la lecture des donnees
+;----------------------------------------------------------
+jpidta = jpiglo
+jpjdta = jpjglo
+jpkdta = jpkglo
+ixmindta = 0
+ixmaxdta = jpidta-1
+iymindta = 0
+iymaxdta = jpjdta-1
+izmindta = 0
+izmaxdta = jpkdta-1
+
Index: /trunk/interp.pro
===================================================================
--- /trunk/interp.pro	(revision 2)
+++ /trunk/interp.pro	(revision 2)
@@ -0,0 +1,446 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: interp.pro
+;
+; PURPOSE: Performs a bilinear or bicubic interpolation on 
+;          data from a regular origin grid to any grid
+
+; CATEGORY: Subroutine
+;
+; CALLING SEQUENCE: interp, znumdta, zdata_name, mask, t, glam, gphi, zresul
+;
+; INPUTS: 
+;
+;          znumdta    : ID of input data file
+;          zdata_name : input data name
+;          mask       : data mask
+;          t          : timestep 
+;          glam       : longitude of target grid
+;          gphi       : latitude  "     "    "   
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: 
+;          zresul : interpolated field
+;
+; COMMON BLOCKS:
+;	common_interp.pro
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 11/99 A. Jouzeau
+;                       04/00 A. Jouzeau, M. Imbard
+;                       08/00 A. Jouzeau
+;                       10/01 R. Hordoir : Added boundary conditions,
+;                       Bug correction, North Pole Problem
+;                       02/02 R. Hordoir : Added North Pole Treatment
+;                       for non coherent winds.
+;                       03/2003 R.Hordoir & Christian Ethe, Irregular
+;                       grid on meridian axis
+;
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+PRO interp, znumdta, zdata_name,zsign, mask, t, glam, gphi, phi_field, zresul
+@common_interp
+   tempsun = systime(1)         ; pour key_performance
+;
+;-------------------------------------------------
+;  BILINEAR OR BICUBIC INTERPOLATION OF A FIELD  *
+;-------------------------------------------------
+;
+;
+; 0. Extracting data at timestep t
+; ================================
+;
+zzresul = fltarr(jpioce, jpjoce, jpkatm)
+zzresul2 = fltarr(jpioce, jpjoce, jpkoce)
+
+FOR jk = 0, jpkatm-1 DO BEGIN 
+
+ 
+   IF keyword_set(ndim) THEN $
+     ncdf_varget, znumdta, zdata_name, zdata, count = [jpiatm, jpjatm, 1, 1], offset = [0, 0, jk, t] ELSE BEGIN
+      IF keyword_set(key_2d) THEN $
+       ncdf_varget, znumdta, zdata_name, zdata, count = [jpiatm, jpjatm, 1], offset = [0, 0, t] ELSE $
+       ncdf_varget, znumdta, zdata_name, zdata, count = [jpiatm, jpjatm,1, 1], offset = [0, 0, 0, t]
+   ENDELSE 
+   
+   zmask = fltarr(jpiatm, jpjatm)
+   zmask = mask(*, *, jk)
+   printf, 40, ''
+   printf, 40, 'Data reading OK'
+   IF keyword_set(key_vari) THEN BEGIN 
+      varid = ncdf_varid(znumdta, zdata_name)
+      ncdf_attget, znumdta, varid, "scale_factor", scale_factor
+      ncdf_attget, znumdta, varid, "add_offset", add_offset
+      
+      printf, 40, ''
+      printf, 40, 'Scale factor and add_offset reading OK'
+   ENDIF 
+; Scale Factor + Add_offset    
+; Modif Fred
+;   zdata=ncdf_lec('/usr/work/sur/fvi/OPA/geomag/condmag.nc',var='cond_sed')
+   zdata=ncdf_lec('/usr/work/sur/fvi/OPA/geomag/condmag.nc',var='Br')
+
+; Fin modif fred
+   zdata = zdata*scale_factor + add_offset
+
+; The data array and its mask are shifted zonally as defined in
+; namelist by lon_shift
+
+   zdata = shift(zdata, lon_shift, 0)
+   zmask = shift(zmask, lon_shift, 0)
+
+;   zdata = double(zdata)
+   IF keyword_set(nreverse) THEN BEGIN 
+      zdata = reverse(zdata, 2)
+      printf, 40, 'Re-arranging data in latitudes : North-South --> South-North'
+   ENDIF
+
+
+;
+; 0.5 Checking Coherence of winds on North Pole
+; =============================================
+;
+    
+    
+
+    IF  keyword_set(nscal) AND keyword_set(north_pole) THEN BEGIN
+
+       IF  zdata_name EQ data_u_name then BEGIN
+          
+
+          zdata_u=zdata
+
+          IF keyword_set(key_2d) THEN $
+          ncdf_varget, numdta_v, data_v_name, zdata_v, count = [jpiatm, jpjatm, 1], offset = [0, 0, t] ELSE $
+          ncdf_varget, numdta_v, data_v_name, zdata_v, count = [jpiatm, jpjatm,1, 1], offset = [0, 0, 0, t]
+
+
+       ENDIF
+
+       IF  zdata_name EQ data_v_name then BEGIN
+          
+
+          zdata_v=zdata
+
+          IF keyword_set(key_2d) THEN $
+          ncdf_varget, numdta_u, data_u_name, zdata_u, count = [jpiatm, jpjatm, 1], offset = [0, 0, t] ELSE $
+          ncdf_varget, numdta_u, data_u_name, zdata_u, count = [jpiatm, jpjatm,1, 1], offset = [0, 0, 0, t]
+
+
+      ENDIF
+
+          ; Check is made here
+         
+          global_vect=replicate(0.,jpiatm,jpjatm,2)
+          
+          global_vect(*,*,0)=zdata_u
+          global_vect(*,*,1)=zdata_v       
+          
+          northwind, global_vect,zdata_name,t
+         
+          zdata_u=global_vect(*,*,0)
+          zdata_v=global_vect(*,*,1)
+
+          ; End check and correction
+
+      ; Puts back corrected value into initial variable
+
+
+       IF  zdata_name EQ data_u_name then BEGIN
+          
+         zdata=zdata_u
+
+       ENDIF
+
+       IF  zdata_name EQ data_v_name then BEGIN
+           
+         zdata=zdata_v
+
+       ENDIF
+
+    ENDIF
+          
+;
+;
+; 1. Applying mask on data and plotting 
+; =====================================
+;
+   val = 1.e20
+   IF keyword_set(nmiss) THEN BEGIN 
+      
+       ind = where(abs(zdata) GE abs(missing_val))
+       IF ind[0] NE -1 then zmask(ind) = 0.
+     
+   ENDIF 
+
+   ind = where(zmask EQ 0.)
+   
+   IF ind[0] NE -1 then  zdata(ind) = val
+
+   ind = where(zmask NE 0.)
+   IF ind[0] NE -1 THEN min = min(zdata(ind)) ELSE BEGIN 
+      min = missing_val
+   ENDELSE 
+   IF ind[0] NE -1 THEN max = max(zdata(ind)) ELSE BEGIN 
+      max = missing_val
+      zdata(*, *) = missing_val
+   ENDELSE 
+   IF t MOD ndraw EQ 0 AND keyword_set(keydraw) AND jk MOD nlevel EQ 0 THEN BEGIN
+      IF keyword_set(key_ps) THEN openps, string(zdata_name, '_controle_iteration_', strtrim(t+1, 2), '.ps')
+      draw, zdata, lonatm, latatm, jpiatm, jpjatm, 1, 1, 3, $
+       TITLE = zdata_name+', iteration = '+strtrim(t+1,1), min, max
+   ENDIF 
+;
+; 2. Extrapolating coastal values on land points
+; ==============================================
+;
+   eps = 0.
+   n = 0
+   tempsun2 = systime(1)        ; pour key_performance
+;
+; ... adding a border to overcome shifting problems 
+;
+   zero = fltarr(jpiatm+2, jpjatm+2)
+   zero[1:jpiatm, 1:jpjatm] = zmask
+   zmask = zero
+   zero = fltarr(jpiatm+2, jpjatm+2)
+   zero[1:jpiatm, 1:jpjatm] = zdata
+   zdata = zero
+
+
+;
+; ... filling 
+;
+
+   if max(zmask) GT 0  then begin
+
+     WHILE n LE nfil AND eps LE 1.e-5 DO BEGIN 
+
+        extrap, zdata, zmask, n, val
+        eps = min(abs(zdata-replicate(val, jpiatm, jpjatm)))
+        n = n+1
+     ENDWHILE
+
+   endif
+;
+; ... recovering values on initial domain
+;
+   zdata = zdata[1:jpiatm, 1:jpjatm]
+   zmask = zmask[1:jpiatm, 1:jpjatm]
+;
+   if keyword_set(key_performance) THEN print, 'temps extrap', systime(1)-tempsun2 
+;  .. drawing
+   IF t MOD ndraw EQ 0 AND keyword_set(keydraw) AND jk MOD nlevel EQ 0 THEN BEGIN 
+      draw, zdata, lonatm, latatm, jpiatm, jpjatm, 1, 2, 3, $
+       TITLE = 'extrapolated '+zdata_name+', iteration = '+strtrim(t+1,1), min, max
+   ENDIF 
+   
+   ind = where(zmask NE 0. AND zdata GE val)
+   IF n_elements(ind) GT 1 THEN BEGIN 
+      print, 'We stop because of insufficient extrapolation on missing values'
+      print, n_elements(ind), ' points non extrapolated'
+      print, 'Increase nfill in naminterp.pro'
+      stop
+   ENDIF  
+
+
+; 3. Treatment of Boundary Conditions
+; ========================================================
+; Treatment of boundary conditions require extra stripes    
+; Size of extra stripe is calculated after a given extension
+; along x and y axis on the OUTPUT grid. iplus and jplus will be
+; the number of extra points required for the extra stripes of the
+; INPUT grid.
+
+
+   iplus=fix((ext_x*pres_x)/mean(dx))
+   jplus=fix((ext_y*pres_y)/mean(abs(phi_field(1:jpjatm/2)-shift(phi_field(1:jpjatm/2),1))))
+
+; Initialisation of array for the northern boundary condition
+   
+   zdata_north=replicate(0.,jpiatm,jpjatm+jplus)
+   zdata_north(*,0:jpjatm-1)=zdata
+   
+; Data of the input grid is duplicated for the northern boundary condition
+
+   zdata_inv=shift(zdata_north(*,jpjatm-1-jplus+1:jpjatm-1),jpiatm/2,0)   
+   
+   zdata_inv=reverse(zdata_inv,2)
+
+   zdata_north(*,jpjatm:jpjatm+jplus-1)=zdata_inv
+
+; Transition to East/West Boundary Conditions
+
+   zdata=zdata_north
+   
+; East/West Boundary Condition, zdata_extend will be the array that
+; contains both northern boundary condition and E/W boundary
+; condition, on the input grid
+
+
+   zdata_extend=replicate(0.,jpiatm+2*iplus,jpjatm+jplus)
+   
+   zdata_extend(iplus:jpiatm-1+iplus,*)=zdata
+   
+   zdata_extend(0:iplus-1,*)=zdata(jpiatm-1-iplus+1:jpiatm-1,*)
+
+   zdata_extend(jpiatm+iplus:jpiatm+2*iplus-1,*)=zdata(0:iplus-1,*)
+   
+;
+; 3.1 Interpolating data on output grid and plotting result
+; =========================================================
+; The interpolation is made bellow. We use the index of the input grid
+; to interpolate which makes we need to convert the latitudes and
+; longitudes of the output grid its dimensions. ext_x*pres_x/dx is added to
+; take into account the extra stripe at the left handside of the input
+; grid
+
+   print, 'Time Step=',t 
+   print, 'Input Level=',jk
+
+
+    glam2 = (glam - west_lon+ext_x*pres_x  )/dx
+    gphi2 = replicate(0.,jpioce,jpjoce)
+
+  
+
+    for ji = 0, jpioce - 1 do begin
+       for  jj = 0, jpjoce - 1 do begin
+           
+
+
+           diff = - gphi(ji,jj)  $          
+                  + phi_field  
+        
+           diff = where( diff GE 0. ) 
+         
+            
+           j_above=min( diff ) 
+                         
+           if diff(0) eq -1 then begin
+             ;   print, 'Output grid goes above input grid latitude top value !!!'
+             ;   print, 'Output grid top value has been take as input grid maximum value'
+             ;   print, 'Please check results at the vicinity of North Pole'
+
+               j_fine = jpjatm-1
+               gphi2(ji,jj) = j_fine
+           endif else begin
+          
+             j_bellow = j_above -1 
+
+              if j_bellow GE 0 then begin
+
+               j_fine  = j_bellow
+
+               if j_above LT jpjatm then begin
+                j_fine = j_bellow+( gphi(ji,jj)-phi_field(j_bellow) )/( phi_field(j_above)-phi_field(j_bellow) )
+               endif
+
+               gphi2(ji,jj) = j_fine 
+               if j_fine GT j_above then stop
+      
+              endif else begin
+
+               j_fine = j_above
+
+               gphi2(ji,jj) = j_fine
+                
+              endelse
+               
+        
+           endelse 
+           
+    endfor
+   endfor
+
+   
+   IF keyword_set(ninterp) THEN BEGIN 
+
+      zresul = interpolate(zdata_extend, glam2, gphi2, cubic = -.5)
+
+   ENDIF ELSE BEGIN 
+  
+      zresul = bilinear(zdata_extend , glam2, gphi2)
+      
+   ENDELSE
+             
+   IF t MOD ndraw EQ 0 AND keyword_set(keydraw) AND jk MOD nlevel EQ 0 THEN BEGIN 
+      draw, zresul, glam, gphi, jpioce, jpjoce, 1, 3, 3, $
+       TITLE = 'interpolated '+zdata_name+', iteration = '+strtrim(t+1,1), min, max
+      IF keyword_set(key_ps) THEN BEGIN 
+         closeps
+      ENDIF ELSE BEGIN 
+         print, 'Press return to continue'
+         zxc = strarr(1)
+         read, zxc
+      ENDELSE 
+   ENDIF 
+   zzresul(*, *, jk) = temporary(zresul)
+ENDFOR 
+zresul = zzresul
+
+;
+; 4. Interpolating data on the vertical axis if the outdept not equal datadept 
+; ===========================================================================
+
+
+IF keyword_set(ndim) THEN BEGIN 
+
+    nlev_flag = WHERE ( datadept(0:jpkatm-1) ne outdept(0:jpkoce-1) )
+    IF nlev_flag(0) NE -1 THEN BEGIN
+        FOR jk = 0, jpkoce-1 DO BEGIN 
+            
+            jn = where(abs(datadept) GE abs(outdept(jk)) $
+                       AND abs(shift(datadept, 1)) LT abs(outdept(jk)))
+    
+    
+            IF min(jn) GE 0 THEN BEGIN 
+
+                ikt=jn-1
+                ikb=jn
+
+                IF jn NE 0 then begin
+                
+                  zt1=abs(outdept(jk))-abs(datadept(ikt))
+                  zt2=abs(datadept(ikb))-abs(outdept(jk))
+                  ztx1=abs(datadept(ikb))-abs(datadept(ikt))
+                  za1=replicate(zt1/ztx1, jpioce, jpjoce)
+                  zb1=replicate(zt2/ztx1, jpioce, jpjoce)
+                  zzresul2(*, *, jk) = temporary(za1*zzresul(*, *, ikb)+zb1*zzresul(*, *, ikt))
+
+                ENDIF ELSE BEGIN
+                  
+                  zzresul2(*, *, jk) = zzresul(*, *, ikb)
+                  
+                ENDELSE  
+
+            ENDIF ELSE BEGIN 
+
+                zzresul2(*, *, jk) = temporary(zzresul2(*, *, jk-1))
+
+            ENDELSE  
+        ENDFOR   
+        zresul = zzresul2
+    ENDIF ELSE BEGIN
+        print, ' '
+        print, 'No need to perform vertical interpolation'
+        print, ' '
+    ENDELSE
+ENDIF 
+
+
+   if keyword_set(key_performance) THEN print, 'temps interp', systime(1)-tempsun 
+
+return
+END  
Index: /trunk/interp_output
===================================================================
--- /trunk/interp_output	(revision 2)
+++ /trunk/interp_output	(revision 2)
@@ -0,0 +1,70 @@
+*******************************************
+*         INTERPOLATION PROGRAM           *
+*******************************************
+
+******************************************
+* USE :                                  *
+* --> Input  grid : Regular              *
+* --> Output grid : Regular or Irregular *
+******************************************
+
+I- Interpolation initialisations
+================================
+
+Field's dimension :
+ --> 2D
+Interpolation of the scalar array : 
+ --> Br
+Type of the interpolation :
+ --> bilinear
+
+II- Paths initialisations
+=========================
+
+Data input file  : /usr/work/sur/fvi/OPA/geomag//condmag.nc
+Output file      : /usr/work/sur/fvi/OPA/geomag//Br_ORCA2.nc
+Target grid file : /usr/work/sur/fvi/OPA/geomag//meshmask_bab.nc
+
+III- Opening data files and reading input mask and output coordinates
+=====================================================================
+
+condmag.nc opening OK
+meshmask_bab.nc opening OK
+
+Coordinates of output grid reading OK
+
+IV- Data mask preprocessing
+===========================
+Re-arranging mask in latitudes : North-South --> South-North
+
+V- Interpolation
+================
+
+ V-1- Writing attributes of interpolated field to file
+ -----------------------------------------------------
+
+Storing coordinates
+
+Storing times and mask
+
+ V-2- Interpolating, correcting and writing field(s)
+ ---------------------------------------------------
+
+ **** ENTERING TEMPORAL LOOP ****
+
+  ***>> TIME ITERATION NUMBER :       1
+
+interpolating Br at t-point
+
+Data reading OK
+Re-arranging data in latitudes : North-South --> South-North
+
+Storing field
+
+**** END OF TEMPORAL LOOP ****
+
+Closing files
+
+*******************************************
+*      END OF INTERPOLATION PROGRAM       *
+*******************************************
Index: /trunk/interpolation.pro
===================================================================
--- /trunk/interpolation.pro	(revision 2)
+++ /trunk/interpolation.pro	(revision 2)
@@ -0,0 +1,368 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: interpolation.pro
+;
+; PURPOSE: Interpolates data from a regular origin grid to any grid
+;
+; CATEGORY: Program
+;
+; CALLING SEQUENCE: interpolation
+;
+; INPUTS: Complete the INIT_PATH and NAMINTERP files	 
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: NetCDF file(s) containing the interpolated field
+;
+; COMMON BLOCKS:
+;	common_interp.pro
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 11/99 A. Jouzeau
+;                       08/00 A. Jouzeau
+;                       01/02 R. Hordoir
+;                       03/2003 R. Hordoir & C. Ethe
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+PRO interpolation
+@common_interp
+   tempsun = systime(1) ; pour key_performance
+print,'***********************************************'
+print,'********** OPA INTERPOLATION PACKAGE **********'
+print,'***********************************************'
+;
+unit = 40
+openw, unit, 'interp_output'
+;
+printf, 40, '*******************************************'
+printf, 40, '*         INTERPOLATION PROGRAM           *'
+printf, 40, '*******************************************'
+printf, 40, ''
+printf, 40, '******************************************'
+printf, 40, '* USE :                                  *'
+printf, 40, '* --> Input  grid : Regular              *'
+printf, 40, '* --> Output grid : Regular or Irregular *'
+printf, 40, '******************************************'
+;
+;--------------------------------------------------
+; INITIALISATIONS                                 *
+;--------------------------------------------------
+;
+printf, 40, ''
+printf, 40, 'I- Interpolation initialisations'
+printf, 40, '================================'
+;
+@naminterp
+;
+printf, 40, ''
+printf, 40, 'II- Paths initialisations'
+printf, 40, '========================='
+;
+@init_path
+
+;
+;--------------------------------------------------- 
+; READING INPUT MASK & OUTPUT COORDINATES          *
+;---------------------------------------------------
+;
+printf, 40, ''
+printf, 40, 'III- Opening data files and reading input mask and output coordinates'
+printf, 40, '====================================================================='
+;
+netcdf_input, mask
+;
+; Coordinates of input grid (for plotting purposes)
+;
+lonatm = fltarr(jpiatm)
+latatm = fltarr(jpjatm)
+FOR i = 0, jpiatm-1 DO BEGIN
+   lonatm(i) = west_lon + i*dx
+ENDFOR
+FOR j = 0, jpjatm-1 DO BEGIN 
+   latatm(j) = phi_input(j)
+ENDFOR 
+;
+;---------------------------------------------------
+; DATA MASK PREPROCESSING                          *
+;---------------------------------------------------
+;
+printf, 40, ''
+printf, 40, 'IV- Data mask preprocessing'
+printf, 40, '==========================='
+;
+IF keyword_set(negmask) THEN BEGIN 
+   mask = abs(temporary(mask))
+   printf, 40, 'Taking the abs of mask (-1 --> +1)'
+ENDIF 
+IF keyword_set(nreverse) THEN BEGIN 
+   mask = reverse(mask, 2)
+   printf, 40, 'Re-arranging mask in latitudes : North-South --> South-North'
+ENDIF 
+ind = where(mask NE 0 AND mask NE 1)
+IF n_elements(ind) NE 1 THEN BEGIN 
+   printf, 40, ''
+   printf, 40, '************************************************************'
+   printf, 40, '* ERROR: data mask file must contain ONLY 0 and 1 values!! *'
+   printf, 40, '************************************************************'
+   printf, 40, ''
+   printf, 40, 'program stops'
+   stop 
+ENDIF 
+IF keyword_set(invmask) THEN BEGIN 
+   mask = inv_mask(mask)
+   printf, 40, 'Giving value = 1 to mask on ocean points '
+ENDIF
+IF keyword_set(extend)  THEN BEGIN
+   mask = preproc_mask(mask)
+   printf, 40, 'Extending mask over one point on ocean points '
+ENDIF
+
+
+; mask = double(mask)
+
+;
+;---------------------------------------------------
+; INTERPOLATION                                    *
+;---------------------------------------------------
+;
+printf, 40, ''
+printf, 40, 'V- Interpolation'
+printf, 40, '================'
+;
+; 0. Creating output file and storing attributes
+; ==============================================
+;
+IF keyword_set(nscal) THEN BEGIN 
+   printf, 40, ''
+   printf, 40, ' V-1- Writing attributes of interpolated field to files'
+   printf, 40, ' ------------------------------------------------------'
+;
+; ... x-component of interpolated field
+   printf, 40, ''
+   printf, 40, 'Writing attributes of x-component of interpolated field'
+   ncdf_varget, nummsh, mask_u_name, umask, count = [jpioce, jpjoce, jpkoce, 1] 
+   netcdf_output, mask_u_name, umask, data_u_name, lon_u, lat_u, outputfile_x, $
+    title_x, long_x_name, POINT = "u", $
+    numout_u, varid_u, numdta_u
+; ... y-component of interpolated field
+   printf, 40, ''
+   printf, 40, 'Writing attributes of y-component of interpolated field'
+   ncdf_varget, nummsh, mask_v_name, vmask, count = [jpioce, jpjoce, jpkoce, 1] 
+   netcdf_output, mask_v_name, vmask, data_v_name, lon_v, lat_v, outputfile_y, $
+    title_y, long_y_name, POINT = "v", $
+    numout_v, varid_v, numdta_v 
+ENDIF ELSE BEGIN 
+   printf, 40, ''
+   printf, 40, ' V-1- Writing attributes of interpolated field to file'
+   printf, 40, ' -----------------------------------------------------'
+;
+   ncdf_varget, nummsh, mask_t_name, tmask, count = [jpioce, jpjoce, jpkoce, 1] 
+   netcdf_output, mask_t_name, tmask, data_name, lon_t, lat_t, outputfile, $
+    title, long_name, POINT = "t", $
+    numout, varid, numdta
+ENDELSE 
+
+
+;
+; 1. Interpolation 
+; ================
+;
+printf, 40, ''
+printf, 40, ' V-2- Interpolating, correcting and writing field(s)'
+printf, 40, ' ---------------------------------------------------'
+printf, 40, ''
+printf, 40, ' **** ENTERING TEMPORAL LOOP ****'
+;
+;  BEGINNING OF TIME LOOP
+;
+IF keyword_set(nscal) THEN BEGIN 
+   mi_u = 1.e20
+   ma_u = -1.e20
+   mi_v = 1.e20
+   ma_v = -1.e20
+ENDIF ELSE BEGIN 
+   mi = 1.e20
+   ma = -1.e20
+ENDELSE
+
+
+FOR t = nit000-1, nitend-1 DO BEGIN 
+   tempsun4 = systime(1)        ; pour key_performance
+   printf, 40, ''
+   printf, 40, '  ***>> TIME ITERATION NUMBER :', t+1
+   IF keyword_set(ndim) THEN BEGIN
+      interp, numdta, data_name,1, mask, t, lon_t, lat_t, phi_input, zresul
+   ENDIF ELSE BEGIN
+      IF keyword_set(nscal) THEN BEGIN
+         printf, 40, 'A vectorial field has been chosen for interpolation'
+         IF keyword_set(north_pole) THEN BEGIN 
+         printf, 40, 'Vectorial Fied will be Tested for Coherence nearby North Pole'
+         ENDIF
+         printf, 40, ''
+         printf, 40, 'interpolating ', data_u_name, ' at u-point and v-point '
+         interp, numdta_u, data_u_name,1, mask, t, lon_u, lat_u, phi_input_u, zresul_uu
+         interp, numdta_u, data_u_name,1, mask, t, lon_v, lat_v, phi_input_u, zresul_uv
+         printf, 40, 'interpolating ', data_v_name, ' at v-point and u-point '
+         interp, numdta_v, data_v_name,1 ,mask, t, lon_v, lat_v, phi_input_v, zresul_vv
+         interp, numdta_v, data_v_name,1,mask, t, lon_u, lat_u,  phi_input_v, zresul_vu
+      ENDIF ELSE BEGIN
+         printf, 40, ''
+         printf, 40, 'interpolating ', data_name, ' at t-point'
+         interp, numdta, data_name, 1,mask, t, lon_t, lat_t, phi_input, zresul
+      ENDELSE 
+   ENDELSE
+
+
+
+;
+; 2. Angles correction for 2D fields                  
+; ==================================
+; 
+   IF keyword_set(nscal) THEN BEGIN 
+      printf, 40, ''
+      printf, 40, ' angles correction'
+;
+      tempsun2 = systime(1)      ; pour key_performance
+      correc_angle, zresul_uu, zresul_uv, zresul_vv, zresul_vu, zresul_u, zresul_v
+      if keyword_set(key_performance) THEN print, 'temps angles', systime(1)-tempsun2 
+      IF t MOD ndraw EQ 0 AND keyword_set(keydraw) THEN BEGIN
+         ncdf_varget, numdta_u, data_u_name, zdata_u, $
+          count = [jpiatm, jpjatm, 1], offset = [0, 0, t]
+         ncdf_varget, numdta_v, data_v_name, zdata_v, $
+          count = [jpiatm, jpjatm, 1], offset = [0, 0, t]
+         zdata_u = zdata_u*scale_factor + add_offset
+         zdata_v = zdata_v*scale_factor + add_offset
+         IF keyword_set(nreverse) THEN zdata_u = reverse(zdata_u, 2)
+         IF keyword_set(nreverse) THEN zdata_v = reverse(zdata_v, 2)
+         zu = zdata_u
+         zv = zdata_v
+         IF keyword_set(nmiss) THEN BEGIN 
+            ind = where(abs(zu) GE missing_val)
+            zu(ind) = 0.
+            ind = where(abs(zv) GE missing_val)
+            zv(ind) = 0.
+         ENDIF 
+         ind = where(mask NE 0.)
+         minu = min(zu(ind))
+         maxu = max(zu(ind))
+         minv = min(zv(ind))
+         maxv = max(zv(ind))
+         IF keyword_set(key_ps) THEN $
+          openps, string('control_corrected_winds_iteration_', strtrim(t+1, 2), '.ps')
+         draw, zdata_u, lonatm, latatm, jpiatm, jpjatm, 2, 1, 2, $
+          TITLE = data_u_name+' data, iteration = '+strtrim(t+1,1), minu, maxu, /land
+         draw, zdata_v, lonatm, latatm, jpiatm, jpjatm, 2, 2, 2, $
+          TITLE = data_v_name+' data, iteration = '+strtrim(t+1,1), minv, maxv, /land
+         draw, zresul_u, lon_f, lat_f, jpioce, jpjoce, 2, 3, 2, $
+          TITLE = data_u_name+' interpolated, iteration = '+strtrim(t+1,1), minu, maxu, /land
+         draw, zresul_v, lon_f, lat_f, jpioce, jpjoce, 2, 4, 2, $
+          TITLE = data_v_name+' interpolated, iteration = '+strtrim(t+1,1), minv, maxv, /land
+         IF keyword_set(key_ps) THEN BEGIN 
+            closeps
+         ENDIF ELSE BEGIN 
+            print, 'Press return to continue'
+            zxc = strarr(1)
+            read, zxc
+         ENDELSE 
+      ENDIF
+   ENDIF 
+  
+;
+; 3. NetCDF output to file of interpolated field 
+; ==============================================
+;
+    tempsun3 = systime(1) ; pour key_performance
+  IF keyword_set(nscal) THEN BEGIN 
+      printf, 40, ''
+      printf, 40, 'Storing components of interpolated field'
+      
+
+      ncdf_varput, numout_u, varid_u, zresul_u, offset = [0, 0, 0, t-nit000+1]
+      ind = where(abs(zresul_u) LT 1.e10)
+      IF ind[0] NE -1 THEN BEGIN 
+         IF min(zresul_u) LT mi_u THEN mi_u = min(zresul_u[ind])
+         IF max(zresul_u) GT ma_u THEN ma_u = max(zresul_u[ind])
+      ENDIF ELSE BEGIN 
+         mi_u = missing_val
+         ma_u = missing_val
+      ENDELSE
+       
+      ncdf_varput, numout_v, varid_v, zresul_v, offset = [0, 0, 0, t-nit000+1]
+      ind = where(abs(zresul_v) LT 1.e10)
+      IF ind[0] NE -1 THEN BEGIN 
+         IF min(zresul_v) LT mi_v THEN mi_v = min(zresul_v[ind])
+         IF max(zresul_v) GT ma_v THEN ma_v = max(zresul_v[ind])
+      ENDIF ELSE BEGIN 
+         mi_v = missing_val
+         ma_v = missing_val
+      ENDELSE 
+   ENDIF ELSE BEGIN 
+      printf, 40, ''
+      printf, 40, 'Storing field'
+      
+      ncdf_varput, numout, varid, zresul, offset = [0, 0, 0, t-nit000+1]
+      ind = where(abs(zresul) LT 1.e10)
+      IF min(zresul) LT mi THEN mi = min(zresul[ind])
+      IF max(zresul) GT ma THEN ma = max(zresul[ind])
+   ENDELSE 
+      if keyword_set(key_performance) THEN print, 'temps ecriture variable', systime(1)-tempsun3 
+      if keyword_set(key_performance) THEN printf, 40, 'temps ecriture variable', systime(1)-tempsun3 
+      if keyword_set(key_performance) THEN print, 'temps boucle', systime(1)-tempsun4 
+      if keyword_set(key_performance) THEN printf, 40, 'temps boucle', systime(1)-tempsun4 
+ENDFOR
+;
+;  END OF TIME LOOP
+;
+printf, 40, ''
+printf, 40, '**** END OF TEMPORAL LOOP ****'
+;
+printf, 40, ''
+printf, 40, 'Closing files'
+;
+; storing min and max in attributes
+;
+IF keyword_set(nscal) THEN BEGIN 
+   ncdf_control, numout_u, /redef
+   ncdf_control, numout_v, /redef
+   ncdf_attput, numout_u, varid_u, "valid_min", mi_u
+   ncdf_attput, numout_u, varid_u, "valid_max", ma_u
+   ncdf_attput, numout_v, varid_v, "valid_min", mi_v
+   ncdf_attput, numout_v, varid_v, "valid_max", ma_v
+ENDIF ELSE BEGIN 
+   ncdf_control, numout, /redef
+   ncdf_attput, numout, varid, "valid_min", mi
+   ncdf_attput, numout, varid, "valid_max", ma
+ENDELSE 
+IF keyword_set(key_mask) THEN ncdf_close, nummsk
+IF keyword_set(nscal) THEN BEGIN 
+   ncdf_close, numdta_u
+   ncdf_close, numdta_v
+   ncdf_close, numout_u
+   ncdf_close, numout_v
+ENDIF ELSE BEGIN 
+   ncdf_close, numout
+   ncdf_close, numdta
+ENDELSE 
+ncdf_close, nummsh
+;
+printf, 40, ''
+printf, 40, '*******************************************'
+printf, 40, '*      END OF INTERPOLATION PROGRAM       *'
+printf, 40, '*******************************************'
+;
+close, 40
+   if keyword_set(key_performance) THEN print, 'temps total', systime(1)-tempsun 
+   if keyword_set(key_performance) THEN printf,40, 'temps total', systime(1)-tempsun 
+;
+return
+END 
Index: /trunk/inv_mask.pro
===================================================================
--- /trunk/inv_mask.pro	(revision 2)
+++ /trunk/inv_mask.pro	(revision 2)
@@ -0,0 +1,48 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: inv_mask.pro
+;
+; PURPOSE: Puts 0 where mask is equal to 1 and vice versa
+;
+; CATEGORY: Function
+;
+; CALLING SEQUENCE: inv_mask, mask
+;
+; INPUTS: 
+;          mask : mask field composed of 0 and 1 values	 
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: 
+;          mask : mask field composed of 0 and 1 values 
+;                 inverted 
+;
+; COMMON BLOCKS: None
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 11/99 A. Jouzeau
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION inv_mask, mask
+printf, 40, ''
+printf, 40, 'Entering inv_mask'
+z = mask
+stop
+zero = where(mask EQ 0)
+one = where(mask EQ 1)
+z[zero] = 1
+z[one] = 0
+printf, 40, ''
+printf, 40, 'Inversion done'
+return, z
+END 
Index: /trunk/naminterp.pro
===================================================================
--- /trunk/naminterp.pro	(revision 2)
+++ /trunk/naminterp.pro	(revision 2)
@@ -0,0 +1,230 @@
+;---------------------------------------------------
+; INTERPOLATION INITIALISATIONS                    *
+;---------------------------------------------------
+@common_interp
+;
+; 1. General information concerning the interpolation
+; ===================================================
+;
+;  1.1. Dimension of the field being interpolated (2D or 3D)
+;  ---------------------------------------------------------
+;   2D field --> ndim = 0
+;   3D field --> ndim = 1
+ndim = 0
+;   Case ndim = 0
+;   -if the field and mask are really 2D (x,y(,t)) then 
+;      key_2d = 1
+;   -else if they are (x,y,z_a(,t)) where z_a=1 then
+;      key_2d = 0
+key_2d = 1
+;
+;  1.2. Nature of the field being interpolated (scalar ou vector)
+;  --------------------------------------------------------------
+;   scalar --> nscal = 0
+;   vector --> nscal = 1
+nscal = 0
+;nscal = 1
+;
+;  1.3. Type of interpolation needed (bilinear ou bicubic)
+;  -------------------------------------------------------
+;   bilinear --> ninterp = 0
+;   bicubic  --> ninterp = 1
+ninterp = 0
+;ninterp = 1
+;
+;  1.4. Mask on points
+;  -------------------
+;   key_mask = 1 if some points are masked 
+;            = 0 if no masked points
+;
+key_mask = 0
+;
+;  1.5. Maximum iteration number for extrapolation
+;  -----------------------------------------------
+;
+nfil = 100
+;
+;  1.6. Frequency of drawing : every ndraw time iterations
+;  -------------------------
+;
+keydraw = 0 ; =0 if no drawing =1 else 
+key_ps = 0  ; =0 if no Postscript file wanted =1 if PS wanted (implies keydraw=1)
+ndraw = 1
+nlevel = 33 ; every nlevel levels
+;
+; 
+; 2. Information about the data file 
+; ==================================
+;
+;  2.1. Fields names
+;  -----------------
+; ... data
+IF keyword_set(nscal) THEN BEGIN 
+   data_u_name = 'stress_x'
+   data_v_name = 'stress_y'
+ENDIF ELSE BEGIN
+;   data_name = 'cond_sed'
+   data_name = 'Br'
+
+ENDELSE
+; ... units
+units = "siemens"
+; ... input grid mask
+IF keyword_set(key_mask) THEN mask_name = 'tmask'
+; Input Latitude Axis
+IF keyword_set(nscal) THEN BEGIN 
+   y_axis_u = 'nav_lat'
+   y_axis_v = 'nav_lat'
+ENDIF ELSE BEGIN 
+   y_axis   = 'la'
+ENDELSE
+
+; ... input grid depth (3D field only)
+IF keyword_set(ndim) THEN BEGIN 
+   datadept_name = 'deptht'
+;  ... location (ndep =1 if depth in data file, =0 if in mask file)
+   ndep = 1
+ENDIF
+; ... time 
+time_name = 'lo'
+; ... output grid mask(s)
+IF keyword_set(nscal) THEN BEGIN 
+   mask_u_name = 'umask'
+   mask_v_name = 'vmask'
+ENDIF ELSE BEGIN 
+   mask_t_name = 'tmask'
+ENDELSE
+; ... output grid depth 
+IF keyword_set(ndim) THEN outdept_name = 'gdept'
+; ... output grid coordinates 
+IF keyword_set(nscal) THEN BEGIN 
+   lon_u_name = 'glamu'
+   lat_u_name = 'gphiu'
+   lon_v_name = 'glamv'
+   lat_v_name = 'gphiv'
+   lon_f_name = 'glamf'
+   lat_f_name = 'gphif'
+ENDIF ELSE BEGIN 
+   lon_name = 'nav_lon'
+   lat_name = 'nav_lat'
+ENDELSE 
+; ... missing value
+;     
+;     nmiss = 0 --> no missing value
+;     nmiss = 1 --> missing value of value missing_val
+;     CAUTION : missing_val stands for the ABSOLUTE VALUE of your
+;     input file missing value. Please enter missing_val LOWER THAN
+;     THE ABSOLUTE VALUE of the Missing value of your file.
+
+nmiss = 0
+missing_val = 85
+
+;
+;  2.2. Spatial resolution
+;  -----------------------
+;
+
+jpiatm = 360l      ; l for long integer PLEASE LEAVE IT
+jpjatm = 180l      ; l for long integer PLEASE LEAVE IT
+jpkatm = 1l       ; l for long integer PLEASE LEAVE IT
+dx = 1.            ; Grid size along x axis of the input regular grid
+south_lat = -89.5  ; Southernmost latitude of the input grid
+lon_shift= 180     ; Use lon_shift in order to have both input and output grid calculating longitudes the same way (-180 to 180, or, 0 to 360), this will avoid you a lot of problems
+west_lon = -179.5  ; Longitude at the left handside of the input grid, once lon_shift has been used
+north_pole = 1     ; Is the upper line of the domain at a latitude of +90 degrees, 1 = yes, 0 = no
+
+
+;
+;  2.3. Temporal resolution
+;  ------------------------
+;
+nit000 = 1                    ; first time step
+nitend = 1                   ; last time step
+nstep = nitend-nit000+1       ; number of steps 
+;
+;  2.4. Pretreatment of input variables
+;  ------------------------------------
+;   data = data*scale_factor + add_offset
+;   when handling multiple files with scale_factor and 
+;   add_offset defined, put key_vari=1 in case they change
+;   from one file to another
+;
+key_vari = 0
+scale_factor = 1.
+add_offset = 0.
+;
+;   if mask equal -1 on unmasked point --> negmask = 1
+;   if mask equal +1 on unmasked point --> negmask = 0
+;
+negmask = 0
+;
+;   latitudes from south to north  -->  reverse = 0
+;   latitudes from north to south  -->  reverse = 1
+;
+nreverse = 1
+;
+;   mask = 1 on OCEAN points  -->  invmask = 0
+;   mask = 1 on LAND  points  -->  invmask = 1 
+;
+invmask = 0
+;
+;   No change on mask extension                 --> extend = 0
+;   Extend mask over one point on ocean points  --> extend = 1
+;   NB: ONLY 2D FIELDS ALLOWED
+;
+extend = 0
+;
+;
+; 3. Information about the output grid
+; ====================================
+;
+; ... coordinates names
+;
+;   jpioce : number of longitude points
+;   jpjoce : number of latitude points
+;   jpkoce : number of vertical levels
+;
+jpioce = 182l ; l for long integer PLEASE LEAVE IT
+jpjoce = 149l ; l for long integer PLEASE LEAVE IT
+jpkoce = 1l  ; l for long integer PLEASE LEAVE IT
+pres_x=2.     ; Precision of the output grid along x axis
+pres_y=2.     ; Precision of the output grid along y axis
+ext_x=40      ; Number of extension point on the output grid to treat for E/W boundary conditions
+ext_y=40      ; Number of extension point on the output grid to treat for North fold boundary conditions;   
+;   modlam --> 0 if all longitudes are lower than 360 degrees
+;          --> 1 if some longitudes are greater than 360 degrees
+;     
+modlam = 0
+;
+;
+; 4. Title(s) of output file(s) 
+; =============================
+;
+IF keyword_set(nscal) THEN BEGIN 
+   long_x_name = 'Zonal wind stress'
+   title_x = "Daily interpolated OMIP stress x wind on ORCA2 grid"
+   long_y_name = 'Meridional wind stress'
+   title_y = "Daily interpolated OMIP stress y wind on ORCA2 grid"
+ENDIF ELSE BEGIN 
+   long_name = 'Salinity'
+   title = "Monthly Levitus Sea Salinity corrected"
+ENDELSE 
+;
+key_performance = 0
+;
+printf, 40, ''
+printf, 40, 'Field''s dimension :'
+IF keyword_set(ndim)  THEN printf, 40, ' --> 3D' ELSE printf, 40, ' --> 2D'
+;
+IF keyword_set(nscal) THEN  BEGIN 
+   printf, 40, 'Interpolation of the vector array : ' 
+   printf, 40, ' --> ', '[', data_u_name, ',', data_v_name, ']' 
+ENDIF ELSE BEGIN 
+   printf, 40, 'Interpolation of the scalar array : ' 
+   printf, 40, ' --> ', data_name
+ENDELSE 
+;
+printf, 40, 'Type of the interpolation :'
+IF keyword_set(ninterp) THEN printf, 40, ' --> bicubic' $
+                        ELSE printf, 40, ' --> bilinear'
+;
Index: /trunk/netcdf_input.pro
===================================================================
--- /trunk/netcdf_input.pro	(revision 2)
+++ /trunk/netcdf_input.pro	(revision 2)
@@ -0,0 +1,177 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: netcdf_input.pro
+;
+; PURPOSE: Reads coordinates, data and mask 
+;
+; CATEGORY: Subroutine
+;
+; CALLING SEQUENCE: netcdf_input, mask
+;
+; INPUTS: 
+;
+;          maskfile  : name of mask file
+;          gridfile  : name of grid file
+;          mask_name : mask name 
+;  SCALAR FIELD :
+;          datafile  : name of input data file
+;          lon_name  : name of output longitude variable
+;          lat_name  : name of output latitude variable
+;  VECTOR FIELD :
+;          data_u_file  : name of input data x-component file
+;          data_v_file  : name of input data y-component file
+;          lon_u_name   : name of output longitude variable at u-point
+;          lat_u_name     : name of output latitude variable at u-point
+;          lon_v_name     : name of output longitude variable at v-point
+;          lat_v_name     : name of output latitude variable at v-point
+;          lon_f_name     : name of output longitude variable at f-point
+;          lat_f_name     : name of output latitude variable at f-point
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: 
+;          mask     : mask of the origin grid
+;          nummsk   : ID of input mask file
+;          nummsh   : ID of output coordinates and mask file
+;  SCALAR FIELD : 
+;          lon_t  : longitudes of target grid at t-point
+;          lat_t  : latitudes of target grid at t-point 
+;          numdta : ID of input data file
+;  VECTOR FIELD :
+;          lon_u    : longitudes of target grid at u-point
+;          lat_u    : latitudes of target grid at u-point 
+;          lon_v    : longitudes of target grid at v-point
+;          lat_v    : latitudes of target grid at v-point 
+;          lon_f    : longitudes of target grid at f-point
+;          lat_f    : latitudes of target grid at f-point 
+;          numdta_u : ID of input data x-component file
+;          numdta_v : ID of input data y-component file
+;
+; COMMON BLOCKS:
+;	common_interp.pro
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 11/99 A. Jouzeau
+;                       08/00 A. Jouzeau
+;                       03/2003 R.Hordoir Added reading of meridian
+;                       axis in input file
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+PRO netcdf_input, mask
+@common_interp
+;
+; 0. Opening files
+; ================
+;
+printf, 40, ''
+IF keyword_set(key_mask) THEN nummsk = ncdf_open(input_dir+ '/'+ maskfile)
+IF keyword_set(key_mask) THEN printf, 40, maskfile, ' opening OK'
+IF keyword_set(nscal) THEN BEGIN 
+   numdta_u = ncdf_open(string(input_dir, '/', data_u_file))
+   printf, 40, data_u_file, ' opening OK'
+   numdta_v = ncdf_open(string(input_dir, '/', data_v_file))
+   IF data_u_file NE data_v_file THEN printf, 40, data_v_file, ' opening OK'
+ENDIF ELSE BEGIN 
+   numdta = ncdf_open(input_dir+ '/'+ datafile)
+   printf, 40, datafile, ' opening OK'
+ENDELSE 
+nummsh = ncdf_open(input_dir+ '/'+ gridfile)
+printf, 40, gridfile, ' opening OK'
+;
+; 1. Reading coordinates of output grid
+; =====================================
+;
+IF keyword_set(nscal) THEN BEGIN 
+   ncdf_varget, nummsh, lon_u_name, lon_u
+   ncdf_varget, nummsh, lat_u_name, lat_u
+   ncdf_varget, nummsh, lon_f_name, lon_f
+   ncdf_varget, nummsh, lat_f_name, lat_f
+   ncdf_varget, nummsh, lon_v_name, lon_v
+   ncdf_varget, nummsh, lat_v_name, lat_v
+   IF keyword_set(modlam) THEN BEGIN 
+      ii=where(lon_f gt 360)
+      lon_f(ii)=lon_f(ii)-360
+      ii=where(lon_u gt 360)
+      lon_u(ii)=lon_u(ii)-360
+      ii=where(lon_v gt 360)
+      lon_v(ii)=lon_v(ii)-360
+   ENDIF 
+ENDIF ELSE BEGIN 
+   ncdf_varget, nummsh, lon_name, lon_t
+   ncdf_varget, nummsh, lat_name, lat_t
+   IF keyword_set(modlam) THEN BEGIN 
+      ii=where(lon_t gt 360)
+      lon_t(ii)=lon_t(ii)-360
+   ENDIF 
+ENDELSE 
+printf, 40, ''
+printf, 40, 'Coordinates of output grid reading OK'
+;
+; 2. Reading the Input Axis and data mask
+; =======================================
+;
+; Input Axis Vertical Axis (Horizontal Axis is supposed to be fully regular)
+       phi_input=replicate(0,jpiatm,jpjatm)
+
+IF keyword_set(nscal) THEN BEGIN
+   
+       ncdf_varget, numdta_u,y_axis_u,phi_input_u, count = [jpiatm, jpjatm]
+       ncdf_varget, numdta_v,y_axis_v,phi_input_v, count = [jpiatm, jpjatm]
+       
+       phi_input_u=phi_input_u(0,*)
+       phi_input_v=phi_input_v(0,*)
+       
+ENDIF ELSE BEGIN
+
+     
+       ncdf_varget, numdta  ,y_axis  ,phi_input  , count = [ jpjatm] 
+;   modif  FRED     
+       phi_input=reverse(phi_input)
+;   fin modif FRED 
+;stop
+;       phi_input=phi_input(0,*)
+
+ENDELSE
+
+; Data Mask
+
+IF keyword_set(key_mask) THEN BEGIN 
+   IF keyword_set(ndim) THEN $
+    ncdf_varget, nummsk, mask_name, mask, count = [jpiatm, jpjatm, jpkatm, 1] ELSE BEGIN  
+
+    IF keyword_set(key_2d) THEN $
+       ncdf_varget, nummsk, mask_name, mask, count = [jpiatm, jpjatm] ELSE $
+       ncdf_varget, nummsk, mask_name, mask, count = [jpiatm, jpjatm, 1, 1]
+    ENDELSE 
+   
+   printf, 40, ''
+   printf, 40, 'Data mask reading OK'
+ENDIF ELSE BEGIN
+   IF keyword_set(ndim) THEN mask = replicate(1., jpiatm, jpjatm, jpkatm) ELSE $
+    mask = replicate(1., jpiatm, jpjatm)
+ENDELSE 
+;
+; 3. Reading depths of input and output grids (3D field)
+; ======================================================
+;
+IF keyword_set(ndim) THEN BEGIN 
+   IF keyword_set(ndep) THEN $
+    ncdf_varget, numdta, datadept_name, datadept ELSE $
+    ncdf_varget, nummsk, datadept_name, datadept
+   ncdf_varget, nummsh, outdept_name, outdept
+   datadept = float(datadept)
+   outdept = float(outdept)
+ENDIF 
+;
+return
+END  
Index: /trunk/netcdf_output.pro
===================================================================
--- /trunk/netcdf_output.pro	(revision 2)
+++ /trunk/netcdf_output.pro	(revision 2)
@@ -0,0 +1,152 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: netcdf_output.pro
+;
+; PURPOSE: Writes interpolated field in a netCDF format file
+;
+; CATEGORY: Subroutine
+;
+; CALLING SEQUENCE: netcdf_output, zout_mask_name, zout_mask, zdata_name, zlon, zlat, $
+;                                 zoutputfile, ztitle, POINT = point, znumout, zvarid
+;
+; INPUTS: 
+;          zout_mask_name : name of interpolated field mask
+;           	zout_mask : mask of interpolated field
+;              zdata_name : name of data
+;               zlon,zlat : coordinates of output grid
+;             zoutputfile : name of output file
+;                  ztitle : title of file
+;                   point : grid point of field (u,v,t)
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: 
+;          NetCDF file containing the attributes of interpolated field
+;          znumout : ID of output file
+;          zvarid  : ID of variable named zdata_name
+;
+; COMMON BLOCKS:
+;	common_interp.pro
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 11/99 A. Jouzeau
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+PRO netcdf_output, zout_mask_name, zout_mask, zdata_name, zlon, zlat, $
+          zoutputfile, ztitle, zlong_name, POINT = point, znumout, zvarid, $
+          znumdta
+@common_interp
+   tempsun = systime(1) ; pour key_performance
+;
+; 1. Creating output file
+; =======================
+;
+
+znumout = ncdf_create(output_dir+ '/'+ zoutputfile)
+;
+; 2. Headers
+; ==========
+;
+;  2.1. Dimensions
+;  ---------------
+;
+xid = ncdf_dimdef(znumout, 'x', jpioce)
+yid = ncdf_dimdef(znumout, 'y', jpjoce)
+IF keyword_set(ndim) THEN zid = ncdf_dimdef(znumout, 'z', jpkoce)
+tid = ncdf_dimdef(znumout, time_name, /unlimited)
+;
+;  2.2. Variables
+;  --------------
+;
+IF size(zlon, /n_dimensions) EQ 1 THEN BEGIN 
+   varlon = ncdf_vardef(znumout, 'nav_lon', [xid], /float)
+   varlat = ncdf_vardef(znumout, 'nav_lat', [yid], /float)
+ENDIF ELSE BEGIN 
+   varlon = ncdf_vardef(znumout, 'nav_lon', [xid, yid], /float)
+   varlat = ncdf_vardef(znumout, 'nav_lat', [xid, yid], /float)
+ENDELSE 
+IF keyword_set(ndim) THEN BEGIN 
+   varlev1 = ncdf_varid(nummsh, 'nav_lev')
+   vart1 = ncdf_varid(znumdta, time_name)
+   varlev = ncdf_vardef(znumout, 'nav_lev', [zid], /float) 
+   vart = ncdf_vardef(znumout, 'time', [tid], /float)
+;   varmsk = ncdf_vardef(znumout, zout_mask_name, [xid, yid, zid], /float)
+   zvarid = ncdf_vardef(znumout, zdata_name, [xid, yid, zid, tid], /float)
+ENDIF ELSE BEGIN 
+   vart1 = ncdf_varid(znumdta, time_name)
+   vart = ncdf_vardef(znumout, 'time', [tid], /float)
+;   varmsk = ncdf_vardef(znumout, zout_mask_name, [xid, yid], /float)
+   zvarid = ncdf_vardef(znumout, zdata_name, [xid, yid, tid], /float)
+ENDELSE 
+;
+;  2.3. Attributes
+;  ---------------
+;
+ncdf_attput, znumout, varlon, "units", "degrees_east"
+ncdf_attput, znumout, varlon, "valid_min", min(zlon)
+ncdf_attput, znumout, varlon, "valid_max", max(zlon)
+ncdf_attput, znumout, varlon, "long_name", string("Longitude at ", point, "-point")
+ncdf_attput, znumout, varlat, "units", "degrees_north"
+ncdf_attput, znumout, varlat, "valid_min", min(zlat)
+ncdf_attput, znumout, varlat, "valid_max", max(zlat)
+ncdf_attput, znumout, varlat, "long_name", string("Latitude at ", point, "-point")
+IF keyword_set(ndim) THEN BEGIN 
+   rien = ncdf_attcopy(nummsh, varlev1, "units", znumout, varlev)
+   rien = ncdf_attcopy(nummsh, varlev1, "valid_min", znumout, varlev)
+   rien = ncdf_attcopy(nummsh, varlev1, "valid_max", znumout, varlev)
+   rien = ncdf_attcopy(nummsh, varlev1, "long_name", znumout, varlev)
+ENDIF
+zatt = ncdf_varinq(znumdta, vart1)
+znbatt = zatt.natts
+FOR i = 0, znbatt-1 DO BEGIN 
+   namatt = ncdf_attname(znumdta, vart1, i)
+   rien = ncdf_attcopy(znumdta, vart1, namatt,znumout, vart)
+ENDFOR 
+ncdf_attput, znumout, zvarid, "units", units 
+ncdf_attput, znumout, zvarid, "long_name", zlong_name 
+;
+; ... Global attributes
+;
+ncdf_attput, znumout,"Conventions", "GDT 1.2", /global
+ncdf_attput, znumout,"file_name", zoutputfile, /global
+ncdf_attput, znumout,"Title", ztitle, /global
+;
+; 3. Writing data 
+; ===============
+;
+ncdf_control, znumout, /endef
+;
+;  3.1. Grid
+;  ---------
+;
+printf, 40, ''
+printf, 40, 'Storing coordinates'
+ncdf_varput, znumout, varlon, zlon
+ncdf_varput, znumout, varlat, zlat
+IF keyword_set(ndim) THEN BEGIN 
+   ncdf_varget, nummsh, 'nav_lev', z, count = [jpkoce]
+   ncdf_varput, znumout, varlev, z
+ENDIF 
+;
+;  3.2. Time and mask
+;  ------------------
+;
+printf, 40, ''
+printf, 40, 'Storing times and mask'
+ncdf_varget, znumdta, vart1, zt, count = [nitend-nit000+1], offset = [nit000-1]
+ncdf_varput, znumout, vart, zt
+;ncdf_varput, znumout, varmsk, zout_mask
+   if keyword_set(key_performance) THEN print, 'temps netcdf_output', systime(1)-tempsun 
+;
+return
+END 
Index: /trunk/northwind.pro
===================================================================
--- /trunk/northwind.pro	(revision 2)
+++ /trunk/northwind.pro	(revision 2)
@@ -0,0 +1,145 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;
+; NAME: northwind.pro
+;
+; PURPOSE: Check on in the intput field the level of coherence of winds nearby north pole,
+;          and corrects it. Thi stask is performed before interpolation 
+;
+; CATEGORY: Subroutine
+;
+; CALLING SEQUENCE: northwind
+;
+; INPUTS: 
+;
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: 
+;          zresul : the same wind field with its upward stripe
+;          corrected in order to get coherence of winds on north polte
+;
+; COMMON BLOCKS:
+;	   common_interp.pro
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 
+;
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+
+pro northwind, datglo,zdata_name,t
+
+@common_interp
+
+; Treatment of north pole stripe 
+
+    
+; Get from global array, the last stripe and the last but one stripe
+ 
+;    Initialising data arrays
+
+     datglo_rect  = replicate(0.,2,jpiatm)
+     datglo_rectb = replicate(0.,2,jpiatm) 
+
+; Put data of the last two stripes into arrays
+
+     
+     datglo_rect(0,*) = datglo(*,jpjatm-1,0)
+     datglo_rect(1,*) = datglo(*,jpjatm-1,1)
+
+     datglo_rectb(0,*)= datglo(*,jpjatm-2,0)
+     datglo_rectb(1,*)= datglo(*,jpjatm-2,1)
+
+     
+
+; Converts data of these two lines into polar coordinates
+
+     add_angle=0.
+
+     if (zdata_name EQ data_u_name) then add_angle=!PI/2
+
+
+     datglo_polar=CV_COORD(FROM_RECT=datglo_rect,/TO_POLAR)
+     datglo_polar(0,*)=datglo_polar(0,*)+2*!PI*indgen(jpiatm)/jpiatm
+
+     datglo_polarb=CV_COORD(FROM_RECT=datglo_rect,/TO_POLAR)
+     datglo_polarb(0,*)=datglo_polar(0,*)+2*!PI*indgen(jpiatm)/jpiatm
+    
+
+; Coherence of the last line needs to be corrected
+
+     print, 'CHECKING LAST LINE COHERENCE...'
+
+     mean_mod=replicate(total(datglo_polar(1,*))/jpiatm,jpiatm)
+     mean_arg=replicate((total(datglo_polar(0,*))/jpiatm+2*!PI*west_lon/360.+!PI*(jpiatm-1.)/float(jpiatm)) ,jpiatm)
+     mean_argb=replicate((total(datglo_polarb(0,*))/jpiatm+2*!PI*west_lon/360.+!PI*(jpiatm-1.)/float(jpiatm)) ,jpiatm)
+
+     
+
+     ; Checks whether module is about the same on the North Pole line :
+    
+     test_mod=abs(mean_mod-datglo_polar(1,*))
+
+     IF ( max(test_mod)/mean_mod(0) ) GT 0.01 THEN BEGIN
+    
+          print, 'MODULE IS NOT COHERENT AND WILL BE CORRECTED TO A MEAN VALUE OF :', mean_mod(0) 
+          
+          datglo_polar(1,*)=mean_mod
+         
+     ENDIF
+    
+
+     ; Checks whether argument is coherent on the North Pole line :
+
+     test_arg=abs(mean_arg-datglo_polar(0,*))
+
+     IF ( max(test_arg)/mean_arg(0)) GT 0.01 THEN BEGIN 
+
+          print, 'ARGUMENT IS NOT COHERENT AND WILL BE CORRECTED TO A MEAN VALUE :', mean_argb(0)
+  
+          datglo_polar(0,*)=mean_argb-!PI/2-(2*!PI*indgen(jpiatm)/float(jpiatm)+replicate(2.*!PI*west_lon/360.,jpiatm))
+           
+     
+
+     ; Cross Corellation Method for wind coherence on North Pole
+
+     all_phases=indgen(jpiatm)
+     
+     Ux=mean_mod*cos(all_phases*2.*!PI/jpiatm)
+     Uy=mean_mod*sin(all_phases*2.*!PI/jpiatm) 
+
+     phyx=C_CORRELATE(Ux,datglo(*,jpjatm-2,0),all_phases)
+
+     phyy=C_CORRELATE(Uy,datglo(*,jpjatm-2,1),all_phases)
+
+
+     deph_x=where(phyx EQ max(phyx))
+     deph_y=where(phyy EQ max(phyy))
+     
+     deph_x=deph_x(0)
+     deph_y=deph_y(0)
+
+     
+
+
+     Ux=shift(Ux,deph_x)
+     Uy=shift(Uy,deph_y)
+
+     datglo(*,jpjatm-1,0)=Ux
+     datglo(*,jpjatm-1,1)=Uy
+ 
+
+     ENDIF
+
+ 
+    
+
+end
Index: /trunk/preproc_mask.pro
===================================================================
--- /trunk/preproc_mask.pro	(revision 2)
+++ /trunk/preproc_mask.pro	(revision 2)
@@ -0,0 +1,57 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: preproc_mask.pro
+;
+; PURPOSE: Extends land-sea mask by one point over ocean 
+;
+; CATEGORY: Function
+;
+; CALLING SEQUENCE: preproc_mask, mask
+;
+; INPUTS: 
+;          mask : mask field composed of 0 and 1 values 
+;                 with 0 over land points 	 
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: 
+;          mask : mask field extended 
+;                  
+;
+; COMMON BLOCKS: 
+;          common_interp
+;
+; SIDE EFFECTS: 
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: 11/99 A. Jouzeau
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION preproc_mask, mask
+@common_interp
+;
+printf, 40, ''
+printf, 40, 'Entering preproc_mask'
+zero = fltarr(jpiatm+2, jpjatm+2)
+zero(*, *) = 1
+zero[1:jpiatm, 1:jpjatm] = mask
+mask = zero
+;
+mask = mask*shift(mask,  1, 0)*shift(mask, 0,  1)*shift(mask,  1,  1) $
+           *shift(mask, -1, 0)*shift(mask, 0, -1)*shift(mask, -1, -1) $
+           *shift(mask, -1, 1)*shift(mask, 1, -1)
+z = fltarr(jpiatm, jpjatm)
+z = mask[1:jpiatm, 1:jpjatm]
+printf, 40, ''
+printf, 40, 'Extension done'
+;
+return, z
+END 
Index: /trunk/sclarr.pro
===================================================================
--- /trunk/sclarr.pro	(revision 2)
+++ /trunk/sclarr.pro	(revision 2)
@@ -0,0 +1,53 @@
+pro sclarr,map,xscale,xmax,dispimg, OFFSET=offnum,SMIN=minnum
+
+;THIS SCALES AN ARRAY FOR DISPLAY
+;WITH RNBWSSMI COLOR TABLE
+; map=byte array
+; xscale = value to scale geophysical data by
+; xmax = maximum of that geophysical parameter
+; dispimg=scaled byte array to be displayed
+; offset= adjustment value to original data
+; smin= minimum value for scale
+
+
+IF N_elements(offnum) EQ 0 THEN offnum=0
+IF N_elements(minnum) EQ 0 THEN minnum=0
+
+slope=159./(xmax-minnum)
+intercept=(159-slope*(xmax+minnum))/2.
+print, slope, intercept
+
+s=SIZE(map)
+xsize = s(1)
+ysize = s(2)
+TEMP=replicate(0,xsize,ysize)
+
+x= where (map lt 251B,num)
+if(num ne 0) then begin
+TEMP(x)=round((float(map(x))*xscale-offnum)*slope+intercept)
+endif
+
+x= where (TEMP lt 0,num)
+if(num ne 0) then TEMP(x)=0
+x= where (TEMP gt 159,num)
+if (num ne 0) then TEMP(x)=159
+
+dispimg=byte(TEMP)
+
+x=where(map eq 255B,num)
+if(num ne 0) then dispimg(x)=185B
+
+x= where(map eq 254B,num)
+if(num ne 0) then dispimg(x)=160B
+
+x= where(map eq 253B,num)
+if(num ne 0) then dispimg(x)=160B
+
+x= where(map eq 252B,num)
+if(num ne 0) then dispimg(x)=210B
+
+x= where (map eq 251B,num)
+if(num ne 0)then dispimg(x)=160B
+
+
+end
Index: /trunk/xxx_oneplot.pro
===================================================================
--- /trunk/xxx_oneplot.pro	(revision 2)
+++ /trunk/xxx_oneplot.pro	(revision 2)
@@ -0,0 +1,32 @@
+pro xxx_oneplot
+@common
+noerase = 1
+portrait = 0
+; beginning of reading the field to draw
+; field number: 1
+; declaration de la structure extra:
+extra=create_struct('NOTHING',0)
+; declaration de la structure readparameters:
+readparameters=create_struct('FUNCLEC_NAME','read_ncdf','JPIDTA',182,'JPJDTA',149,'JPKDTA',31,'IXMINDTA',0,'IXMAXDTA',181,'IYMINDTA',0,'IYMAXDTA',148,'IZMINDTA',0,'IZMAXDTA',30)
+; on change de lecture?:
+nothing=changeread(readparameters)
+; declaration de la structure meshparameters:
+meshparameters=create_struct('FILENAME','/usr/work/sur/fvi/OPA/geomag/INTERP2/initorca_reg.pro','FILETYPE','batch file','JPIGLO',182,'JPJGLO',149,'JPKGLO',31,'JPI',180,'JPJ',148,'JPK',31,'IXMINMESH',1,'IXMAXMESH',180,'IYMINMESH',0,'IYMAXMESH',147,'IZMINMESH',0,'IZMAXMESH',30,'KEY_SHIFT',0,'KEY_PERIODIQUE',1,'TRIANGULATION',1,'BOUNDARY',[80.0000,439.000])
+; on change de grille?:
+nothing=changegrid(meshparameters)
+; lecture du champ
+if keyword_set(date1in) then date1 = date1in else date1 = 10115
+if keyword_set(date2in) then date2 = date2in else date2 = 10115
+field = litchamp(read_ncdf('Diver', date1, date2,'',parent=1,boite=[80, 440, -79, 90, 0, 5] $
+, filename='/usr/work/sur/fvi/OPA/ORCA2/DivBustar_5d_1993_reg.nc' $
+, _extra=mixstru(ex, extra)))
+field = field
+field = create_struct({tab:field, grille:vargrid, unite:varunit, experience:varexp, nom:varname})
+; end of reading the field to draw
+;
+extra = create_struct('NOTHING',0,'MIN',0.00000,'MAX',0.00000,'INTER',0.00000,'LCT',39)
+plt, field $
+, boite=[80, 440, -79, 90, 0, 5], typein='plt', petit=[1,1,1] $
+, _extra= mixstru(ex, extra), NOERASE=noerase
+return
+end
