Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/README
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/README	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/README	(revision 2200)
@@ -0,0 +1,2 @@
+To use these idl tools you need to download some cliatogies and mask files;
+that you can find here: http://dodsp.idris.fr/reee512/NEMO_OUT/ORCA2_LIM/
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/fig_ht_fromQ.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/fig_ht_fromQ.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/fig_ht_fromQ.pro	(revision 2200)
@@ -0,0 +1,86 @@
+pro fig_ht_fromQ,  Q1, Q2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, MASK_FILENAME = mask_filename, _extra = ex
+  
+  compile_opt idl2, strictarrsubs
+
+@common
+
+  tmask_save = tmask  
+                                ; suppress 1/2 north ligne dans TMASK
+  tmask[jpi/2:jpi-1,jpj-1,0] = 0b ; 0 byte
+
+  Qave1 = moyenne(Q1,'xy') 
+  Qave2 = moyenne(Q2,'xy')
+
+  Qnet1 = Q1 - Qave1
+  Qnet2 = Q2 - Qave2
+
+  index=where(gphit eq max(gphit))
+  nx=index[0] mod jpi
+  gphi_save=gphit
+  gphit[0,*]=gphit[nx,*]
+                                ; 
+  msk = read_ncdf( 'atlmsk_nomed', filename = mask_filename, _extra = ex)
+  
+                                ; from 2D array to 3D array 
+  msk = msk.arr[*]#replicate(1., nzt)
+  
+                                ; x average (zonal mean)
+                                ; *1.E-15 to have PetaWatt
+  Q1x = moyenne(Qnet1*e2t,'x',/integration)*1.E-15
+  Q2x = moyenne(Qnet2*e2t,'x',/integration)*1.E-15
+  Q1x_atl = moyenne(Qnet1*e2t*msk,'x',/integration)*1.E-15
+  Q2x_atl = moyenne(Qnet2*e2t*msk,'x',/integration)*1.E-15
+                                ; northward heat flux transport from antartic  
+  htr1 = total(Q1x, /cumulative)
+  htr2 = total(Q2x, /cumulative)
+  htr1_atl = total(reverse(Q1x_atl), /cumulative)
+  htr1_atl = -reverse(htr1_atl)
+  htr2_atl = total(reverse(Q2x_atl), /cumulative)
+  htr2_atl = -reverse(htr2_atl)
+
+  bad_gphit = where(gphit[0,*] lt -30.)
+  htr1_atl[bad_gphit] = !Values.F_NaN   ; we take from values north till 30° South
+  htr2_atl[bad_gphit] = !Values.F_NaN   ; we take from values north till 30° South
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '004_MHT_'+sEXP1+'-'+sEXP2+'_y'+start_end+ '.ps', /landscape
+  endif
+  
+; update data informations
+  varname = 'MHT'
+  varunit = 'Pw'
+  vargrid = 'T' 
+
+  ibce1 = STRTRIM(Qave1, 1)
+  ibce2 = STRTRIM(Qave2, 1)
+
+  title = sEXP1+' (Red) MHT (PetaW) - (Blue) Atlantic MHT (PetaW) / year '+start_end
+  subtitle = sEXP1+' (Qnet='+ibce1+' W/m2) -  (Qnet='+ibce2+' W/m2)'
+
+  plt1d, htr1,'y',min = -2., max = 2.5, TITLE=title, SUBTITLE = subtitle $ 
+        , SMALL = [2,2,1], YTITLE = 'PW',  XGRIDSTYLE = 2, TICKLEN = 1, YGRIDSTYLE = 2,  _extra = ex   
+  plt1d, htr1_atl,'y', COLOR = 50, /ov1d,  _extra = ex
+
+ if sEXP1 ne sEXP2 then begin
+  
+  title = sEXP1+' - '+sEXP2+' MHT (TeraW) differences / year '+start_end
+  plt1d, (htr1-htr2)*1.e3,'y',min = 0., max = 500., TITLE = title $
+         , SMALL = [2,2,3], TICKLEN = 1, XGRIDSTYLE = 2 $
+         , YTITLE = 'PW', YGRIDSTYLE = 2,   /NOERASE, _extra = ex
+  plt1d, (htr1_atl - htr2_atl),'y', COLOR = 50, /ov1d,  _extra = ex
+ 
+ endif 
+
+  title = 'Qnet'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/004_MHT_'+sEXP1+'-'+sEXP2+'_y'+start_end+ '.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+  
+  tmask=tmask_save
+  gphit=gphi_save
+  
+  return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/getname.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/getname.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/getname.pro	(revision 2200)
@@ -0,0 +1,26 @@
+function getname,dir,exp,freq,suff,date
+  
+ file_list = file_search (dir+'/'+exp+'_*_*_'+freq+'_'+suff+'.nc', count = nb_file )
+  
+ file_list = file_basename( file_list )
+
+ filename = ''
+ i = 0
+
+ while  i lt nb_file  and filename eq '' do begin
+  
+    split_name = STRSPLIT(file_list[i],'_',/EXTRACT ) 
+    date1 = long(split_name[1])
+    date2 = long(split_name[2])
+
+
+    if date1 - date le 0 and  date - date2 le 0 then filename = dir+'/'+file_list[i]
+    i = i + 1
+    
+ endwhile 
+
+ if filename eq '' then print,'filename does NOT FOUND' 
+
+ return,filename
+
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/plt_bsf.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/plt_bsf.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/plt_bsf.pro	(revision 2200)
@@ -0,0 +1,41 @@
+pro plt_bsf, U1, U2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+
+  compile_opt idl2, strictarrsubs
+
+  @common
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '005_bsf_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps',  portrait = 1
+  endif
+  domdef, 0, 6000
+
+
+  bb1 = bsf(U1.arr, refvalue = 0., refpoint = [25, 0] )
+  bb2 = bsf(U2.arr, refvalue = 0., refpoint = [25, 0])
+ 
+
+  title = sEXP1+' Barotropic Stream Function'+' / year '+start_end
+  plt, bb1, min =-200., max = 200., int = 10.,/portrait, FORMAT = '(I4)', STYLE= 'so0so' $
+       , small = [1,2,1], COAST_THICK = 2, TITLE = title,  _extra = ex
+
+
+  if sEXP1 ne sEXP2 then begin
+
+     title = sEXP1+' - '+sEXP2+' Barotropic Stream Function'+' / year '+start_end
+     plt, bb1.arr - bb2.arr , min = -20., max = 20., int = 2.,  FORMAT = '(I2)', STYLE= 'so0so' $
+          , small = [1,2,2], COAST_THICK = 2, TITLE = title, /NOERASE, _extra = ex
+   
+  endif
+  
+  title = 'Barotropic Stream Function'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/005_bsf_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+
+  return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/plt_msf.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/plt_msf.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/plt_msf.pro	(revision 2200)
@@ -0,0 +1,66 @@
+pro plt_msf, V1, V2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, SUBBASIN = subbasin, MASK_FILENAME = mask_filename,_extra = ex
+
+  compile_opt idl2, strictarrsubs
+
+  @common
+
+  if KEYWORD_SET(SUBBASIN) then subname = subbasin 
+
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '019_msf_'+subname+'_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps',  portrait = 1
+  endif
+
+  if KEYWORD_SET(SUBBASIN) then begin
+     
+     CASE 1 of 
+        subbasin eq 'Atl' : var = 'atlmsk_nomed'
+        subbasin eq 'Ind' : var = 'indmsk'
+        subbasin eq 'Pac' : var = 'indpacmsk'
+        subbasin eq 'Glo' : var = 'glomsk_nomed'
+     ENDCASE
+                                ;
+     msk = read_ncdf( var, filename = mask_filename, /nostruct, _extra = ex )
+
+  endif else msk = tmask[*,*,0]
+;
+
+  
+  CASE subname OF
+     'Glo':lat_ext=[-80,90]
+     'Atl':lat_ext=[-30,90]
+     'Ind':lat_ext=[-30,30]
+     'Pac':lat_ext=[-30,70]
+     
+  ENDCASE
+
+ if subbasin eq 'Pac' then subname = "IndoPac"
+  
+  domdef, 0, 6000
+
+  mm1 = msf(V1.arr, msk, indexboxzoom = ind, maskout = ma)
+  mm2 = msf(V2.arr, msk, indexboxzoom = ind, maskout = ma)
+  title=sEXP1+' Meridional Stream Function '+subname+'/ year '+start_end
+  pltz, mm1, -20., 20., int = 1., boxzoom = [ind[0:1],lat_ext, 0, 5500], /xindex  , FORMAT = '(I3)' $
+        , small=[1,2,1], COAST_THICK=2 , zoom = 5500, maskdta = ma, /no_partial, TITLE = title, style = 'so0so'
+
+  if sEXP1 ne sEXP2 then begin
+     
+     title=sEXP1+' - '+sEXP2+subname+'/ year '+start_end
+     pltz, mm1.arr-mm2.arr, -10., 10., int = 1., boxzoom = [ind[0:1],lat_ext, 0, 5500], /xindex,  FORMAT = '(I3)'  $
+           , small=[1,2,2], COAST_THICK=2, zoom = 5500, maskdta = ma, /no_partial, TITLE = title, /NOERASE, style = 'so0so'
+     
+  endif
+  
+  title = + subname+ 'Meridional Stream Function'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/019_msf_'+subname+'_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+
+  return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_com.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_com.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_com.pro	(revision 2200)
@@ -0,0 +1,5 @@
+;COMMON STD_VAR, std_EXP1, std_EXP2, std_YEAR, std_iodir_data
+;COMMON STD_FIL1, std_file1_T, std_file1_U, std_file1_V, std_file1_W, std_file1_I
+;COMMON STD_FIL2, std_file2_T, std_file2_U, std_file2_V, std_file2_W, std_file2_I
+;COMMON STD_LEVITUS, std_file_Levitus_T, std_file_Levitus_S
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_plots.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_plots.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_plots.pro	(revision 2200)
@@ -0,0 +1,375 @@
+pro std_plots, std_EXP1, std_EXP2, ystart, _extra=ex
+
+
+PRINT, 'usage: postscript '
+PRINT, '========================================================================'
+PRINT, 'std_plots, ''std_EXP1'', ''std_EXP2'', ystart, /postscript'
+PRINT, '========================================================================'
+PRINT, 'std_plots, ''core2000'', ''core2000'', 1991, /postscript'
+PRINT, '========================================================================'
+
+
+  compile_opt idl2, strictarrsubs
+
+  PRINT, ''
+  PRINT, ' 	############################################'
+  PRINT, ''
+  PRINT, '                    LAUNCH of std_plots'
+  PRINT, ''
+  PRINT, ' 	############################################'
+  PRINT, ''
+
+
+@common
+@initorca2
+@std_com
+
+  year_start = ystart * 10000L + 101L                                                 ; year of start (corresponding to filename)
+  year_end = (ystart + 9L) * 10000L + 1231L                                           ; year of end (corresponding to filename)
+  start_end = string(year_start,format= '(I08)')+'_'+string(year_end,format ='(I08)') ; variable string for filename
+;;;;; ======================CHANGE PATH================================================================= ;;;;;;;;;;
+  std_iodir_data    = '/path_of_data_in_NetCdf_format/'        			      ; path of data in NetCdf format
+  std_iodir_climato = '/path_of_climatological_data/' 	                              ; path of climatological data
+  std_iodir_mask    = '/path_of_mask_files/'	                                      ; path of mask files (ex: subbasins)
+;;;;; ======================END CHANGE PATH================================================================= ;;;;;;;;;;
+
+  
+;;;;; ==================================================== WARNING ================================================================= ;;;;;;;;;;
+  d1 = (ystart + 9L) * 10000L + 101L ;  date to select last record of file with 10 years of record
+  d2 = year_end  ; date to select last record of file with 10 years of record
+  id1 = (ystart + 9L) * 10000L + 1201L ; date to select starting date for (monthly) ice output 
+  id2 = d2 ; date to select last record for (monthly) ice output
+  id_mars_1 = (ystart + 9L) * 10000L + 301L ; date to select mars ice output 
+  id_mars_2 = (ystart + 9L) * 10000L + 331L  ; date to select mars ice output
+  id_sept_1 = (ystart + 9L) * 10000L + 901L ; date to select september ice output 
+  id_sept_2 = (ystart + 9L) * 10000L + 930L ; date to select september ice output
+;
+; Levitus 98
+  std_file_Levitus_T =  'data_1y_potential_temperature_nomask.nc'
+  std_file_Levitus_S =  'data_1y_salinity_nomask.nc'
+
+; Output run experience1
+  std_file1_T     = std_EXP1+'_'+start_end+'_1Y_grid_T.nc' ; grid T input file
+  std_file1_U     = std_EXP1+'_'+start_end+'_1Y_grid_U.nc' ; grid U input file
+  std_file1_V     = std_EXP1+'_'+start_end+'_1Y_grid_V.nc' ; grid V input file
+;  std_file1_W    = std_EXP1+'_'+start_end+'_1Y_grid_W.nc' ; grid W input file
+  std_file1_I     = std_EXP1+'_'+start_end+'_1M_icemod.nc' ; ice    input file
+  
+; Output run experience2
+  std_file2_T     = std_EXP2+'_'+start_end+'_1Y_grid_T.nc' ; grid T input file
+  std_file2_U     = std_EXP2+'_'+start_end+'_1Y_grid_U.nc' ; grid U input file
+  std_file2_V     = std_EXP2+'_'+start_end+'_1Y_grid_V.nc' ; grid V input file
+;  std_file2_W    = std_EXP2+'_'+start_end+'_1Y_grid_W.nc' ; grid W
+  std_file2_I     = std_EXP2+'_'+start_end+'_1M_icemod.nc' ; ice    input file
+
+
+  PRINT, ''
+  PRINT, '	std_EXP1       : ', std_EXP1
+  PRINT, '	std_EXP2       : ', std_EXP2
+  PRINT, '	std_iodir_data : ', std_iodir_data 
+  PRINT, '	std_file1T : ', std_file1_T
+  PRINT, '	std_file1U : ', std_file1_U
+  PRINT, '	std_file1V : ', std_file1_V
+;  PRINT, '	std_file1W : ', std_file1_W
+  PRINT, '	std_file2I : ', std_file1_I
+  PRINT, '	std_file2T : ', std_file2_T
+  PRINT, '	std_file2U : ', std_file2_U
+  PRINT, '	std_file2V : ', std_file2_V
+;  PRINT, '	std_file2W : ', std_file2_W
+  PRINT, '	std_file2I : ', std_file2_I
+  PRINT, ''
+
+;#########################################################################
+; reading variables
+
+;;; 3D ;;;
+; temperature
+  T1   = read_ncdf('thetao', d1, d2, filename = std_iodir_data+std_file1_T                          ) 
+  T2   = read_ncdf('thetao', d1, d2, filename = std_iodir_data+std_file2_T                          ) 
+  TLev = read_ncdf('votemper', filename = std_iodir_climato+std_file_Levitus_T                ) 
+  TRey = read_ncdf('sst'     , filename = std_iodir_climato+'NewREY_ORCA2_1991_2000_1y.nc'    ) 
+
+;help,T1,T2,TLev,TRey
+
+; salinity
+  S1   = read_ncdf('so', d1, d2, filename = std_iodir_data+std_file1_T             ) 
+  S2   = read_ncdf('so', d1, d2, filename = std_iodir_data+std_file2_T             ) 
+  SLev = read_ncdf('vosaline', filename = std_iodir_climato+std_file_Levitus_S     ) 
+
+; Net Downward heat flux
+  Q1   = read_ncdf('qns+qsr', d1, d2, filename = std_iodir_data+std_file1_T           ) 
+  Q2   = read_ncdf('qns+qsr', d1, d2, filename = std_iodir_data+std_file2_T           )
+  geo  = read_ncdf('heatflow', filename=  std_iodir_climato+'geothermal_heating.nc'   )
+  geo  = geo.arr*1.e-3      ; convert into W/m2
+;climatology 
+  QNET  = read_ncdf('qnet', filename = std_iodir_climato+'OAFlux_1my_01_12_1984_2004_orca2_qnet.nc'   )
+
+; erp (evaporation damping)
+  ERP1   = read_ncdf('wfcorr', d1, d2, filename = std_iodir_data+std_file1_T  )
+  ERP2   = read_ncdf('wfcorr', d1, d2, filename = std_iodir_data+std_file2_T  )
+  ERP1   = ERP1.arr * 86400
+  ERP2   = ERP2.arr * 86400
+
+; emp (evaporation minus precipitation)
+  EMP1   = read_ncdf('wfo', d1, d2, filename = std_iodir_data+std_file1_T     )
+  EMP2   = read_ncdf('wfo', d1, d2, filename = std_iodir_data+std_file2_T     )
+  EMP1   = EMP1.arr * 86400
+  EMP2   = EMP2.arr * 86400
+
+ 
+;mixed layer depth
+  MXL1 = read_ncdf('mldr10_1', d1, d2, filename = std_iodir_data+std_file1_T         )  ; 10 m
+  MXL2 = read_ncdf('mldr10_1', d1, d2, filename = std_iodir_data+std_file2_T         )  ; 10 m
+;climatology 
+  MLD  = read_ncdf('mld', filename = std_iodir_climato+'mld_DR003_c1m_ORCA2_1y.nc'   )
+
+; current
+  U1   = read_ncdf('uoce_eff', d1, d2, filename = std_iodir_data+std_file1_U         )
+  U2   = read_ncdf('uoce_eff', d1, d2, filename = std_iodir_data+std_file2_U         )
+
+; Take into account the Gent & McWilliams "Eddy Induced velocity"
+  V1   = read_ncdf('voce_eff', d1, d2, filename = std_iodir_data+std_file1_V         )
+  V2   = read_ncdf('voce_eff', d1, d2, filename = std_iodir_data+std_file2_V         )
+
+; ice
+  Ithi_mars_1   = read_ncdf('sit', id_mars_1, id_mars_2, filename = std_iodir_data+std_file1_I ) 
+  Ithi_mars_2   = read_ncdf('sit', id_mars_1, id_mars_2, filename = std_iodir_data+std_file2_I )
+
+  Ithi_sept_1   = read_ncdf('sit', id_sept_1, id_sept_2, filename = std_iodir_data+std_file1_I ) 
+  Ithi_sept_2   = read_ncdf('sit', id_sept_1, id_sept_2, filename = std_iodir_data+std_file2_I )
+
+  Ifra_mars_1   = read_ncdf('sic', id_mars_1, id_mars_2, filename = std_iodir_data+std_file1_I )
+  Ifra_mars_2   = read_ncdf('sic', id_mars_1, id_mars_2, filename = std_iodir_data+std_file2_I )
+
+  Ifra_sept_1   = read_ncdf('sic', id_sept_1, id_sept_2, filename = std_iodir_data+std_file1_I )
+  Ifra_sept_2   = read_ncdf('sic', id_sept_1, id_sept_2, filename = std_iodir_data+std_file2_I )
+
+ 
+;#########################################################################
+
+;#########################################################################
+;######################  STANDARD PLOTS   ################################
+;#########################################################################
+
+; fixed color tabled
+  lct,64
+
+  PRINT, '  ' 
+  PRINT, '				Experience treated:', std_EXP1
+  PRINT, '  ' 
+  PRINT, '  ' 
+  PRINT, '  ' 
+
+       ;;;;;;;; ErP & Emp salinity damping term
+       ;;;;;;;; =============================================
+  PRINT, '============================================= '
+  PRINT, ' PLOTS 2D '
+  PRINT, '============================================= '
+  PRINT, '                                ErP salinity damping term'
+  PRINT, '1'
+  xxx_Erp, ERP1, ERP2, std_EXP1, std_EXP2, start_end, _extra = ex
+  PRINT, '2'
+  xxx_Emp, EMP1, EMP2, std_EXP1, std_EXP2, start_end, _extra = ex
+ 
+       ;;;;; Net heat flux
+        ;;;;; =============
+  PRINT, ' '
+  PRINT, '                               Net heat flux'
+  PRINT, '3 '
+  xxx_Qnet, Q1, Q2, QNET, std_EXP1, std_EXP2, start_end, _extra = ex
+
+       ;;; Meridionnal Heat Transport
+        ;;; ===========================
+  PRINT, ' '
+  PRINT, '                               Meridionnal Heat Transport'
+  PRINT, '4 '
+  fig_ht_fromQ, Q1.arr+geo, Q2.arr+geo, std_EXP1, std_EXP2, start_end, MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+
+        ;;; Global Barotropic Function
+        ;;; ===========================
+  PRINT, ' '
+  PRINT, ' 				Global Barotropic Function ' 
+  PRINT, '5 '
+  plt_bsf, U1, U2, std_EXP1, std_EXP2, start_end, _extra=ex
+
+  ;; mean Temperature diff with New Reynolds
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 				mean Temperature diff with New Reynolds'
+  PRINT, '6 '
+  xxx_SST, T1[*,*,0], T2[*,*,0], TRey, std_EXP1, std_EXP2, start_end, _extra=ex
+
+
+        ;;;; mean Salinity diff with Levitus
+        ;;;; ===============================
+  PRINT, ' '
+  PRINT, '                               mean Salinity diff with Levitus'
+  PRINT, '7 '
+  xxx_SSS, S1[*,*,0], S2[*,*,0], SLev[*,*,0], std_EXP1, std_EXP2, start_end, _extra=ex
+
+      ;;;;;;; Arctic mean Salinity diff with Levitus at z=105 meters
+        ;;;;;;; ======================================================
+  PRINT, ' '
+  PRINT, '                               Arctic mean Salinity diff with Levitus at z=105 meters'
+  PRINT, '8 exp1-levitus'
+  xxx_EXP1_S_ARC_z105, S1, SLev, std_EXP1, std_EXP2, start_end, _extra = ex       
+  PRINT, '9 exp2-levitus'
+  xxx_EXP2_S_ARC_z105, S1, S2, SLev, std_EXP1, std_EXP2, start_end, _extra = ex
+
+
+        ;;;;;;;; mean Temperature diff with Levitus at z=105 meters
+        ;;;;;;;; ==================================================
+  PRINT, ' '
+  PRINT, '                               mean Temperature diff with Levitus at z=105 meters'
+  PRINT, '10'
+  xxx_T_z105, T1, T2, TRey, std_EXP1, std_EXP2, start_end, _extra=ex
+                              
+
+        ;;;;;;;; mean Salinity diff with Levitus at z=105 meters
+        ;;;;;;;; ==================================================
+  PRINT, ' '
+  PRINT, '                               mean Salinity diff with Levitus at z=105 meters'
+  PRINT, '11'
+  xxx_S_z105, S1, S2, SLev, std_EXP1, std_EXP2, start_end, _extra=ex
+                            
+
+  PRINT, '============================================= '
+  PRINT, ' PLOTS 3D '
+  PRINT, '============================================= '
+ 
+  PRINT, '                         Mixed layer depth'
+  PRINT, '12 '
+  xxx_mxl10, MXL1, MXL2, MLD, std_EXP1, std_EXP2, start_end,  _extra = ex
+  PRINT, '13'
+  xxx_ZonMxl, MXL1, MXL2, MLD, std_EXP1, std_EXP2, start_end, _extra = ex
+ 
+
+        ;;;;;;;;; Zonal mean Temperature diff with Levitus
+        ;;;;;;;;; ========================================
+  PRINT, ' '
+  PRINT, '                               Zonal mean Temperature diff with Levitus'
+  PRINT, '14 '
+  xxx_zonal_T, T1, T2, TLev, std_EXP1, std_EXP2, start_end, MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+
+  PRINT, '14 '                      
+  xxx_zonal_T, T1, T2, TLev, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Atl', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+  
+  PRINT, '14 '
+  xxx_zonal_T, T1, T2, TLev, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Ind', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+  
+  PRINT, '14 '
+  xxx_zonal_T, T1, T2, TLev, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Pac', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+ 
+
+        ;;;;;;;;;; Zonal mean Salinity diff with Levitus
+        ;;;;;;;;;; ========================================
+  PRINT, ' '
+  PRINT, '                               Zonal mean Salinity diff with Levitus'
+  PRINT, '15 '
+  xxx_zonal_S, S1, S2, SLev, std_EXP1, std_EXP2, start_end, MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+                               
+  PRINT, '15 '
+  xxx_zonal_S, S1, S2, SLev, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Atl', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+                              
+  PRINT, '15'
+  xxx_zonal_S, S1, S2, SLev, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Ind', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex 
+
+  PRINT, '15 '
+  xxx_zonal_S, S1, S2, SLev, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Pac', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex 
+  
+        ;;;;;;; Seasonal & Annual mean Arctic/Antarctic Ice Thickness & Ice Concentration
+        ;;;;;; ==========================================================================
+  PRINT, ' '
+  PRINT, '                               Arctic/Antarctic Ice Thickness'
+  PRINT, ' 16'
+  xxx_ARC_Icethick_MARS, Ithi_mars_1, Ithi_mars_2, std_EXP1, std_EXP2, start_end, _extra = ex
+ 
+  PRINT, ' 16'
+  xxx_ARC_Icethick_SEPT, Ithi_sept_1, Ithi_sept_2, std_EXP1, std_EXP2, start_end, _extra = ex
+ 
+  PRINT, ' 17'
+  xxx_ANT_Icethick_MARS, Ithi_mars_1, Ithi_mars_2, std_EXP1, std_EXP2, start_end, _extra = ex
+
+  PRINT, ' 17'
+  xxx_ANT_Icethick_SEPT, Ithi_sept_1, Ithi_sept_2, std_EXP1, std_EXP2, start_end, _extra = ex
+
+  PRINT, '                               Arctic/Antarctic Ice Concentration (area of sea-ice per grid cell area'
+  PRINT, ' 18'
+  xxx_Iceleadfrac_MARS, Ifra_mars_1, Ifra_mars_2, std_EXP1, std_EXP2, start_end, _extra = ex
+
+  PRINT, ' 18'
+  xxx_Iceleadfrac_SEPT, Ifra_sept_1, Ifra_sept_2, std_EXP1, std_EXP2, start_end, _extra = ex
+
+                       
+        ;;; Global and Atlantic Meridional Function
+        ;;; =======================================
+  PRINT, ' '
+  PRINT, ' 				Global and Atlantic Meridional Function'
+  PRINT, '19 '
+  plt_msf, V1, V2, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Glo', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+  PRINT, '19 '
+  plt_msf, V1, V2, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Atl', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+  PRINT, '19 '
+  plt_msf, V1, V2, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Ind', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+  PRINT, '19 '
+  plt_msf, V1, V2, std_EXP1, std_EXP2, start_end, SUBBASIN = 'Pac', MASK_FILENAME = std_iodir_mask+'subbasins_orca21_nored.nc', _extra = ex
+
+
+  PRINT, '============================================= '
+  PRINT, ' Local PLOTS '
+  PRINT, '============================================= '
+
+        ;;;;;;;;; Equatorial Temperature 
+        ;;;;;;;;; ======================
+  PRINT, ' '
+  PRINT, '                               Equatorial Temperature'
+  PRINT, ' '
+  PRINT, '20 '
+  xxx_Eq_T, T1, T2, Tlev, std_EXP1, std_EXP2, start_end, _extra = ex
+
+        ;;;;;;;; Equatorial Salinity 
+        ;;;;;;;; ===================
+  PRINT, ' '
+  PRINT, '                               Equatorial Salinity'
+  PRINT, '21'
+  xxx_Eq_S, S1, S2, SLev, std_EXP1, std_EXP2, start_end, _extra = ex
+
+        ;;; Equatorial zonal velocity
+        ;;; =========================
+  PRINT, ' '
+  PRINT, '                               Equatorial zonal velocity'
+  PRINT, '22 '
+  xxx_Eq_U, U1, U2, std_EXP1, std_EXP2, start_end, _extra = ex
+  
+       ;;;;;;;;;;;; Mediterranean salt tongue 
+       ;;;;;;;;;;;; =============================================== 
+  
+  PRINT, ' '
+  PRINT, '                               Mediterranean salt tongue at depth=700 and lat 40°N'
+  PRINT, '23'
+  xxx_Med_S_tongue, S1, S2, SLev, std_EXP1, std_EXP2, start_end, DEPTH = 700,  LAT = 40, _extra = ex
+  ;
+  PRINT, '                               Mediterranean salt tongue at depth=1000 and lat 38°N'
+  PRINT, '23'
+  xxx_Med_S_tongue, S1, S2, SLev, std_EXP1, std_EXP2, start_end, DEPTH = 1000, LAT = 38, _extra = ex
+
+        ;;;;;;;;; Mediterranean 
+        ;;;;;;;;; ===============================================
+  PRINT, ' '
+  PRINT, '                               Mediterranean water at 38°N'
+  PRINT, '24'
+  xxx_Med_S_depth, S1, S2, SLev, std_EXP1, std_EXP2, start_end, DEPTH = 1000, LAT = 38, _extra = ex
+  PRINT, '                               Mediterranean water at 38°N'
+  PRINT, '24 '
+  xxx_Med_S_depth, S1, S2, SLev, std_EXP1, std_EXP2, start_end, DEPTH = 700,  LAT = 40, _extra = ex
+
+        ;;;;;;;;;;; Vertical Global mean T & S
+        ;;;;;;;;;;; ===========================
+  PRINT, ' '
+  PRINT, '                                Vertical Global mean T & S'
+  PRINT, '25 '
+  xxx_TS_ZGlobm, T1, T2, TLev, S1, S2, SLev, std_EXP1, std_EXP2, start_end, _extra = ex
+
+ 
+  return
+END
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_plots.sh
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_plots.sh	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_plots.sh	(revision 2200)
@@ -0,0 +1,198 @@
+#!/bin/sh 
+#
+# AUTHOR - date
+# ===========
+# Françoise Pinsard - 01/2010 - LOCEAN
+# Simona Flavoni  - 01/2010 - LOCEAN
+#
+# DESCRIPTION
+# ===========
+# Graphics outputs files are written in ./exp1_exp2/ps/.
+#
+# A global document with all plots in Postscript, PDF or HTML file can be produced.
+# 
+# EXAMPLES
+# ========
+# $ ./std_plots.sh -exp1 v32colib -exp2 v32colib -y 19800101_19801231 -format html
+# 
+# $ ./std_plots.sh -exp1 core100 -exp2 core100 -y 00910101_01001231 -format pdf
+#
+# PROBLEMS
+# ========
+# no batch processing possible because of SAXO interactiviy Seb is working on it ...
+#
+# TODO
+# ====
+# portability on linux
+# define overriding policy
+# finalize ps and pdf production 
+#
+usage=" Usage : ${command} -exp1 exp1 -exp2 exp2 -y start -format html
+ example:  ./std_plots.sh -exp1 core2000 -exp2 core2000 -y 1991 -format pdf 
+ exp1 is your experience name
+ exp2 is the reference experience (if you don't have one exp2 = exp1)
+ ystart is the first year of your 10years file output; example: 361 if you want to take file core2000_03610101_03701231_1Y_grid_T.nc"
+#
+minargcount=8
+if [ ${#} -lt ${minargcount} ]; then
+ echo "Not enought arguments"
+ echo "${usage}"
+ exit 1
+fi
+#
+while [ ! -z "${1}" ] # ++ pb bash
+do
+ case ${1} in
+     -exp1)	 exp1=${2}        shift  ;;
+     -exp2)	 exp2=${2}        shift  ;;
+     -y)	 ystart=${2}	  shift	 ;;
+     -format)	 format=${2}	  shift	 ;;
+     -h)	
+	 echo "${usage}"
+	 exit 0	
+	 ;;
+     *) # other choice
+	 echo "${usage}"
+	 exit 1
+	 ;;
+ esac
+ shift # next flag
+done
+#
+# ++ check parameters
+set -u
+#
+# define output directory for POSTCRIPT files
+#++ change directory
+#===============CHANGE DIRECTORIES==========================
+psdir=~/PS/${exp1}_${exp2}/ps/
+pdfdir=~/PDF/${exp1}_${exp2}/pdf
+htmldir=~/HTML/${exp1}_${exp2}/pdf
+#===============END CHANGE DIRECTORIES=======================
+# test if ${psdir} already exists
+if [ -d ${psdir} ]; then
+ echo "${psdir} already exist"
+ #+++exit 1
+else
+ mkdir -p ${psdir}
+fi 
+# test if ${pdfdir} already exists
+if [ -d ${pdfdir} ]; then
+ echo "${psdir} already exist"
+ #+++exit 1
+else
+ mkdir -p ${pdfdir}
+fi 
+
+# memorize current IDL_STARTUP file
+memo_idl_startup=${IDL_STARTUP}
+
+# generation of IDL commands file to launch several std_plots commands
+# NOTE:  $(( 10#${ystart} )) is used to have decimal, if not the number that start with 0 (for example if you put 0361) would be interpeted like alphanumerical number 
+rm /tmp/std_plots_multi.pro 2> /dev/null
+cat << EOF >> /tmp/std_plots_multi.pro
+ psdir='${psdir}'
+ std_plots,'${exp1}','${exp2}', $(( 10#${ystart} )), /postscript
+ exit
+EOF
+#
+idl_command='/Applications/itt/idl64/bin/idl'  # !! only on my mac
+#
+# check if IDL available
+type ${idl_command}
+status_type=${?}
+if [ ${status_type} -ne 0 ]
+then
+ echo "eee : idl not found"
+ exit 1
+fi
+# debug
+more /tmp/std_plots_multi.pro
+#
+# launch IDL
+${idl_command} /tmp/std_plots_multi.pro
+status_idl=${?}
+# test if idl returns ok
+#echo "iii : ${status_idl}"
+#
+# restore IDL_STARTUP file
+IDL_STARTUP=${memo_idl_startup}
+export IDL_STARTUP
+
+# produce the final document
+case ${format} in
+    pdf)
+	rm ${pdfdir}/all_plots.pdf 2> /dev/null
+	for file in ${psdir}/*.ps ; do
+	    echo "ps2pdf"
+#           echo "nome file: ${file}"
+		ps2pdf -sPAPERSIZE=a4 ${file}
+	done
+#	echo "dentro pdf"
+	ls ${pdfdir}
+	mv *.pdf ${pdfdir}/.
+	texexec --pdfarrange --result=/tmp/all_plots.pdf ${pdfdir}/*.pdf
+	rm -rf *.aux *.log /tmp/*.log
+	mv /tmp/all_plots.pdf ${pdfdir}
+#commented because convert gives images of bad quality
+#	convert ${psdir}/*.ps /tmp/all_plots.pdf
+#       convert -resize 800x600 ${psdir}/${exp1}_${exp2}/ps/*.ps /tmp/all_plots.pdf
+	;;
+    html)
+	rm /tmp/std_plots.html 2> /dev/null
+# check if convert available
+	convert_command='/sw/bin/convert'  # !! only on my mac
+	type ${convert_command}
+	status_type=${?}
+	if [ ${status_type} -ne 0 ]
+	then
+	    echo "eee : convert not found"
+	    exit 1
+	fi
+# debug
+	
+	for file in `ls ${psdir}/*.ps | sed -e "s/\.ps//"` ; do
+	    ${convert_command} -antialias  ${file}.ps  ${file}.png
+	done
+	 # creation of a HTML file
+	cat << EOF > /tmp/std_plots.html
+	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+	<html xmlns="http://www.w3.org/1999/xhtml">
+	<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+        <hr>
+       	</head>
+	<body>
+EOF
+	cat /tmp/std_plots.txt >>  /tmp/std_plots.html
+	cat << EOF >> /tmp/std_plots.html
+<hr/>
+EOF
+	
+	cat << EOF >> /tmp/std_plots.html
+
+  </body>
+  </html>
+EOF
+	more /tmp/std_plots.html
+	;;
+    *)	
+	echo " format ${format} not implemented"
+	exit 1
+	;;
+esac
+
+    #
+#=====================
+# prepare to put images on dods
+# +++ to finish it
+#LOGIN=xxxx
+#Tag_Name=ORCA2_LIM2
+#rsh ${LOGIN}@gaya.idris.fr exec /bin/ksh <<EOF
+#       cd ${homegaya}/IGCM_OUT/${Tag_Name}/CORE2/INTERAN/plots_pdf/${exp1}
+#       /usr/local/bin/dods_rm DODS/pub/${LOGIN}/${Tag_Name}/CORE2/INTERAN/plots_pdf/${exp1} > /dev/null 2>&1
+#       /usr/local/bin/dods_cp ${exp1} DODS/pub/${LOGIN}/${Tag_Name}/CORE2/INTERAN/plots_pdf/${exp1} > /dev/null 2>&1
+#EOF
+#=====================
+# end
+exit 0
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_ts.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_ts.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/std_ts.pro	(revision 2200)
@@ -0,0 +1,99 @@
+pro std_ts, std_EXP1, std_EXP2, year1, year2, _extra=ex
+
+
+PRINT, 'usage: postscript '
+PRINT, '========================================================================'
+PRINT, 'std_ts, ''std_EXP1'', ''std_EXP2'', ''year_start'', ''year_end'', /postscript'
+PRINT, '========================================================================'
+PRINT, 'std_ts, ''core2000'', ''core2000'', ''1'', ''2000'', /postscript'
+PRINT, '========================================================================'
+
+
+  compile_opt idl2, strictarrsubs
+
+  PRINT, ''
+  PRINT, ' 	############################################'
+  PRINT, ''
+  PRINT, '                   plot of all TIME SERIES'
+  PRINT, ''
+  PRINT, ' 	############################################'
+  PRINT, ''
+
+
+@common
+@initorca2
+@std_com
+
+
+;  std_iodir_data    = '/Users/sflod/idl_PLOTS/DATA_STORE/RUN_INTERAN/mercure/' ; path of data in NetCdf format
+  std_iodir_data    = '/Users/sflod/idl_PLOTS/DATA_STORE/RUN_CLIMATO/brodie/' ; path of data in NetCdf format
+
+
+;#########################################################################
+;######################  TIME SERIES   ################################
+;#########################################################################
+
+; fixed color tabled
+  lct,64
+
+ 
+
+  ;; Temperature Mean
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 			 Temperature Mean'
+  PRINT, '1 '
+  ts_mean_T, std_EXP1, std_EXP2, year1, year2, std_iodir_data, _extra = ex
+
+  ;; Salinity Mean
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 			 Salinity Mean'
+  PRINT, '2 '
+  ts_mean_S, std_EXP1, std_EXP2, year1, year2, std_iodir_data, _extra = ex
+  
+  ;; Sea Surface Height
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 			 SSH'
+  PRINT, '3 '
+  ts_mean_SSH, std_EXP1, std_EXP2, year1, year2, std_iodir_data, _extra = ex
+
+   ;; Heat flux Mean
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 			 Heat Mean'
+  PRINT, '4 '
+  ts_mean_Q, std_EXP1, std_EXP2, year1, year2, std_iodir_data, _extra = ex
+
+  ;; EMP Mean
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 			 EMP Mean'
+  PRINT, '5 '
+  ts_mean_EMP, std_EXP1, std_EXP2, year1, year2, std_iodir_data, _extra = ex
+
+
+  ;; Drake transport
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 		         Drake Transport'
+  PRINT, '6 '
+  ts_mean_U, std_EXP1, std_EXP2, year1, year2, std_iodir_data, _extra = ex
+
+  ;; Max AMOC
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 		         Max AMOC'
+  PRINT, '7 '
+  ts_mean_V, std_EXP1, std_EXP2, year1, year2, std_iodir_data, _extra = ex
+
+  ;; Sea-Ice Area 
+  ;; =======================================
+  PRINT, ' '
+  PRINT, ' 		         Sea-Ice Area'
+  PRINT, '8 '
+  ts_mean_ICE, std_EXP1, std_EXP2, year1, year2, std_iodir_data, _extra = ex
+
+  return
+END
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/time_series.sh
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/time_series.sh	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/time_series.sh	(revision 2200)
@@ -0,0 +1,183 @@
+#!/bin/sh 
+#
+# AUTHOR - date
+# ===========
+# Simona Flavoni  - 02/2010 - LOCEAN
+#
+# DESCRIPTION
+# ===========
+# Graphics outputs files are written in my_IDL/PS/ps_ts/.
+#
+# A global document with all plots in Postscript, PDF or HTML file can be produced.
+# 
+# EXAMPLES
+# ========
+# $ ./time_series.sh -exp1 sEXP1 -exp2 sEXP2 -ystart year1 -yend year2 -format pdf
+# 
+# PROBLEMS
+# ========
+# no batch processing possible because of SAXO interactiviy Seb is working on it ...
+#
+# TODO
+# ====
+# portability on linux
+# define overriding policy
+# finalize ps and pdf production 
+#
+usage=" Usage : ${command} -exp1 exp1 -exp2 exp2 -ystart start -yend end -format pdf
+ exp1 is your experience name
+ exp2 is name of experience of reference 
+ ystart is the first year from which you want to compute Time Series 
+ yend is the last year for which you want to compute Time Series 
+ example:  ./time_series.sh -exp1 core2000 -exp2 core2000 -ystart 1 -yend 2000 -format pdf "
+#
+minargcount=10
+if [ ${#} -lt ${minargcount} ]; then
+ echo "Not enought arguments"
+ echo "${usage}"
+ exit 1
+fi
+#
+while [ ! -z "${1}" ] # ++ pb bash
+do
+ case ${1} in
+     -exp1)	 exp1=${2}        shift  ;;
+     -exp2)	 exp2=${2}        shift  ;;
+     -ystart)	 start=${2}	  shift	 ;;
+     -yend)	 end=${2}	  shift	 ;;
+     -format)	 format=${2}	  shift	 ;;
+     -h)	
+	 echo "${usage}"
+	 exit 0	
+	 ;;
+     *) # other choice
+	 echo "${usage}"
+	 exit 1
+	 ;;
+ esac
+ shift # next flag
+done
+#
+# ++ check parameters
+set -u
+#
+# define output directory for POSTCRIPT files
+#++ change directory
+#================CHANGE DIRECTORIES=====================
+psdir=/path_output_PS_time_series
+pdfdir=/path_output_PDF_time_series
+htmldir=/path_output_HTML_time_series
+#================END CHANGE DIRECTORIES=================
+# test if ${psdir} already exists
+if [ -d ${psdir} ]; then
+ echo "${psdir} already exist"
+ #+++exit 1
+else
+ mkdir -p ${psdir}
+fi 
+# test if ${pdfdir} already exists
+if [ -d ${pdfdir} ]; then
+ echo "${psdir} already exist"
+ #+++exit 1
+else
+ mkdir -p ${pdfdir}
+fi 
+
+# memorize current IDL_STARTUP file
+memo_idl_startup=${IDL_STARTUP}
+
+# generation of IDL commands file to launch several std_plots commands
+rm /tmp/time_series_multi.pro 2> /dev/null
+cat << EOF >> /tmp/time_series_multi.pro
+ psdir='${psdir}'
+ std_ts,'${exp1}','${exp2}',${start},${end},/postscript
+ exit
+EOF
+#
+idl_command='/Applications/itt/idl64/bin/idl'  # !! only on my mac
+#
+# check if IDL available
+type ${idl_command}
+status_type=${?}
+if [ ${status_type} -ne 0 ]
+then
+ echo "eee : idl not found"
+ exit 1
+fi
+# debug
+more /tmp/time_series_multi.pro
+#
+# launch IDL
+${idl_command} /tmp/time_series_multi.pro
+status_idl=${?}
+# test if idl returns ok
+# echo "iii : ${status_idl}"
+#
+# restore IDL_STARTUP file
+IDL_STARTUP=${memo_idl_startup}
+export IDL_STARTUP
+
+# produce the final document
+case ${format} in
+    pdf)
+	rm ${pdfdir}/all_ts.pdf 2> /dev/null
+	echo "psdir: ${psdir}"
+	for file in ${psdir}/*.ps ; do
+	    echo "ps2pdf"
+		ps2pdf -sPAPERSIZE=a4 ${file}
+	done
+	ls ${pdfdir}
+	mv *.pdf ${pdfdir}/.
+	texexec --pdfarrange --result=/tmp/all_ts.pdf ${pdfdir}/*.pdf
+	rm -rf *.aux *.log /tmp/*.log
+	mv /tmp/all_ts.pdf ${pdfdir}/all_ts.pdf
+#commented because convert gives images of bad quality
+#	convert ${psdir}/*.ps /tmp/all_ts.pdf
+#       convert -resize 800x600 ${psdir}/${exp1}_${exp2}/ps/*.ps /tmp/all_ts.pdf
+	;;
+    html)
+	rm /tmp/time_series.html 2> /dev/null
+# check if convert available
+	convert_command='/sw/bin/convert'  # !! only on my mac
+	type ${convert_command}
+	status_type=${?}
+	if [ ${status_type} -ne 0 ]
+	then
+	    echo "eee : convert not found"
+	    exit 1
+	fi
+# debug
+	
+	for file in `ls ${psdir}/*.ps | sed -e "s/\.ps//"` ; do
+	    ${convert_command} -antialias  ${file}.ps  ${file}.png
+	done
+	 # creation of a HTML file
+	cat << EOF > /tmp/time_series.html
+	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+	<html xmlns="http://www.w3.org/1999/xhtml">
+	<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+        <hr>
+       	</head>
+	<body>
+EOF
+	cat /tmp/time_series.txt >>  /tmp/time_series.html
+	cat << EOF >> /tmp/time_series.html
+<hr/>
+EOF
+	
+	cat << EOF >> /tmp/time_series.html
+
+  </body>
+  </html>
+EOF
+	more /tmp/time_series.html
+	;;
+    *)	
+	echo " format ${format} not implemented"
+	exit 1
+	;;
+esac
+
+    #
+exit 0
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_EMP.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_EMP.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_EMP.pro	(revision 2200)
@@ -0,0 +1,66 @@
+pro ts_mean_EMP, sEXP1, sEXP2, year1, year2, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+
+  compile_opt idl2, strictarrsubs
+  
+  @common
+
+ @initorca2
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, sEXP1+'_EMP_mean.ps', portrait = 1
+ endif
+
+ ts_EMP = 0.
+ ts_EMP2 = 0.
+ ts_Time = 0.
+
+ for year=year1,year2 do begin
+
+ date1 = year * 10000L + 101
+ date2 = year * 10000L + 1231
+ filename = getname(s_iodir_data,sEXP1,'1Y','grid_T',date1)
+ filename2 = getname(s_iodir_data,sEXP2,'1Y','grid_T',date1)
+
+ if filename eq '' then stop 
+ EMP = read_ncdf('wfo',date1 ,date2 , filename = filename, /nostruct)
+ EMP2 = read_ncdf('wfo',date1 ,date2 , filename = filename2, /nostruct)
+
+ ts_EMP = [ ts_EMP, moyenne(EMP, 'xy')]
+ ts_EMP2 = [ ts_EMP2, moyenne(EMP2, 'xy')]
+ ts_Time = [ ts_Time, Time] ; Time = date
+
+ endfor
+
+  surf_oce =  e1t * e2t  * tmask[*,*,0]
+  surf_oce = total(surf_oce)
+
+  ts_EMP = ts_EMP[1:*] ; remove first record of 0
+  ts_EMP = ts_EMP * 1.E-09 * surf_oce ; to have Sv
+
+  ts_EMP2 = ts_EMP2[1:*]                ; remove first record of 0
+  ts_EMP2 = ts_EMP2 * 1.E-09 * surf_oce ; to have Sv
+
+  varunit= 'Sv'
+  vol_oce = moyenne( replicate(1., jpi, jpj, jpk), /integration, 'xyz')
+
+  Time = ts_Time[1:*] ; remove first record of 0
+  jpt = n_elements(Time)
+
+  title = sEXP1+' Global Annual EMP Budget (Sv) --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt,ts_EMP,'t', -.01, 0.00, year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI $
+       , small = [1,2,1], YTITLE = 'Sv', TITLE = title, /PORTRAIT, _extra = ex
+
+  if sEXP2 ne sEXP1 then begin
+     
+     title = sEXP1+' - '+sEXP2+' Global Annual EMP Budget (Sv) --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+     pltt,ts_EMP - ts_EMP2,'t', -.002, .002, year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI, /NOERASE $
+          , COLOR = 250, small = [1,2,2], YTITLE = 'Sv', TITLE = title, /PORTRAIT, _extra = ex
+  endif
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+
+  return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_ICE.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_ICE.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_ICE.pro	(revision 2200)
@@ -0,0 +1,100 @@
+pro ts_mean_ICE, sEXP1, sEXP2, year1, year2, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+
+  compile_opt idl2, strictarrsubs
+  
+  @common
+  
+  @initorca2
+  
+  std_iodir_climato = '/Users/sflod/idl_PLOTS/CLIMATOLOGIES/'
+  std_iodir_interan = '/Users/sflod/idl_PLOTS/INTERAN/'
+
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, sEXP1+'_ice_area_mean.ps', portrait = 1
+  endif
+  
+  
+
+;NORTHERN Hemisphere
+  ts_ICE_N = 0.
+  ts_ICE_N_2 = 0.
+
+;SOUTHERN Hemisphere
+  ts_ICE_S = 0.
+  ts_ICE_S_2 = 0.
+
+  ts_Time = 0.
+  
+  for year=year1,year2 do begin
+     date1 = year * 10000L + 101
+     date2 = year * 10000L + 1231
+     filename = getname(s_iodir_data,sEXP1,'1M','icemod',date1)
+     filename2 = getname(s_iodir_data,sEXP2,'1M','icemod',date1)
+
+     if filename eq '' then stop
+     
+     domdef, 0, jpi-1, 30, 90, /xindex
+
+; computation of annual mean
+     ICE_N = read_ncdf('sic',date1 ,date2 , filename = filename, /nostruct, dir = 't')
+     ICE_N_2 = read_ncdf('sic',date1 ,date2 , filename = filename2, /nostruct, dir = 't')
+     
+     ts_ICE_N   = [ ts_ICE_N, moyenne(ICE_N, 'xy', /integration) ]
+     ts_ICE_N_2 = [ ts_ICE_N_2, moyenne(ICE_N_2, 'xy', /integration) ]
+    
+     domdef, 0, jpi-1, -30, -90, /xindex
+     
+     ICE_S = read_ncdf('sic',date1 ,date2 , filename = filename, /nostruct, dir = 't')
+     ICE_S_2 = read_ncdf('sic',date1 ,date2 , filename = filename2, /nostruct, dir = 't')
+     
+     ts_ICE_S   = [ ts_ICE_S, moyenne(ICE_S, 'xy', /integration) ]
+     ts_ICE_S_2 = [ ts_ICE_S_2, moyenne(ICE_s_2, 'xy', /integration) ]
+ 
+    ts_Time  = [ ts_Time, Time] ; Time = date
+ 
+  endfor
+
+;  surf_oce =  e1t[firstxt:lastxt,firstyt:lastyt] * e2t[firstxt:lastxt,firstyt:lastyt]  * tmask[firstxt:lastxt,firstyt:lastyt,0]
+;  surf_oce = total(surf_oce)
+
+  ts_ICE_N   = ts_ICE_N[1:*]        ; remove first record of 0 
+  ts_ICE_N_2 = ts_ICE_N_2[1:*]      ; remove first record of 0
+  ts_ICE_N   = ts_ICE_N * 1.E-12    ; remove first record of 0
+  ts_ICE_N_2 = ts_ICE_N_2 * 1.E-12  ; remove first record of 0
+  
+  ts_ICE_S   = ts_ICE_S[1:*]        ; remove first record of 0 
+  ts_ICE_S_2 = ts_ICE_S_2[1:*]      ; remove first record of 0
+  ts_ICE_S   = ts_ICE_S * 1.E-12    ; remove first record of 0
+  ts_ICE_S_2 = ts_ICE_S_2 * 1.E-12  ; remove first record of 0
+  
+  Time = ts_Time[1:*]           ; remove first record of 0
+  jpt = n_elements(Time)
+  
+  title = sEXP1+' Global Annual Mean Ice Area (North. Hemisp.) --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt, ts_ICE_N, 't', 0., 15., year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI $
+       , small = [1,2,1], YTITLE='10^12 m^2 ', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+  
+  title = sEXP1+' Global Annual Mean Ice Area (South. Hemisp.) --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt, ts_ICE_S, 't', 0., 15., year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI, /NOERASE $
+        , small = [1,2,2], YTITLE='10^12 m^2 ', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+  
+  if sEXP2 ne sEXP1 then begin
+     title = sEXP1+'  - '+sEXP2+' Global Annual Mean Ice Area (North. Hemisp.) --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+     pltt, ts_ICE_N - ts_ICE_N_2 , 't', -2., 2., year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI $
+           , COLOR = 250, small = [1,2,1], YTITLE='10^12 m^2 ', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+     
+     title = sEXP1+' - '+sEXP2+' Global Annual Mean Ice Area (South. Hemisp.) --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+     pltt, ts_ICE_S - ts_ICE_S_2, 't', -2., 2., year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI, /NOERASE $
+           , COLOR = 250, small = [1,2,2], YTITLE='10^12 m^2 ', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+
+  endif
+
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+  
+  
+  return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_Q.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_Q.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_Q.pro	(revision 2200)
@@ -0,0 +1,59 @@
+pro ts_mean_Q, sEXP1, sEXP2, year1, year2, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+
+  compile_opt idl2, strictarrsubs
+  
+  @common
+  
+ @initorca2
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, sEXP1+'_Heat_mean.ps', portrait = 1
+ endif
+ 
+ ts_Heat = 0.
+ ts_Heat2 = 0.
+ ts_Time = 0.
+
+ for year=year1,year2 do begin
+    
+    date1 = year * 10000L + 101
+    date2 = year * 10000L + 1231
+    filename = getname(s_iodir_data,sEXP1,'1Y','grid_T',date1)
+    filename2 = getname(s_iodir_data,sEXP2,'1Y','grid_T',date1)
+
+    if filename eq '' then stop 
+    Heat = read_ncdf('qns+qsr',date1 ,date2 , filename = filename, /nostruct)
+    Heat2 = read_ncdf('qns+qsr',date1 ,date2 , filename = filename2, /nostruct)
+
+    ts_Heat = [ ts_Heat, moyenne(Heat, 'xy')]
+    ts_Heat2 = [ ts_Heat2, moyenne(Heat2, 'xy')]
+    ts_Time = [ ts_Time, Time]  ; Time = date
+
+ endfor
+ 
+ ts_Heat = ts_Heat[1:*]         ; remove first record of 0
+ ts_Heat2 = ts_Heat2[1:*]         ; remove first record of 0
+ Time = ts_Time[1:*]            ; remove first record of 0
+ 
+ jpt = n_elements(Time)
+ 
+ title = sEXP1+' Global Annual Mean Surface Heat Flux --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+ pltt,ts_Heat,'t', -4., 4., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+      , small = [1,2,1], YTITLE = 'W/m2',  TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+
+ if sEXP2 ne sEXP1 then begin
+
+    title = sEXP1+' - '+sEXP2+' Global Annual Mean Surface Heat Flux --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+    pltt,ts_Heat - ts_Heat2,'t', -4., 4., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI, /NOERASE $
+         ,  COLOR = 250, small = [1,2,2], YTITLE = 'W/m2', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+    
+ endif
+
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+ 
+ 
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_S.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_S.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_S.pro	(revision 2200)
@@ -0,0 +1,103 @@
+pro ts_mean_S, sEXP1, sEXP2, year1, year2, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+
+  compile_opt idl2, strictarrsubs
+  
+  @common
+  
+  @initorca2
+  
+  std_iodir_climato = '/Users/sflod/idl_PLOTS/CLIMATOLOGIES/'
+  std_iodir_interan = '/Users/sflod/idl_PLOTS/INTERAN/'
+
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, sEXP1+'_Salinity_mean.ps', portrait = 1
+  endif
+  
+  filename = std_iodir_climato+'data_1y_salinity_nomask.nc'
+  Lev = read_ncdf('vosaline', filename = filename, /nostruct )
+  Lev_xyz = moyenne(Lev, 'xyz')
+  Lev_z = moyenne(Lev, 'xy',/KEEPBOTTOM)
+
+  ts_Sal = 0.
+  ts_Sal_2 = 0.
+  ts_Sal_Lev = 0.
+  ts_Sal_Lev_2 = 0.
+  ts_Time = 0.
+  ts_z = fltarr(jpk)
+  ts_z_2 = fltarr(jpk)
+
+  for year=year1,year2 do begin
+     
+     date1 = year * 10000L + 101
+     date2 = year * 10000L + 1231
+     filename = getname(s_iodir_data,sEXP1,'1Y','grid_T',date1)
+     filename2 = getname(s_iodir_data,sEXP2,'1Y','grid_T',date1)
+
+     if filename eq '' then stop 
+     Sal   = read_ncdf('so',date1 ,date2 , filename = filename, /nostruct)
+     Sal_2 = read_ncdf('so',date1 ,date2 , filename = filename2, /nostruct)
+     SSH   =  read_ncdf('zos',date1 ,date2 , filename = filename, /nostruct)
+     SSH_2 =  read_ncdf('zos',date1 ,date2 , filename = filename2, /nostruct)
+
+     ts_Sal = [ ts_Sal, moyenne(Sal, 'xyz', ssh = SSH) ]
+     ts_Sal_2 = [ ts_Sal_2, moyenne(Sal_2, 'xyz', ssh = SSH_2) ]
+     ts_Sal_Lev = [ ts_Sal_Lev, moyenne(Sal, 'xyz', ssh = SSH) - Lev_xyz ]
+     ts_Sal_Lev_2 = [ ts_Sal_Lev_2, moyenne(Sal_2, 'xyz', ssh = SSH_2) - Lev_xyz ]
+     ts_Time = [ ts_Time, Time] ; Time = date
+
+     ts_z = [ [ts_z], [moyenne(Sal, 'xy',/KEEPBOTTOM, ssh = SSH)- Lev_z] ]
+     ts_z_2 = [ [ts_z_2], [moyenne(Sal_2, 'xy',/KEEPBOTTOM, ssh = SSH_2)- Lev_z] ]
+
+  endfor
+  
+  ts_Sal = ts_Sal[1:*]             ; remove first record of 0
+  ts_Sal_2 = ts_Sal_2[1:*]         ; remove first record of 0
+  ts_Sal_Lev = ts_Sal_Lev[1:*]     ; remove first record of 0
+  ts_Sal_Lev_2 = ts_Sal_Lev_2[1:*] ; remove first record of 0
+  
+  ts_z = ts_z[*,1:*]            ; remove first record of 0
+  ts_z_2 = ts_z_2[*,1:*]            ; remove first record of 0
+  
+  Time = ts_Time[1:*]           ; remove first record of 0
+  jpt = n_elements(Time)
+
+
+  title = sEXP1+' Global Annual Mean Salinity --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt, ts_Sal, 't', 34.54, 34.76, INTER = .2, year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI $
+       , small = [1,2,1], YTITLE='psu', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+
+  title = sEXP1+' Global Annual Mean Salinity - Levitus --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt, ts_Sal_Lev, 't', -.05, .05, year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI $
+       , small = [1,2,2], YTITLE='psu',  TITLE = title, FORMAT = '(I3)', /NOERASE, _extra = ex
+
+;;;;;;;;;;;;;;;;; new page ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ERASE
+ 
+  title = sEXP1+' ZT-plot Salinity Mean (0-1500m) - Levitus --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt,ts_z ,'zt', -.5, .5, INTER = .025, year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $ 
+       , small = [1,2,1], YTITLE='psu', STYLE = 'so0so',  TITLE = title, boxzoom = 1500., /PORTRAIT, _extra = ex
+
+  title = sEXP1+' ZT-plot Salinity Mean (0-6000) - Levitus --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt,ts_z,'zt', -.5, .5, INTER = .025, year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI $ 
+       , small = [1,2,2], YTITLE='psu', STYLE = 'so0so',  TITLE = title, boxzoom = 6000., zoom = 1500.,  /NOERASE, _extra = ex
+  
+
+if sEXP2 ne sEXP1 then begin
+
+ERASE
+
+   title = sEXP1+' - '+sEXP2+' Global Annual Mean Salinity --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+   pltt, ts_Sal - ts_Sal_2, 't', -1., 1., INTER = .2, year1 * 10000L + 101, year2 * 10000L + 1231, /REMPLI $
+         , COLOR = 250, small = [1,2,1], YTITLE='psu', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+   
+endif
+
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+  
+  
+  return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_SSH.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_SSH.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_SSH.pro	(revision 2200)
@@ -0,0 +1,60 @@
+pro ts_mean_SSH, sEXP1, sEXP2, year1, year2, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+
+  compile_opt idl2, strictarrsubs
+  
+  @common
+  
+  @initorca2
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, sEXP1+'_SSH_mean.ps', portrait = 1
+  endif
+  
+  ts_SSH = 0.
+  ts_SSH2 = 0.
+  ts_Time = 0.
+  
+ 
+  for year=year1,year2 do begin
+     
+     date1 = year * 10000L + 101
+     date2 = year * 10000L + 1231
+     filename = getname(s_iodir_data,sEXP1,'1Y','grid_T',date1)
+     filename2 = getname(s_iodir_data,sEXP2,'1Y','grid_T',date1)
+     
+     SSH = read_ncdf('zos',date1 ,date2 , filename = filename, /nostruct)
+     SSH2 = read_ncdf('zos',date1 ,date2 , filename = filename2, /nostruct)
+
+     ts_SSH = [ ts_SSH, moyenne(SSH, 'xy')]
+     ts_SSH2 = [ ts_SSH2, moyenne(SSH2, 'xy')]
+     ts_Time = [ ts_Time, Time] ; Time = date
+     
+  endfor
+  
+  ts_SSH = ts_SSH[1:*]          ; remove first record of 0
+  ts_SSH2 = ts_SSH2[1:*]          ; remove first record of 0
+  Time = ts_Time[1:*]           ; remove first record of 0
+  
+  jpt = n_elements(Time)
+  
+  title = sEXP1+' Global Annual Mean SSH --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt,ts_SSH,'t', -.001, .001, year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+       , small = [1,2,1], YTITLE = 'm', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+  
+  if sEXP2 ne sEXP1 then begin
+     
+     title = sEXP1+' - '+sEXP2+' Global Annual Mean SSH --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+     pltt, ts_SSH - ts_SSH2,'t', -.0001, .0001, year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI, /NOERASE $
+           , COLOR = 250, small = [1,2,2], YTITLE = 'm', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+     
+  endif
+  
+
+ 
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+
+  return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_T.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_T.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_T.pro	(revision 2200)
@@ -0,0 +1,105 @@
+pro ts_mean_T, sEXP1, sEXP2, year1, year2, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+
+  compile_opt idl2, strictarrsubs
+  
+  @common
+  
+  @initorca2
+  
+  std_iodir_climato = '/Users/sflod/idl_PLOTS/CLIMATOLOGIES/'
+;  std_iodir_interan = '/Users/sflod/idl_PLOTS/INTERAN/'
+  std_iodir_data = '/Users/sflod/idl_PLOTS/INTERAN/mercure/'
+
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, sEXP1+'_Temperature_mean.ps', portrait = 1
+  endif
+  
+  filename = std_iodir_climato+'data_1y_potential_temperature_nomask.nc'
+  Lev = read_ncdf('votemper', filename = filename, /nostruct )
+  Lev_xyz = moyenne(Lev, 'xyz')
+  Lev_z = moyenne(Lev, 'xy',/KEEPBOTTOM)
+
+  ts_Temp = 0.
+  ts_Temp_2 = 0.
+  ts_Temp_Lev = 0.
+  ts_Temp_Lev_2 = 0.
+  ts_Time = 0.
+  ts_z = fltarr(jpk)
+  ts_z_2 = fltarr(jpk)
+  
+  for year=year1,year2 do begin
+     
+     date1 = year * 10000L + 101L
+     date2 = year * 10000L + 1231L
+ 
+print,s_iodir_data
+
+     filename = getname(s_iodir_data,sEXP1,'1Y','grid_T',date1)
+     filename2 = getname(s_iodir_data,sEXP2,'1Y','grid_T',date1)
+
+     if filename eq '' then stop 
+     Temp   = read_ncdf('thetao',date1 ,date2 , filename = filename, /nostruct)
+     Temp_2 = read_ncdf('thetao',date1 ,date2 , filename = filename2, /nostruct)
+     SSH    =  read_ncdf('zos',date1 ,date2 , filename = filename, /nostruct)
+     SSH_2  =  read_ncdf('zos',date1 ,date2 , filename = filename2, /nostruct)
+
+     ts_Temp = [ ts_Temp, moyenne(Temp, 'xyz',ssh = SSH) ]
+     ts_Temp_2 = [ ts_Temp_2, moyenne(Temp_2, 'xyz',ssh = SSH_2) ]
+     ts_Temp_Lev = [ ts_Temp_Lev, moyenne(Temp, 'xyz',ssh = SSH) - Lev_xyz ]
+     ts_Temp_Lev_2 = [ ts_Temp_Lev_2, moyenne(Temp_2, 'xyz',ssh = SSH_2) - Lev_xyz ]
+     ts_Time = [ ts_Time, Time] ; Time = date
+
+     ts_z = [ [ts_z], [moyenne(Temp, 'xy',/KEEPBOTTOM, ssh = SSH)- Lev_z] ]
+     ts_z_2 = [ [ts_z_2], [moyenne(Temp_2, 'xy',/KEEPBOTTOM, ssh = SSH_2)- Lev_z] ]
+
+  endfor
+
+  ts_Temp = ts_Temp[1:*]        ; remove first record of 0 
+  ts_Temp_2 = ts_Temp_2[1:*]        ; remove first record of 0
+  ts_Temp_Lev = ts_Temp_Lev[1:*] ; remove first record of 0
+  ts_Temp_Lev_2 = ts_Temp_Lev_2[1:*] ; remove first record of 0
+  ts_z = ts_z[*,1:*]             ; remove first record of 0
+  ts_z_2 = ts_z_2[*,1:*]             ; remove first record of 0
+  
+  Time = ts_Time[1:*]           ; remove first record of 0
+  jpt = n_elements(Time)
+  
+  title = sEXP1+' Global Annual Mean Temperature --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt, ts_Temp, 't', 1., 4.5, INTER = .5, year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+       , small = [1,2,1], YTITLE='Deg C', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+
+  title = sEXP1+' Global Annual Mean Temperature - Levitus --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt,ts_Temp_Lev, 't', -1., 1., INTER = .25,  year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+       , small = [1,2,2], YTITLE='Deg C', TITLE = title, FORMAT = '(I3)', /NOERASE, _extra = ex
+
+  ;;;;;;;;;;;;;;;;; new page  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ERASE
+
+  title = sEXP1+' ZT-plot Temperature Mean (0-1500m) - Levitus --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt,ts_z ,'zt', -2., 2., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $ 
+       , small = [1,2,1], YTITLE='Deg C', TITLE = title, boxzoom = 1500., /NOERASE, _extra = ex
+  
+  title = sEXP1+' ZT-plot Temperature Mean (0-6000m) - Levitus --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+  pltt,ts_z ,'zt', -2., 2., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $ 
+       , small = [1,2,2], YTITLE='Deg C', TITLE = title, boxzoom = 6000., /NOERASE, _extra = ex
+  
+if sEXP2 ne sEXP1 then begin
+  
+ERASE
+ 
+   title = sEXP1+' - '+sEXP2+' Global Annual Mean Temperature --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+   pltt, ts_Temp - ts_Temp_2, 't', -1., 1., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+         , COLOR = 250, small = [1,2,1], YTITLE='Deg C', TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+   
+endif
+
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+  
+  
+  return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_U.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_U.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_U.pro	(revision 2200)
@@ -0,0 +1,77 @@
+pro ts_mean_U, sEXP1, sEXP2, year1, year2, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+
+
+  compile_opt idl2, strictarrsubs
+  
+  @common
+  
+ @initorca2
+ 
+ if max(glamt) gt 300 then testlam = abs(glamt - 300) else testlam = abs(glamt + 60)
+
+ testlat = abs(gphit + 30)
+
+ index=where(abs(testlam - min(testlam)) lt 1 and abs(testlat - min(testlat)) lt 1 )
+ xindex=index[0] mod jpi
+ yindex=index[0]/jpi
+
+ domdef, xindex, xindex+1, 0, yindex, 0, jpk-1, /index
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, sEXP1+'_U_mean.ps', portrait = 1
+ endif
+ 
+ ts_bbD = 0.
+ ts_bbD2 = 0.
+ ts_Time = 0.
+ 
+ for year=year1,year2 do begin
+    
+    date1 = year * 10000L + 101
+    date2 = year * 10000L + 1231
+    filename = getname(s_iodir_data,sEXP1,'1Y','grid_U',date1)
+    filename2 = getname(s_iodir_data,sEXP2,'1Y','grid_U',date1)
+
+    if filename eq '' then stop 
+    U = read_ncdf('uoce_eff',date1 ,date2 , filename = filename, /nostruct)
+    U2 = read_ncdf('uoce_eff',date1 ,date2 , filename = filename2, /nostruct)
+     
+    bb1 = bsf(U)
+    bb2 = bsf(U2)
+    bb1=bb1.arr[0,*]
+    bb2=bb2.arr[0,*]
+
+    bbDRAKE = bb1[nyt-1]-bb1[0]
+    bb2DRAKE = bb2[nyt-1]-bb2[0]
+
+    ts_bbD = [ ts_bbD, bbDRAKE ]
+    ts_bbD2 = [ ts_bbD2, bb2DRAKE ]
+    ts_Time = [ ts_Time, Time]  ; Time = date
+       
+ endfor
+ 
+ ts_bbD = ts_bbD[1:*]           ; remove first record of 0
+ ts_bbD2 = ts_bbD2[1:*]         ; remove first record of 0
+ Time = ts_Time[1:*]            ; remove first record of 0
+ 
+ jpt = n_elements(Time)
+
+ title = sEXP1+' DRAKE transport --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+ pltt,ts_bbD,'t', 0., 200., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+      , small = [1,2,1],  TITLE = title, YTITLE='Sv', FORMAT = '(I3)', /PORTRAIT, _extra = ex
+ 
+ if sEXP2 ne sEXP1 then begin
+    
+    title = sEXP1+' - '+sEXP2+' DRAKE transport --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+    pltt,ts_bbD - ts_bbD2,'t', -30., 30., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI, /NOERASE $
+        , COLOR = 250, small = [1,2,2],  TITLE = title, YTITLE='Sv', FORMAT = '(I3)', /PORTRAIT, _extra = ex
+    
+ endif
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+ 
+ 
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_V.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_V.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/ts_mean_V.pro	(revision 2200)
@@ -0,0 +1,132 @@
+pro ts_mean_V, sEXP1, sEXP2, year1, year2, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+
+  
+  compile_opt idl2, strictarrsubs
+  
+  @common
+  
+ @initorca2
+ 
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, sEXP1+'_V_mean.ps', portrait = 1
+ endif
+ 
+; inizialization of vectors (for experience 1 and 2) 
+ ts_mAMOC45 = 0.
+ ts_mAABW70 = 0.
+ ts_mAABC50 = 0.
+ ts_mAMOC45_2 = 0.
+ ts_mAABW70_2 = 0.
+ ts_mAABC50_2 = 0.
+
+ ts_Time = 0.
+ 
+ for year=year1,year2 do begin
+    
+    date1 = year * 10000L + 101
+    date2 = year * 10000L + 1231
+    filename = getname(s_iodir_data,sEXP1,'1Y','grid_V',date1)
+    filename2 = getname(s_iodir_data,sEXP2,'1Y','grid_V',date1)
+    
+    if filename eq '' then stop 
+    
+    domdef, 0, jpk-1,/zindex
+
+    V1 = read_ncdf('voce_eff',date1 ,date2 , filename = filename, /nostruct)
+    V2 = read_ncdf('voce_eff',date1 ,date2 , filename = filename2, /nostruct)
+    
+    msf_tot = msf(V1, indexboxzoom = ind)
+    msf2_tot = msf(V2, indexboxzoom = ind)
+    
+    yaxis = gphit[ind[0], ind[2]:ind[3]]
+ 
+; computation of max Atlatic Meridional Overturninc Circulation at 40°N and 50°N
+;;  see plot msf global
+    indy = where(yaxis gt 40 and yaxis le 50)
+    domdef, 0, 3500
+    
+    mAMOC45 = max(msf_tot.arr[indy, firstzw:lastzw],/NaN)
+    mAMOC45_2 = max(msf2_tot.arr[indy, firstzw:lastzw],/NaN)
+
+; computation of max atlantic Antarctic Bottom Water between 80°S and 65°S
+;; see plot msf global
+    indy = where(yaxis gt -80 and yaxis le -65)
+    domdef, 300, 3500
+    
+    mAABW70 = min(msf_tot.arr[indy, firstzw:lastzw],/NaN)
+    mAABW70_2 = min(msf2_tot.arr[indy, firstzw:lastzw],/NaN)
+
+;  computation of max Antarctic Abyssal Bottom Cell between 65°S and 30°N , 
+;; see plot msf global
+    indy = where(yaxis gt -65 and yaxis le 30)
+    domdef, 2500, 5000
+    
+    mAABC50 = min(msf_tot.arr[indy, firstzw:lastzw],/NaN)
+    mAABC50_2 = min(msf2_tot.arr[indy, firstzw:lastzw],/NaN)
+
+; creation of Time Series
+; for EXPERIENCE 1
+    ts_mAMOC45 = [ ts_mAMOC45, mAMOC45 ]
+    ts_mAABW70 = [ ts_mAABW70, mAABW70 ]
+    ts_mAABC50 = [ ts_mAABC50, mAABC50 ]
+
+; for EXPERIENCE 2
+    ts_mAMOC45_2 = [ ts_mAMOC45_2, mAMOC45_2 ]
+    ts_mAABW70_2 = [ ts_mAABW70_2, mAABW70 ]
+    ts_mAABC50_2 = [ ts_mAABC50_2, mAABC50 ]
+   
+    ts_Time = [ ts_Time, Time]  ; Time = date
+    
+ endfor
+
+ ts_mAMOC45 = ts_mAMOC45[1:*]   ; remove first record of 0
+ ts_mAABW70 = ts_mAABW70[1:*]   ; remove first record of 0
+ ts_mAABC50 = ts_mAABC50[1:*]   ; remove first record of 0
+ 
+ ts_mAMOC45_2 = ts_mAMOC45_2[1:*]   ; remove first record of 0
+ ts_mAABW70_2 = ts_mAABW70_2[1:*]   ; remove first record of 0
+ ts_mAABC50_2 = ts_mAABC50_2[1:*]   ; remove first record of 0
+
+ Time = ts_Time[1:*]            ; remove first record of 0
+ 
+ jpt = n_elements(Time)
+ 
+ title = sEXP1+' Max Atlantic MOC between 40N and 50N --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+ pltt, ts_mAMOC45,'t', 0., 30., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+      ,  small = [1,2,1],  TITLE = title, YTITLE='Sv', FORMAT = '(I3)', /PORTRAIT, _extra = ex
+ 
+ if sEXP2 ne sEXP1 then begin
+    title = sEXP1+' - '+sEXP2+' Max Atlantic MOC between 40N and 50N --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+    pltt, ts_mAMOC45 - ts_mAMOC45_2,'t', -9., 9., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI, /NOERASE $
+          ,  COLOR = 250, small = [1,2,2],  TITLE = title, YTITLE='Sv', FORMAT = '(I3)', /PORTRAIT, _extra = ex
+ endif
+ 
+ title = sEXP1+' Max AntArctic Bottom Water between 80S and 65S --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+ pltt,-ts_mAABW70,'t', 0., 20., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+      , small = [1,2,1],  TITLE = title, YTITLE='Sv', FORMAT = '(I3)', /PORTRAIT, _extra = ex
+ 
+ if sEXP2 ne sEXP1 then begin 
+    title = sEXP1+' - '+sEXP2+' Max AntArctic Bottom Water between 80S and 65S --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+    pltt,-ts_mAABW70 + ts_mAABW70_2 ,'t', 0., 20., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI, /NOERASE $
+         ,  COLOR = 250, small = [1,2,2],  TITLE = title, YTITLE='Sv', FORMAT = '(I3)', /PORTRAIT, _extra = ex
+ endif
+ 
+ title = sEXP1+' Max AntArctic Bottom Cell between 65S and 30N --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+ pltt,-ts_mAABC50,'t', 5., 30., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI $
+      ,  small = [1,2,1],  TITLE = title, YTITLE='Sv', FORMAT = '(I3)', /PORTRAIT, _extra = ex
+
+ if sEXP2 ne sEXP1 then begin
+
+    title = sEXP1+' - '+sEXP2+' Max AntArctic Bottom Cell between 65S and 30N --- year '+strtrim(year1,1)+' - '+strtrim(year2,1)
+    pltt,-ts_mAABC50 + ts_mAABC50_2,'t', 5., 30., year1 * 10000L + 101, year2 * 10000L + 1231 , /REMPLI,/NOERASE  $
+         ,  COLOR = 250, small = [1,2,2],  TITLE = title, YTITLE='Sv', FORMAT = '(I3)', /PORTRAIT, _extra = ex
+ endif
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+ 
+ 
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ANT_Icethick_MARS.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ANT_Icethick_MARS.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ANT_Icethick_MARS.pro	(revision 2200)
@@ -0,0 +1,44 @@
+pro xxx_ANT_Icethick_MARS,  Ithi_mars_1, Ithi_mars_2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+
+ @common
+
+ compile_opt idl2, strictarrsubs
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '017_ANT_IceThick_MARS_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+                                ;
+ domdef,20,380,-50,-90
+                                ; 
+ title=sEXP1+' Antartic Ice Thickness MARS / year '+start_end
+
+ Ithi_mars_1.arr = Ithi_mars_1.arr < 1.
+ plt, Ithi_mars_1.arr - 1.E-04, MIN = 0., MAX = 1., INTER = 0.1 , STYLE = 'so0so',CELL_FILL = 2, /STRICTFILL $ 
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title  $
+      , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [-90,0,0], /PORTRAIT, _extra = ex
+
+ if sEXP1 ne sEXP2 then begin
+    
+    title=sEXP1+' - '+sEXP2+' Antartic Ice Thickness MARS / year '+start_end
+    plt, Ithi_mars_1.arr - Ithi_mars_2.arr, MIN = -1., MAX = 1., INTER = 0.1, /STRICTFILL , STYLE = 'so0so' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title $
+         , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [-90,0,0], /NOERASE, _extra = ex
+    
+ endif
+ 
+ domdef
+
+ title = 'Antarctic Sea-ice Thickness'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/017_ANT_IceThick_MARS_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+
+ return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ANT_Icethick_SEPT.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ANT_Icethick_SEPT.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ANT_Icethick_SEPT.pro	(revision 2200)
@@ -0,0 +1,44 @@
+pro xxx_ANT_Icethick_SEPT,  Ithi_sept_1, Ithi_sept_2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+
+ @common
+
+ compile_opt idl2, strictarrsubs
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '017_ANT_IceThick_SEPT_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+                                ;
+ domdef,20,380,-50,-90
+                                ; 
+ title=sEXP1+' Antartic Ice Thickness SEPT / year '+start_end
+
+ Ithi_sept_1.arr = Ithi_sept_1.arr < 1.
+ plt, Ithi_sept_1.arr - 1.E-04, MIN = 0., MAX = 1., INTER = 0.1 , STYLE = 'so0so',CELL_FILL = 2, /STRICTFILL $ 
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title  $
+      , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [-90,0,0], /PORTRAIT, _extra = ex
+
+ if sEXP1 ne sEXP2 then begin
+    
+    title=sEXP1+' - '+sEXP2+' Antartic Ice Thickness SEPT / year '+start_end
+    plt, Ithi_sept_1.arr - Ithi_sept_2.arr, MIN = -1., MAX = 1., INTER = 0.1, /STRICTFILL , STYLE = 'so0so' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title $
+         , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [-90,0,0], /NOERASE, _extra = ex
+    
+ endif
+ 
+ domdef
+
+ title = 'Antarctic Sea-ice Thickness'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/017_ANT_IceThick_SEPT_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+
+ return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ARC_Icethick_MARS.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ARC_Icethick_MARS.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ARC_Icethick_MARS.pro	(revision 2200)
@@ -0,0 +1,41 @@
+pro xxx_ARC_Icethick_MARS, Ithi_mars_1, Ithi_mars_2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common
+
+ compile_opt idl2, strictarrsubs
+
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '016_ARC_IceThick_MARS_'+sEXP1+'_'+sEXP2+'y'+start_end+'.ps', portrait = 1
+ endif
+ 
+ domdef,20,380,55,90
+           
+ title=sEXP1+' Arctic Ice Thickness MARS/ year '+start_end
+
+ Ithi_mars_1.arr = Ithi_mars_1.arr < 6.
+ plt, Ithi_mars_1.arr - 1.E-04, MIN = 0., MAX = 6., INTER = 0.25 ,/STRICTFILL , CELL_FILL = 2, STYLE = 'so0so'  $
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title $
+      , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [90,0,0], /PORTRAIT, _extra = ex
+ ;
+ if sEXP1 ne sEXP2 then begin            
+    title = sEXP1+' - '+sEXP2+' Arctic Ice Thickness / year '+start_end
+    plt, Ithi_mars_1.arr - Ithi_mars_2.arr, MIN = -3., MAX = 3., INTER = .5, /STRICTFILL , STYLE = 'so0so' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title $
+         , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [90,0,0], /NOERASE, _extra = ex
+    
+ endif                          ; end of 2
+ 
+ domdef
+
+ title = 'Arctic Sea-ice Thickness MARS'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/016_ARC_IceThick_MARS_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ARC_Icethick_SEPT.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ARC_Icethick_SEPT.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ARC_Icethick_SEPT.pro	(revision 2200)
@@ -0,0 +1,41 @@
+pro xxx_ARC_Icethick_SEPT, Ithi_sept_1, Ithi_sept_2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common
+
+ compile_opt idl2, strictarrsubs
+
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '016_ARC_IceThick_SEPT_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+ domdef,20,380,55,90
+           
+ title=sEXP1+' Arctic Ice Thickness SEPT / year '+start_end
+
+ Ithi_sept_1.arr = Ithi_sept_1.arr < 6.
+ plt, Ithi_sept_1.arr - 1.E-04, MIN = 0., MAX = 6., INTER = 0.25 ,/STRICTFILL , CELL_FILL = 2, STYLE = 'so0so'  $
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title $
+      , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [90,0,0], /PORTRAIT, _extra = ex
+ ;
+ if sEXP1 ne sEXP2 then begin            
+    title = sEXP1+' - '+sEXP2+' Arctic Ice Thickness SEPT / year '+start_end
+    plt, Ithi_sept_1.arr - Ithi_sept_2.arr, MIN = -3., MAX = 3., INTER = .5, /STRICTFILL , STYLE = 'so0so' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title $
+         , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [90,0,0], /NOERASE, _extra = ex
+    
+ endif                          ; end of 2
+ 
+ domdef
+
+ title = 'Arctic Sea-ice Thickness'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/016_ARC_IceThick_SEPT_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_EXP1_S_ARC_z105.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_EXP1_S_ARC_z105.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_EXP1_S_ARC_z105.pro	(revision 2200)
@@ -0,0 +1,38 @@
+pro xxx_EXP1_S_ARC_z105, S1, SLev, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common 
+ compile_opt idl2, strictarrsubs
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '008_S_ARC_z105_'+sEXP1+'_y'+start_end+'.ps', portrait = 1
+ endif
+
+                                ; 
+ domdef,20,380,60,90
+                                ;
+ title=sEXP1+' Salinity 105 m'
+ plt, S1, MIN = 30.0, MAX = 35., INTER = 0.25, CELL_FILL = 2  $
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title, CHARSIZE = -0.55, GLINETHICK = 2. $
+      , /ORTHO, MAP = [90,0,0], LATDEL = 5, boxzoom = [105., 106.], /PORTRAIT, _extra = ex
+                                ; 
+
+ title=sEXP1+' - Levitus Salinity 105 m / year '+start_end
+ plt, S1.arr-SLev.arr, MIN = -2., MAX = 2., INTER = 0.2, CELL_FILL = 2,  STYLE = 'so0so'  $     
+      , small = [1,2,2], COAST_THICK = 2, TITLE = title, CHARSIZE = -0.55, GLINETHICK = 2. $      
+      , /ORTHO, MAP = [90,0,0], LATDEL = 5, boxzoom = [105., 106.], /NOERASE, _extra = ex
+                                ;
+ domdef
+
+ title = 'Artic salinity at 105 meters'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/008_S_ARC_z105_'+sEXP1+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+ 
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_EXP2_S_ARC_z105.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_EXP2_S_ARC_z105.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_EXP2_S_ARC_z105.pro	(revision 2200)
@@ -0,0 +1,47 @@
+pro xxx_EXP2_S_ARC_z105, S1, S2, SLev, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common 
+ compile_opt idl2, strictarrsubs
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '009_S_ARC_z105_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+ endif
+
+                                ; 
+ domdef,20,380,60,90
+                                ;
+ if sEXP1 ne sEXP2 then begin
+
+    title=sEXP1+' - '+sEXP2+' Salinity 105 m / year '+start_end
+    plt, S1.arr-S2.arr, MIN = -2., MAX = 2., INTER = 0.2, CELL_FILL = 2,  STYLE = 'so0so'  $     
+         , small = [1,2,1], COAST_THICK = 2, TITLE = title, CHARSIZE = -0.55, GLINETHICK = 2. $      
+         , /ORTHO, MAP = [90,0,0], LATDEL = 5, boxzoom = [105., 106.], /NOERASE, _extra = ex
+    
+ endif else begin
+    
+    title='Levitus Salinity 105 m'
+    plt, SLev.arr, MIN = 33., MAX = 35., INTER = 0.25 , CELL_FILL = 2 $ 
+         , small = [1,2,1], COAST_THICK = 2, TITLE = title, CHARSIZE = -0.55, GLINETHICK = 2. $ 
+         , /ORTHO, MAP = [90,0,0], LATDEL = 5, boxzoom = [105., 106.], _extra = ex
+ endelse
+                                ;
+ title=sEXP2+' - Levitus Salinity 105 m / year '+start_end
+ plt, S2.arr-SLev.arr, MIN = -2., MAX = 2., INTER = 0.2, CELL_FILL = 2,  STYLE = 'so0so'  $     
+      , small = [1,2,2], COAST_THICK = 2, TITLE = title, CHARSIZE = -0.55, GLINETHICK = 2. $      
+      , /ORTHO, MAP = [90,0,0], LATDEL = 5, boxzoom = [105., 106.], /NOERASE, _extra = ex
+                                ;
+ domdef
+;
+ title = 'Artic salinity at 105 meters'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/009_S_ARC_z105_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+ 
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Emp.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Emp.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Emp.pro	(revision 2200)
@@ -0,0 +1,32 @@
+pro xxx_Emp, EMP1, EMP2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ 
+  compile_opt idl2, strictarrsubs
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '002_Emp_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+  endif
+  
+  title=sEXP1+' Emp (mm/day) / year '+start_end
+  plt, EMP1,  MIN = -15., MAX = 15., INTER = 2.5 $
+       , small = [1,2,1], COAST_THICK = 2, TITLE = title, /PORTRAIT, _extra=ex
+  
+if sEXP1 ne sEXP2 then begin
+
+  title=sEXP1+' - '+sEXP2+' / Emp year '+start_end
+  plt, EMP1-EMP2, MIN = -5., MAX = 5., INTER = 1. $
+       , small = [1,2,2], COAST_THICK = 2, TITLE = title,  /NOERASE, _extra=ex
+endif
+
+  title = 'Emp field'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/002_Emp_'+sEXP1+'_'+sEXP2+'_y '+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+  return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_S.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_S.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_S.pro	(revision 2200)
@@ -0,0 +1,41 @@
+pro xxx_Eq_S, S1, S2, SLev, sEXP1, sEXP2, start_end,  POSTSCRIPT = postscript, _extra = ex
+  
+  compile_opt idl2, strictarrsubs
+
+  S = S1.arr-S2.arr
+  sEXP = sEXP1+' - '+sEXP2
+  min =  -1.
+  max = -min
+  inter = .1
+  
+  if sEXP2 eq sEXP1 then begin
+     sEXP = sEXP1+' - Levitus' 
+     S = S1.arr-Slev.arr
+     min = -1.
+     max = -min
+     inter = .1
+  endif
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '021_Eq_S_'+sEXP+'_y'+start_end+'.ps', portrait = 1
+  endif
+                                ;
+  title = sEXP1+' Equatorial S  / year '+start_end
+  pltz, S1, MININ = 33., MAXIN = 37., INTER = .2, typein='xz'  $
+        , small=[1,2,1], COAST_THICK = 2, TITLE = title, boxzoom = [20., 380., -1., 1., 0., 500.], /PORTRAIT, _extra = ex
+                                ; 
+  title = sEXP+' Eq. S / year '+start_end
+  pltz, S, MININ = min, MAXIN = max, INTER = inter, typein = 'xz', STYLE = 'so0so' $
+        , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = [20., 380., -1., 1., 0., 500.], /PORTRAIT, _extra = ex
+;                              
+  title = 'Equatorial differences with Levitus and '+sEXP+' of salinity'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/021_Eq_S_'+sEXP+'_y'+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+  return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_T.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_T.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_T.pro	(revision 2200)
@@ -0,0 +1,42 @@
+pro xxx_Eq_T, T1, T2, TLev, sEXP1, sEXP2, start_end,  POSTSCRIPT = postscript, _extra = ex
+  
+  compile_opt idl2, strictarrsubs
+
+  T = T1.arr-T2.arr
+  sEXP = sEXP1+' - '+sEXP2
+  min =  -2.
+  max = -min
+  inter = .25
+  
+  if sEXP2 eq sEXP1 then begin
+     sEXP = sEXP1+' - Levitus'
+     T = T1.arr-TLev.arr
+     min = -4.
+     max = -min
+     inter = .5
+   endif
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '020_Eq_T_'+sEXP+'_y'+start_end+'.ps', portrait = 1
+  endif
+                                ;
+  title = sEXP1+' Equatorial T  / year '+start_end
+  pltz, T1, MININ = 2., MAXIN = 30., INTER = 1., typein = 'xz'  $
+        , small = [1,2,1], COAST_THICK = 2, TITLE = title, boxzoom = [20., 380., -1., 1., 0., 500.], /PORTRAIT, _extra = ex
+                                ; 
+ 
+  title = sEXP+' Eq. T / year '+start_end
+  pltz, T, MININ = min, MAXIN = max, INTER = inter, typein = 'xz', STYLE = 'so0so' $
+        , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = [20., 380., -1., 1., 0., 500.], /NOERASE, _extra = ex
+                                ; 
+  title ='Equatorial differences with Levitus and '+sEXP+'of temperature'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/020_Eq_T_'+sEXP+'_y'+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+  return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_U.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_U.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Eq_U.pro	(revision 2200)
@@ -0,0 +1,30 @@
+pro xxx_Eq_U, U1, U2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+  compile_opt idl2, strictarrsubs
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '022_Eq_U_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+  endif
+                                ;
+  title = sEXP1+' Equatorial U_zonal / year '+start_end
+  pltz, U1, MININ = -1., MAXIN = 1., INTER = .1, typein = 'xz', STYLE = 'so0so', UNIT = varunit $
+        , small = [1,2,1], COAST_THICK = 2, TITLE = title, boxzoom = [20., 380., -1., 1., 0., 500.], ZOOM = 500, /PORTRAIT, _extra = ex
+
+  if sEXP1 ne sEXP2 then begin
+                                ;
+     title = sEXP1+' - '+sEXP2+' U_zonal / year '+start_end
+     pltz, U1.arr-U2.arr, MININ = -.5, MAXIN = .5, INTER = .1, typein = 'xz', STYLE = 'so0so', UNIT = varunit $
+           , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = [20., 380., -1., 1., 0., 500.], ZOOM = 500, /PORTRAIT, _extra = ex
+                                ;
+  endif
+  
+  title ='Equatorial differences with Levitus and '+sEXP2+'of zonal velocity U'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/021_Eq_U_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+  
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+  return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Erp.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Erp.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Erp.pro	(revision 2200)
@@ -0,0 +1,33 @@
+pro xxx_Erp, ERP1, ERP2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ 
+  compile_opt idl2, strictarrsubs
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '001_Erp_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+  endif
+  
+  title=sEXP1+' Erp (mm/day) / year '+start_end
+  plt, ERP1,  MIN = -5., MAX = 5., INTER = .5 $
+       , small = [1,2,1], COAST_THICK = 2, TITLE = title, /PORTRAIT, _extra=ex
+  
+  if sEXP1 ne sEXP2 then begin
+
+     title=sEXP1+' - '+sEXP2+' / Erp year '+start_end
+     plt, ERP1-ERP2, MIN = -2., MAX = 2., INTER = .25 $
+          , small = [1,2,2], COAST_THICK = 2, TITLE = title,  /NOERASE, _extra=ex
+     
+  endif
+
+  title = 'Erp field'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/001_Erp_'+sEXP1+'_'+sEXP2+'_y '+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+  return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Iceleadfrac_MARS.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Iceleadfrac_MARS.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Iceleadfrac_MARS.pro	(revision 2200)
@@ -0,0 +1,31 @@
+pro xxx_Iceleadfrac_MARS, Ifra_mars_1, Ifra_mars_2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+ 
+  compile_opt idl2, strictarrsubs
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '018_Iceleadfrac_MARS_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+  endif
+  
+  title=sEXP1+' Iceleadfrac MARS / year '+start_end
+  plt, Ifra_mars_1,  MIN = 0., MAX = 1., INTER = .1 $
+       , small = [1,2,1], COAST_THICK = 2, TITLE = title, /PORTRAIT, _extra=ex
+  
+if sEXP1 ne sEXP2 then begin
+
+  title=sEXP1+' - '+sEXP2+' / Iceleadfrac MARS year '+start_end
+  plt, Ifra_mars_1.arr - Ifra_mars_2.arr, MIN = -1., MAX = 1., INTER = .1 $
+       , small = [1,2,2], COAST_THICK = 2, TITLE = title,  /NOERASE, _extra=ex
+endif
+
+  title = 'Iceldeafrac  field'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/018_Iceleadfrac_MARS_'+sEXP1+'_'+sEXP2+'_y '+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+  return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Iceleadfrac_SEPT.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Iceleadfrac_SEPT.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Iceleadfrac_SEPT.pro	(revision 2200)
@@ -0,0 +1,31 @@
+pro xxx_Iceleadfrac_SEPT, Ifra_sept_1, Ifra_sept_2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+  compile_opt idl2, strictarrsubs
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     openps, '018_Iceleadfrac_SEPT_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+  endif
+  
+  title=sEXP1+' Iceleadfrac SEPT / year '+start_end
+  plt, Ifra_sept_1,  MIN = 0., MAX = 1., INTER = .1 $
+       , small = [1,2,1], COAST_THICK = 2, TITLE = title, /PORTRAIT, _extra=ex
+  
+if sEXP1 ne sEXP2 then begin
+
+  title=sEXP1+' - '+sEXP2+' / Iceleadfrac SEPT year '+start_end
+  plt, Ifra_sept_1.arr - Ifra_sept_2.arr, MIN = -1., MAX = 1., INTER = .1 $
+       , small = [1,2,2], COAST_THICK = 2, TITLE = title,  /NOERASE, _extra=ex
+endif
+
+  title = 'Iceldeafrac field'
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/018_Iceleadfrac_SEPT_'+sEXP1+'_'+sEXP2+'_y '+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+
+
+  if KEYWORD_SET(POSTSCRIPT) then begin
+     closeps
+  endif
+
+  return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Med_S_depth.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Med_S_depth.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Med_S_depth.pro	(revision 2200)
@@ -0,0 +1,45 @@
+pro xxx_Med_S_depth, S1, S2, SLev, sEXP1, sEXP2, start_end, DEPTH=depth, LAT=lat, POSTSCRIPT = postscript,  _extra = ex
+  
+  compile_opt idl2, strictarrsubs
+
+   @common
+
+
+   if KEYWORD_SET(POSTSCRIPT) then begin
+      openps, '024_Med_S_depth_'+sEXP1+'_'+strtrim(lat,1)+'_d'+strtrim(depth,1)+'_S_y'+start_end+'.ps'   
+   endif
+;domdef, 0, 6000
+
+;domdef,270,365,5,70
+   minval = min(abs(gdept -  depth),index)
+   
+   title = sEXP1+'  Mediterranean water at ' +strtrim(lat,1)+'°N / year '+start_end 
+   pltz, S1.arr, MININ = 35., MAXIN = 37., INTER = 0.1,  UNIT = varunit $
+         , small = [1,2,1], COAST_THICK = 2, endpoints = [300., lat, 357., lat], TITLE = title, boxzoom = [2000.], ZOOM = 2000., /PORTRAIT, _extra = ex 
+;
+
+   if sEXP1 ne sEXP2 then begin
+      
+      title = sEXP1+' - '+sEXP2+' Mediterranean  water at '+strtrim(lat,1)+'°N / year '+start_end
+      pltz, S1.arr - S2.arr, MININ = -.4, MAXIN = .4, INTER = .05, UNIT = varunit $ 
+            , small = [1,2,2], COAST_THICK = 2, endpoints = [300., lat, 357., lat], TITLE = title, boxzoom = [2000.], ZOOM = 2000.,  _extra = ex 
+      
+   endif else begin
+   
+      title = sEXP1+' - Levitus Mediterranean  water at '+strtrim(lat,1)+'°N / year '+start_end
+      pltz, S1.arr-SLev.arr, MININ = -1., MAXIN = 1., INTER=0.1, UNIT = varunit $ 
+            , small = [1,2,2], COAST_THICK = 2, endpoints = [300., lat, 357., lat], TITLE = title, boxzoom = [2000.], ZOOM = 2000., _extra = ex 
+   endelse
+
+
+   title ='Mediterranean water Lat: '+strtrim(lat,1)+', '+strtrim(depth,1)
+   text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/024_Med_Levitus_S_depth_'+sEXP1+'_'+strtrim(lat,1)+'_d'+strtrim(depth,1)+'_S_y'+start_end+'.png  />  ' ]
+   putfile, '/tmp/prova.txt', text
+
+   if KEYWORD_SET(POSTSCRIPT) then begin
+      closeps
+   endif
+
+
+   return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Med_S_tongue.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Med_S_tongue.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Med_S_tongue.pro	(revision 2200)
@@ -0,0 +1,44 @@
+pro xxx_Med_S_tongue, S1, S2, SLev, sEXP1, sEXP2, start_end, DEPTH=depth, LAT=lat, POSTSCRIPT = postscript,  _extra = ex
+  
+  compile_opt idl2, strictarrsubs
+
+   @common
+
+
+   if KEYWORD_SET(POSTSCRIPT) then begin
+      openps, '023_Med_S_tongue_'+sEXP1+'_'+strtrim(lat,1)+'_d'+strtrim(depth,1)+'_S_y'+start_end+'.ps'   
+   endif
+;domdef, 0, 6000
+
+;domdef,270,365,5,70
+minval = min(abs(gdept -  depth),index)
+  
+   title = sEXP1+' Mediterranean salt tongue at depth=' + strtrim(gdept[index],1)+' m / year '+start_end
+   plt, S1.arr, MININ=35., MAXIN=37., INTER=0.1,  UNIT= varunit $
+         , small=[1,2,1], boxzoom = [270, 365, 5,70, index,index],/zindex, COAST_THICK=2, TITLE=title,  /PORTRAIT, _extra=ex
+;
+  if sEXP1 ne sEXP2 then begin
+     
+     title = sEXP1+' - '+sEXP2+' Mediterranean salt tongue at depth=' + strtrim(gdept[index],1)+' m / year '+start_end
+     plt, S1.arr - S2.arr, MININ = -.4, MAXIN = .4, INTER = .05,  UNIT = varunit $
+          , small=[1,2,2], boxzoom = [270, 365, 5,70, index,index],/zindex, COAST_THICK=2, TITLE=title,  /PORTRAIT, _extra=ex
+  
+  endif else begin
+     
+     title = sEXP1+' - Levitus Mediterranean salt tongue at depth=' + strtrim(gdept[index],1)+' m / year '+start_end
+     plt, S1.arr - SLev.arr, MININ=-1., MAXIN=1., INTER=0.1,  UNIT = varunit $
+          , small=[1,2,2], boxzoom = [270, 365, 5,70, index,index],/zindex, COAST_THICK=2, TITLE=title,  /PORTRAIT, _extra=ex
+     
+  endelse
+
+  title ='Mediterranean water Lat: '+strtrim(lat,1)+', '+strtrim(depth,1)
+  text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/023_Med_S_tongue_'+sEXP1+'_'+strtrim(lat,1)+'_d'+strtrim(depth,1)+'_S_y'+start_end+'.png  />  ' ]
+  putfile, '/tmp/prova.txt', text
+   
+  if KEYWORD_SET(POSTSCRIPT) then begin
+      closeps
+   endif
+
+
+   return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_PHCXX_PHCYY_ANT_Icethick.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_PHCXX_PHCYY_ANT_Icethick.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_PHCXX_PHCYY_ANT_Icethick.pro	(revision 2200)
@@ -0,0 +1,44 @@
+pro xxx_PHCXX_PHCYY_ANT_Icethick,  I1, I2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+
+ @common
+
+ compile_opt idl2, strictarrsubs
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '0003_'+sEXP1+'_'+sEXP2+'_ANT_IceThick_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+                                ;
+ domdef,20,380,-50,-90
+                                ; 
+ title=sEXP1+' Antartic Ice Thickness / year '+start_end
+
+ I1.arr = I1.arr < 1.
+ plt, I1.arr - 1.E-04, MIN = 0., MAX = 1., INTER = 0.1 , STYLE = 'so0so',CELL_FILL = 2, /STRICTFILL $ 
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title  $
+      , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [-90,0,0], /PORTRAIT, _extra = ex
+
+ if sEXP1 ne sEXP2 then begin
+    
+    title=sEXP1+' - '+sEXP2+' Antartic Ice Thickness / year '+start_end
+    plt, I1.arr - I2.arr, MIN = -1., MAX = 1., INTER = 0.1, /STRICTFILL , STYLE = 'so0so' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title $
+         , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [-90,0,0], /NOERASE, _extra = ex
+    
+ endif
+ 
+ domdef
+
+ title = 'Antarctic Sea-ice Thickness'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/0003_'+sEXP1+'_'+sEXP2+'_ANT_IceThick_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+
+ return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_PHCXX_PHCYY_ARC_Icethick.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_PHCXX_PHCYY_ARC_Icethick.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_PHCXX_PHCYY_ARC_Icethick.pro	(revision 2200)
@@ -0,0 +1,41 @@
+pro xxx_PHCXX_PHCYY_ARC_Icethick,  I1, I2, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common
+
+ compile_opt idl2, strictarrsubs
+
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '0003_'+sEXP1+'_'+sEXP2+'_ARC_IceThick_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+ domdef,20,380,55,90
+           
+ title=sEXP1+' Arctic Ice Thickness / year '+start_end
+
+ I1.arr = I1.arr < 6.
+ plt, I1.arr - 1.E-04, MIN = 0., MAX = 6., INTER = 0.25 ,/STRICTFILL , CELL_FILL = 2, STYLE = 'so0so'  $
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title $
+      , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [90,0,0], /PORTRAIT, _extra = ex
+ ;
+ if sEXP1 ne sEXP2 then begin            
+    title = sEXP1+' - '+sEXP2+' Arctic Ice Thickness / year '+start_end
+    plt, I1.arr - I2.arr, MIN = -3., MAX = 3., INTER = .5, /STRICTFILL , STYLE = 'so0so' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title $
+         , CHARSIZE = 1.05, GLINETHICK = 2., /ORTHO, MAP = [90,0,0], /NOERASE, _extra = ex
+    
+ endif                          ; end of 2
+ 
+ domdef
+
+ title = 'Arctic Sea-ice Thickness'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/0003_'+sEXP1+'_'+sEXP2+'_ARC_IceThick_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Qnet.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Qnet.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_Qnet.pro	(revision 2200)
@@ -0,0 +1,43 @@
+pro xxx_Qnet,  Q1, Q2, QNET, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common
+
+ compile_opt idl2, strictarrsubs
+
+ Q = Q1.arr-Q2.arr
+ sEXP = sEXP1+' - '+sEXP2
+ min =  -200.
+ max = -min
+ inter = 20.
+ 
+ if sEXP2 eq sEXP1 then begin
+    sEXP = sEXP1+' - OAFlux'
+    Q = Q1.arr-QNET.arr
+    min = -200.
+    max = -min
+    inter = 20. 
+ endif
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '003_Qnet_'+sEXP+'_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+ title=sEXP1+' / Qnet year '+start_end
+ plt,  Q1,  MIN = -200., MAX = 200., INTER = 20., STYLE = 'so0so' $
+       , small = [1,2,1], COAST_THICK = 2, TITLE = title, FORMAT = '(I3)', /PORTRAIT, _extra = ex
+                                ;
+ title=sEXP+' / Qnet year '+start_end
+ plt, Q, MIN = min, MAX = max, INTER = inter, STYLE = 'so0so'  $
+      , small = [1,2,2], COAST_THICK = 2, TITLE = title, FORMAT = '(I3)', /NOERASE, _extra = ex
+                                ;
+ title = 'Qnet differences with '+sEXP
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/003_Qnet_'+sEXP+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+ return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_SSS.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_SSS.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_SSS.pro	(revision 2200)
@@ -0,0 +1,40 @@
+pro xxx_SSS, S1, S2, SLev, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common
+ compile_opt idl2, strictarrsubs
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '007_SSS_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+ endif 
+      
+ varunit = S1.unit  
+ 
+ title = sEXP1+' / SSS year '+start_end
+ plt, S1.arr[*,*,0] , MIN = 33., MAX = 41., INTER = .25, STYLE = 'so0so' $
+      , small = [1,2,1], COAST_THICK = 2, TITLE=title, /NOERASE, _extra = ex 
+                                ;
+ if sEXP1 ne sEXP2 then begin
+    
+    title = sEXP1+' - '+sEXP2+' / SSS year '+start_end
+    plt, S1.arr[*,*,0] - S2.arr[*,*,0], MIN = -2., MAX = 2., INTER = .2 $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title, _extra=ex
+
+ endif else begin
+
+    title = sEXP1+' - Levitus / SSS year '+start_end
+    plt, S1.arr[*,*,0]-SLev.arr[*,*,0], MIN = -3., MAX = 3., INTER = 0.2, STYLE = 'so0so' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title, /PORTRAIT, _extra = ex
+
+ endelse
+ 
+                                ;
+   title = 'SSS differences with Levitus and '+sEXP1+'-'+sEXP2
+   text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/007_SSS_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.png  />  ' ]
+   putfile, '/tmp/prova.txt', text
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif 
+
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_SST.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_SST.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_SST.pro	(revision 2200)
@@ -0,0 +1,44 @@
+pro xxx_SST, T1, T2, TRey, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+
+ @common 
+ compile_opt idl2, strictarrsubs
+
+ T = T1.arr[*,*,0]-T2.arr[*,*,0]
+ sEXP = sEXP1+' - '+sEXP2
+ min =  -1.
+ max = -min
+ inter = 0.1
+
+ if sEXP2 eq sEXP1 then begin
+    sEXP = sEXP1
+    T = T1.arr[*,*,0]
+    min = -2.
+    max = 32.
+    inter = 1. 
+ endif
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '006_SST_'+sEXP+'_y'+start_end+'.ps', portrait = 1
+ endif
+   
+ varunit = T1.unit
+
+                               ; 
+ title = sEXP+' / SST year '+start_end
+ plt, T , MIN = min, MAX = max, INTER = inter ,  STYLE = 'so0so' $
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title, FORMAT = '(I2)', /NOERASE, _extra = ex
+                                ; 
+ title=sEXP1+' - NewReynolds  / SST year '+start_end
+ plt, T1.arr[*,*,0]-TRey.arr[*,*,0], MIN = -8., MAX = 8., INTER = 0.5 , STYLE = 'so0so' $
+      , small = [1,2,2], COAST_THICK = 2, TITLE = title, /PORTRAIT, _extra = ex
+                 
+ title = 'SST differences with Reynolds and  '+sEXP
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/006_SST_'+sEXP+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_S_z105.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_S_z105.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_S_z105.pro	(revision 2200)
@@ -0,0 +1,44 @@
+pro xxx_S_z105, S1, S2, SLev, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+
+ @common
+ compile_opt idl2, strictarrsubs
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '011_S_z105_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+;
+ varunit = S1.unit
+;
+
+ title=sEXP1+' S (PSU) depth=105m / Sal year '+start_end
+ plt, S1.arr, MIN = 33., MAX = 38.2, INTER = .2, STYLE = 'so0so' $
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title, boxzoom = [105., 106.], /NOERASE, _extra = ex
+;
+ if sEXP1 ne sEXP2 then begin
+    
+    title = sEXP1+' - '+sEXP2+' S (PSU) depth=105m / Sal year '+start_end
+    plt, S1.arr[*,*,0] - S2.arr[*,*,0], MIN = -1., MAX = 1., INTER = .1 $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title, _extra=ex
+    
+ endif else begin
+    
+    title=sEXP1+' - Levitus S (PSU) depth=105m / Sal year '+start_end
+    plt, S1.arr-SLev.arr, MIN = -1., MAX = 1., INTER=0.1, STYLE='so0so' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = [105., 106.], /PORTRAIT, _extra = ex                           
+    
+ endelse
+ 
+
+ 
+ title = 'Salinity differences at z=105 m with Levitus and '+sEXP2
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/011_S_z105_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text ;
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_TS_ZGlobm.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_TS_ZGlobm.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_TS_ZGlobm.pro	(revision 2200)
@@ -0,0 +1,36 @@
+pro xxx_TS_ZGlobm, T1, T2, TLev, S1, S2, SLev, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+
+ @common
+ compile_opt idl2, strictarrsubs
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '025_TS_ZGlobmean_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', /portrait
+ endif
+
+                                ;
+ title=sEXP1+' (Black) & '+sEXP2+' (Red) - Levitus Temp. Global mean / year '+start_end
+ plt1d, T1.arr - TLev.arr, typein = 'z', ticklen = 1 , MIN = -2., MAX = 2., boxzoom = [4.,5300.], /KEEPBOTTOM $
+        , small = [1,2,1], XGRIDSTYLE = 2, YGRIDSTYLE = 2, TITLE = title, _extra = ex
+ plt1d, T2.arr - TLev.arr, typein = 'z',  ticklen = 1 , MIN = -2., MAX = 2., boxzoom = [4.,5300.], /KEEPBOTTOM  $
+        , /ov1d, COLOR = 250,TITLE = title, _extra = ex 
+                                ;
+
+ title=sEXP1+'(Black) & '+sEXP2+' (Red) - Levitus Sal. Global mean / year '+start_end
+ plt1d, S1.arr - SLev.arr, typein = 'z', ticklen = 1 , MIN = -.2, MAX = .2, boxzoom = [4.,5300.], /KEEPBOTTOM $
+        , small = [1,2,2], XGRIDSTYLE = 2, YGRIDSTYLE = 2, TITLE = title, /NOERASE, _extra = ex
+ plt1d, S2.arr - SLev.arr, typein = 'z',  ticklen = 1 , MIN = -2., MAX = 2., boxzoom = [4.,5300.], /KEEPBOTTOM $
+        ,  /ov1d, COLOR = 250, TITLE = title, _extra = ex 
+
+
+ title = 'Temperature & Salinity horizontal mean'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/025_TS_ZGlobmean_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+ return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_T_z105.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_T_z105.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_T_z105.pro	(revision 2200)
@@ -0,0 +1,41 @@
+pro xxx_T_z105,  T1, T2, TLev, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common 
+ compile_opt idl2, strictarrsubs
+
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '010_T_z105_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+ endif
+;
+ varunit = T1.unit     
+           ;                              
+ title = sEXP1+' T (°C) depth=105m / Temp year '+start_end
+ plt, T1.arr, MIN = -2., MAX = 32., INTER = 1., STYLE = 'so0so'  $
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title, FORMAT = '(I2)', boxzoom = [105., 106.], /NOERASE, _extra = ex
+                                ;
+if sEXP1 ne sEXP2 then begin
+
+  title = sEXP1+' - '+sEXP2+' T (°C) depth=105m / Temp year '+start_end
+  plt, T1.arr-T2.arr, MIN = -2., MAX = 2., INTER = .2 $
+       , small = [1,2,2], COAST_THICK = 2, TITLE = title,  _extra=ex
+
+endif else begin
+
+ title = sEXP1+' - Levitus T (°C) depth=105m / Temp year '+start_end
+ plt, T1.arr-TLev.arr, MIN = -4., MAX = 4., INTER = .5, STYLE = 'so0so'  $
+      , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = [105., 106.], /PORTRAIT, _extra = ex   
+endelse
+                    
+
+ title = 'Temperature differences at z=105 m with Levitus and '+sEXP1+'-'+sEXP2
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/010_T_z105_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text ;
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+ 
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ZonMxl.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ZonMxl.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_ZonMxl.pro	(revision 2200)
@@ -0,0 +1,34 @@
+pro xxx_ZonMxl, MXL1, MXL2, MLD, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+  
+ @common
+
+ compile_opt idl2, strictarrsubs
+
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '013_ZonMxl_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+
+                                ;
+ title=sEXP1+' (Black) , '+sEXP2+' (Red) & Clim (Blue) Mxl10 / year '+start_end
+ plt1d, -MXL1.arr, MIN = -300., MAX = 0., INTER = 10., typein = 'y' $
+        , small=[1,1,1], boxzoom=5500, ZOOM=500, CHARSIZE=.8, TITLE = title, /PORTRAIT, _extra=ex  ; color by default = black
+                                ;
+ plt1d, -MXL2.arr, MIN = -300., MAX = 0., INTER = 10., typein = 'y' $
+        , /ov1d, COLOR = 250, TITLE = title, /NOERASE, _extra = ex  ; color 250 = red
+                                ;
+ plt1d, -MLD.arr, MIN = -300., MAX = 0., INTER = 10., typein = 'y' $
+        ,  /ov1d, COLOR = 100, THICK = 3, TITLE = title, /NOERASE, _extra = ex ; color 100 = blue
+
+ title = 'Mxl field'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/013_ZonMxl_'+sEXP1+'_'+sEXP2+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+ return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_mxl10.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_mxl10.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_mxl10.pro	(revision 2200)
@@ -0,0 +1,46 @@
+pro xxx_mxl10, MXL1, MXL2, MLD, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, _extra = ex
+
+ @common
+
+ compile_opt idl2, strictarrsubs
+
+ MXL = MXL1.arr-MXL2.arr
+ sEXP = sEXP1+' - '+sEXP2
+ min =  -100.
+ max = -min
+ inter = 10.
+ 
+ if sEXP2 eq sEXP1 then begin
+    sEXP = sEXP1+' - MLD '
+    MXL = MXL1.arr-MLD.arr
+    min = -80.
+    max = -min
+    inter = 10. 
+ endif
+
+ 
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    openps, '012_Mxl10_'+sEXP+'_y'+start_end+'.ps', portrait = 1
+ endif
+ 
+ title=sEXP1+' Mxl10 / year '+start_end
+ plt, MXL1, MIN = 0., MAX = 500., INTER = 25., /NOCONTOUR ,FORMAT = '(I3)' $
+      , small = [1,2,1], COAST_THICK = 2, TITLE = title, /PORTRAIT, _extra = ex
+ ; 
+
+ title=sEXP+' Mxl10 / year '+start_end
+ plt, MXL, MIN = min, MAX = max, INTER = inter  $
+      , small = [1,2,2], COAST_THICK = 2, TITLE = title, /NOCONTOUR, /NOERASE, _extra = ex
+                                ; end of 2
+ title = 'Mxl10 field'
+ text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/012_Mxl10_'+sEXP+'_y'+start_end+'.png  />  ' ]
+ putfile, '/tmp/prova.txt', text
+
+
+ if KEYWORD_SET(POSTSCRIPT) then begin
+    closeps
+ endif
+
+ return
+end
+
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_zonal_S.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_zonal_S.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_zonal_S.pro	(revision 2200)
@@ -0,0 +1,70 @@
+pro xxx_zonal_S, S1, S2, SLev, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, SUBBASIN = subbasin, MASK_FILENAME = mask_filename, _extra = ex
+
+  compile_opt idl2, strictarrsubs
+
+   @common
+
+   if KEYWORD_SET(SUBBASIN) then  subname = subbasin else  subname = "Glo"
+   
+
+   if KEYWORD_SET(POSTSCRIPT) then begin
+      openps, '015_Zonal_S_'+subname+'_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+   endif
+
+                                ; looking for longitudinal index corresponding to the highest latitude (closest to the North Pole)
+   index=where(gphit eq max(gphit))
+   nx=index[0] mod jpi
+   gphi_save=gphit
+   gphit[0,*]=gphit[nx,*]
+
+   if KEYWORD_SET(SUBBASIN) then begin
+                                ; save tmask
+      tmasksv = tmask
+                                ; 
+      CASE 1 of 
+         subbasin eq 'Atl' : var = 'atlmsk_nomed'
+         subbasin eq 'Ind' : var = 'indmsk_nored'
+         subbasin eq 'Pac' : var = 'pacmsk'
+      ENDCASE
+                                ;
+      msk = read_ncdf( var, filename = mask_filename, _extra =ex)
+
+; from 2D array to 3D array
+      msk = msk.arr[*]#replicate(1., nzt)
+      tmask[firstxt:lastxt,firstyt:lastyt,firstzt:lastzt] = tmask[firstxt:lastxt,firstyt:lastyt,firstzt:lastzt] * msk
+   endif 
+
+   varunit = S1.unit
+;
+   title=sEXP1+' '+subname+' / S year '+start_end
+   pltz, S1.arr, MININ = 32., MAXIN = 37., INTER = .2, typein = 'yz' $ 
+         , small = [1,2,1], COAST_THICK = 2, TITLE = title, boxzoom = 5500, ZOOM = 1000, /PORTRAIT,  _extra=ex 
+; 
+   if sEXP1 ne sEXP2 then begin
+      
+      title = sEXP1+' - '+sEXP2+' '+subname+' / S year '+start_end
+      pltz, S1.arr-S2.arr, MIN = -1., MAX = 1., INTER = .1, typein = 'yz' $
+           , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = 5500, ZOOM = 1000, /NOERASE,  _extra=ex
+  
+   endif else begin
+      
+      title=sEXP1+' - Levitus '+subname+'/ S year'+start_end
+      pltz, S1.arr-SLev.arr, MININ = -1, MAXIN = 1., INTER = .1, typein = 'yz'  $
+            , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = 5500, ZOOM = 1000, /NOERASE, _extra = ex
+   endelse
+;
+   title = 'Salinity differences in zonal average ' + subname +' with Levitus and '+sEXP1+'-'+sEXP2
+   text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/015_Zonal_S_'+subname+'_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.png  />  ' ]
+   putfile, '/tmp/prova.txt', text
+
+   if KEYWORD_SET(POSTSCRIPT) then begin
+      closeps
+   endif
+
+
+   if KEYWORD_SET(SUBBASIN) then tmask = tmasksv
+
+   gphit=gphi_save
+
+   return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_zonal_T.pro
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_zonal_T.pro	(revision 2200)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/ORCA2_LIM/IDL_scripts/xxx_zonal_T.pro	(revision 2200)
@@ -0,0 +1,77 @@
+pro xxx_zonal_T, T1, T2, TLev, sEXP1, sEXP2, start_end, POSTSCRIPT = postscript, SUBBASIN = subbasin, MASK_FILENAME = mask_filename, _extra = ex
+  
+  compile_opt idl2, strictarrsubs
+
+   @common
+
+   if KEYWORD_SET(SUBBASIN) then subname = subbasin else subname = "Glo"
+
+
+   if KEYWORD_SET(POSTSCRIPT) then begin
+      openps, '014_Zonal_T_'+subname+'_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.ps', portrait = 1
+   endif
+
+                                ; looking for longitudinal index corresponding to the highest latitude (closest to the North Pole)
+   index=where(gphit eq max(gphit))
+   nx=index[0] mod jpi
+   gphi_save=gphit
+   gphit[0,*]=gphit[nx,*]
+
+   if KEYWORD_SET(SUBBASIN) then begin
+ ; save tmask
+      tmasksv = tmask
+ ; 
+      CASE 1 of 
+         subbasin eq 'Atl' : var = 'atlmsk_nomed'
+         subbasin eq 'Ind' : var = 'indmsk_nored'
+         subbasin eq 'Pac' : var = 'pacmsk'
+      ENDCASE
+                                ;
+      msk = read_ncdf( var, filename = mask_filename, _extra =ex)
+
+; from 2D array to 3D array
+      msk = msk.arr[*]#replicate(1., nzt)
+      tmask[firstxt:lastxt,firstyt:lastyt,firstzt:lastzt] = tmask[firstxt:lastxt,firstyt:lastyt,firstzt:lastzt] * msk
+
+   endif
+
+varunit = T1.unit
+;
+ 
+   title=sEXP1+' '+subname+' / T year '+start_end
+   pltz, T1.arr, MININ = -2., MAXIN = 30., INTER = 1., typein = 'yz', FORMAT = '(I2)' $ 
+         , small =[ 1,2,1], COAST_THICK = 2, TITLE = title, boxzoom = 5500, ZOOM = 1000, /PORTRAIT, _extra = ex 
+; 
+if sEXP1 ne sEXP2 then begin
+
+  title = sEXP1+' - '+sEXP2+' T (°C) depth=105m / Temp year '+start_end
+  pltz, T1.arr-T2.arr, MIN = -2., MAX = 2., INTER = .2, typein = 'yz'  $
+       , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = 5500, ZOOM = 1000, /PORTRAIT, _extra=ex
+
+endif else begin
+
+   title=sEXP1+' - Levitus '+subname+'/ T year'+start_end
+   pltz, T1.arr-TLev.arr, MININ = -4., MAXIN = 4., INTER = .5, typein='yz', FORMAT = '(I2)' $
+         , small = [1,2,2], COAST_THICK = 2, TITLE = title, boxzoom = 5500, ZOOM = 1000, /NOERASE, _extra = ex
+   
+endelse
+         
+   
+;
+   title = 'Temperature differences in zonal average ' + subname+' with Levitus and '+sEXP1+'-'+sEXP2
+   text = [   title, '<img width="80%" src=/Users/sflod/TOOLS/my_IDL/PS/v32colib_v32colib/ps/014_Zonal_T_'+subname+'_'+sEXP1+'-'+sEXP2+'_y'+start_end+'.png  />  ' ]
+   putfile, '/tmp/prova.txt', text
+
+
+   if KEYWORD_SET(POSTSCRIPT) then begin
+      closeps
+   endif
+
+   if KEYWORD_SET(SUBBASIN) then tmask = tmasksv
+   
+  
+   gphit=gphi_save
+
+
+   return
+end
Index: /branches/DEV_r2106_LOCEAN2010/CONFIG/POMME/EXP00/namelist
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/CONFIG/POMME/EXP00/namelist	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/CONFIG/POMME/EXP00/namelist	(revision 2200)
@@ -178,4 +178,5 @@
    sn_prec     = 'precip_1988.nc' ,       -1          , 'precip'   ,    .true.      , .true. ,   'yearly' , ''
    sn_snow     = 'precip_1988.nc' ,       -1          , 'precip'   ,    .true.      , .true. ,   'yearly' , ''
+   sn_tdif     = 'taudif_core'    ,       24          , 'taudif'   ,    .true.      , .true.  ,   'yearly'  ,''
 !
    cn_dir      = './'      !  root directory for the location of the bulk files
@@ -316,7 +317,7 @@
     rn_dpsin   =    1.     !     -           -         -       south   -      -
     rn_dpeob   = 1500.     !  time relaxation (days) for the east  open boundary
-    rn_dpwob   =   15.     !     -           -         -     west    -      -
+    rn_dpwob   =  150.     !     -           -         -     west    -      -
     rn_dpnob   =  150.     !     -           -         -     north   -      -
-    rn_dpsob   =   15.     !     -           -         -     south   -      -
+    rn_dpsob   =  150.     !     -           -         -     south   -      -
     rn_volemp  =  1.       !  = 0 the total volume change with the surface flux (E-P-R)
                            !  = 1 the total volume remains constant
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/daymod.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/daymod.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DOM/daymod.F90	(revision 2200)
@@ -239,5 +239,6 @@
       ENDIF
 
-      IF( lrst_oce )   CALL day_rst( kt, 'WRITE' )
+      CALL rst_opn( kt )                                ! Open the restart file if needed and control lrst_oce
+      IF( lrst_oce )   CALL day_rst( kt, 'WRITE' )      ! write day restart information
       !
    END SUBROUTINE day
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynspg_ts.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 2200)
@@ -595,7 +595,13 @@
             vn_b (:,:) = vn_b(:,:) * hvr(:,:)
          ENDIF
+         IF( iom_varid( numror, 'sshn_b', ldstop = .FALSE. ) > 0 ) THEN
+            CALL iom_get( numror, jpdom_autoglo, 'sshn_b' , sshn_b (:,:) )   ! filtered extrenal ssh
+         ELSE
+            sshn_b(:,:)=sshb(:,:)   ! if not in restart set previous time mean to current baroclinic before value   
+         ENDIF 
       ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN
-         CALL iom_rstput( kt, nitrst, numrow, 'un_b'  , un_b  (:,:) )   ! external velocity issued
-         CALL iom_rstput( kt, nitrst, numrow, 'vn_b'  , vn_b  (:,:) )   ! from barotropic loop
+         CALL iom_rstput( kt, nitrst, numrow, 'un_b'   , un_b  (:,:) )   ! external velocity and ssh
+         CALL iom_rstput( kt, nitrst, numrow, 'vn_b'   , vn_b  (:,:) )   ! issued from barotropic loop
+         CALL iom_rstput( kt, nitrst, numrow, 'sshn_b' , sshn_b(:,:) )   ! 
       ENDIF
       !
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_ioipsl.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_ioipsl.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_ioipsl.F90	(revision 2200)
@@ -81,6 +81,6 @@
          iln = INDEX( cdname, '.nc' )
          IF( ldwrt ) THEN  ! the file should be open in write mode so we create it...
-            IF( llclobber ) THEN   ;   clstatus = 'REPLACE' 
-            ELSE                   ;   clstatus = 'NEW'
+            IF( llclobber ) THEN   ;   clstatus = 'REPLACE 64' 
+            ELSE                   ;   clstatus = 'NEW 64'
             ENDIF
             IF( jpnij > 1 ) THEN
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_nf90.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_nf90.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/IOM/iom_nf90.F90	(revision 2200)
@@ -94,6 +94,6 @@
             IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//TRIM(cdname)//' in WRITE mode'
 
-            IF( llclobber ) THEN   ;   imode = NF90_CLOBBER 
-            ELSE                   ;   imode = NF90_NOCLOBBER 
+            IF( llclobber ) THEN   ;   imode = IOR( NF90_64BIT_OFFSET, NF90_CLOBBER   )
+            ELSE                   ;   imode = IOR( NF90_64BIT_OFFSET, NF90_NOCLOBBER ) 
             ENDIF
             CALL iom_nf90_check(NF90_CREATE( TRIM(cdname), imode, if90id, chunksize = ichunk ), clinfo)
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfdyn_c1d.h90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfdyn_c1d.h90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/LDF/ldfdyn_c1d.h90	(revision 2200)
@@ -28,4 +28,5 @@
 
       !! * Local variables
+      INTEGER  ::   jk   ! dummy loop indice
       REAL(wp) ::    zdam,  zwam,  zm00,  zm01,  zmhf,  zmhs
       REAL(wp) ::   zdam2, zwam2, zm200, zm201, zmh2f, zmh2s
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obc_oce.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obc_oce.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obc_oce.F90	(revision 2200)
@@ -87,5 +87,5 @@
    INTEGER ::   nje1m2, nje0m1    !: do loop index in mpp case for jpjefm1-1,jpjed
 
-   REAL(wp), DIMENSION(jpjed:jpjef) ::   &  !:
+   REAL(wp), DIMENSION(jpj) ::   &  !:
       sshfoe,           & !: now climatology of the east boundary sea surface height
       ubtfoe,vbtfoe       !: now climatology of the east boundary barotropic transport
@@ -97,6 +97,6 @@
       !                   ! in the obcdyn.F90 routine
 
-   REAL(wp), DIMENSION(jpjed:jpjef,jpj) ::   sshfoe_b      !: east boundary ssh correction averaged over the barotropic loop
-      !                                                    !  (if Flather's algoritm applied at open boundary)
+   REAL(wp), DIMENSION(jpi,jpj) ::   sshfoe_b      !: east boundary ssh correction averaged over the barotropic loop
+      !                                            !  (if Flather's algoritm applied at open boundary)
 
    !!-------------------------------
@@ -124,5 +124,5 @@
    INTEGER ::   njw1m2, njw0m1     !: do loop index in mpp case for jpjwfm2,jpjwd
 
-   REAL(wp), DIMENSION(jpjwd:jpjwf) ::   &  !:
+   REAL(wp), DIMENSION(jpj) ::   &  !:
       sshfow,           & !: now climatology of the west boundary sea surface height
       ubtfow,vbtfow       !: now climatology of the west boundary barotropic transport
@@ -134,6 +134,6 @@
       !                   !  in the obcdyn.F90 routine
 
-   REAL(wp), DIMENSION(jpjwd:jpjwf,jpj) ::   sshfow_b    !: west boundary ssh correction averaged over the barotropic loop
-      !                                                  !  (if Flather's algoritm applied at open boundary)
+   REAL(wp), DIMENSION(jpi,jpj) ::   sshfow_b    !: west boundary ssh correction averaged over the barotropic loop
+      !                                          !  (if Flather's algoritm applied at open boundary)
 
    !!-------------------------------
@@ -162,5 +162,5 @@
    INTEGER ::   njn0m1, njn1m1     !: do loop index in mpp case for jpnob-1
 
-   REAL(wp), DIMENSION(jpind:jpinf) ::   &  !:
+   REAL(wp), DIMENSION(jpi) ::   &  !:
       sshfon,           & !: now climatology of the north boundary sea surface height
       ubtfon,vbtfon       !: now climatology of the north boundary barotropic transport
@@ -172,6 +172,6 @@
       !                   !  in yhe obcdyn.F90 routine
 
-   REAL(wp), DIMENSION(jpind:jpinf,jpj) ::   sshfon_b      !: north boundary ssh correction averaged over the barotropic loop
-      !                                                    !  (if Flather's algoritm applied at open boundary)
+   REAL(wp), DIMENSION(jpi,jpj) ::   sshfon_b      !: north boundary ssh correction averaged over the barotropic loop
+      !                                            !  (if Flather's algoritm applied at open boundary)
 
    !!--------------------------------
@@ -199,5 +199,5 @@
    INTEGER ::   njs0p1, njs1p1     !: do loop index in mpp case for jpsob+1
 
-   REAL(wp), DIMENSION(jpisd:jpisf) ::    &   !:
+   REAL(wp), DIMENSION(jpi) ::    &   !:
       sshfos,           & !: now climatology of the south boundary sea surface height
       ubtfos,vbtfos       !: now climatology of the south boundary barotropic transport
@@ -209,6 +209,6 @@
       !                   !  in the obcdyn.F90 routine
 
-   REAL(wp), DIMENSION(jpisd:jpisf,jpj) ::   sshfos_b     !: south boundary ssh correction averaged over the barotropic loop
-      !                                                   !  (if Flather's algoritm applied at open boundary)
+   REAL(wp), DIMENSION(jpi,jpj) ::   sshfos_b     !: south boundary ssh correction averaged over the barotropic loop
+      !                                           !  (if Flather's algoritm applied at open boundary)
 
    !!--------------------------------
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcdta.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 2200)
@@ -1,65 +1,85 @@
 MODULE obcdta
-  !!==============================================================================
-  !!                            ***  MODULE obcdta  ***
-  !! Open boundary data : read the data for the open boundaries.
-  !!==============================================================================
+   !!==============================================================================
+   !!                            ***  MODULE obcdta  ***
+   !! Open boundary data : read the data for the open boundaries.
+   !!==============================================================================
 #if defined key_obc
-  !!------------------------------------------------------------------------------
-  !!   'key_obc'         :                                Open Boundary Conditions
-  !!------------------------------------------------------------------------------
-  !!   obc_dta           : read u, v, t, s data along each open boundary
-  !!------------------------------------------------------------------------------
-  !! * Modules used
-  USE oce             ! ocean dynamics and tracers 
-  USE dom_oce         ! ocean space and time domain
-  USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-  USE phycst          ! physical constants
-  USE obc_oce         ! ocean open boundary conditions
-  USE in_out_manager  ! I/O logical units
-  USE lib_mpp         ! distributed memory computing
-  USE dynspg_oce
-  USE ioipsl          ! now only for  ymds2ju function 
-  USE iom             ! 
-
-  IMPLICIT NONE
-  PRIVATE
-
-  !! * Accessibility
-  PUBLIC obc_dta      ! routines called by step.F90
-  PUBLIC obc_dta_bt   ! routines called by dynspg_ts.F90
-
-  !! * Shared module variables
-  REAL(wp),  DIMENSION(2)              ::  zjcnes_obc   ! 
-  REAL(wp),  DIMENSION(:), ALLOCATABLE :: ztcobc
-  REAL(wp) :: rdt_obc
-  REAL(wp) :: zjcnes
-  INTEGER :: imm0, iyy0, idd0, iyy, imm, idd
-  INTEGER :: nt_a=2, nt_b=1, itobc, ndate0_cnes, nday_year0
-  INTEGER ::  itobce, itobcw, itobcs, itobcn, itobc_b  ! number of time steps in OBC files
-
-  INTEGER ::   &
-       ntobc      , &     !:  where we are in the obc file
-       ntobc_b    , &     !:  first record used
-       ntobc_a            !:  second record used
-
-  CHARACTER (len=40) :: &    ! name of data files
-       cl_obc_eTS   , cl_obc_eU,  &
-       cl_obc_wTS   , cl_obc_wU,  &
-       cl_obc_nTS   , cl_obc_nV,  &
-       cl_obc_sTS   , cl_obc_sV
-
-  ! arrays used for interpolating time dependent data on the boundaries
-  REAL(wp), DIMENSION(jpj,jpk,jptobc) :: uedta, vedta, tedta, sedta    ! East
-  REAL(wp), DIMENSION(jpj,jpk,jptobc) :: uwdta, vwdta, twdta, swdta    ! West
-  REAL(wp), DIMENSION(jpi,jpk,jptobc) :: undta, vndta, tndta, sndta    ! North
-  REAL(wp), DIMENSION(jpi,jpk,jptobc) :: usdta, vsdta, tsdta, ssdta    ! South
-
-  LOGICAL, DIMENSION (jpj,jpk ) :: ltemsk=.TRUE., luemsk=.TRUE., lvemsk=.TRUE.  ! boolean msks
-  LOGICAL, DIMENSION (jpj,jpk ) :: ltwmsk=.TRUE., luwmsk=.TRUE., lvwmsk=.TRUE.  ! used for outliers
-  LOGICAL, DIMENSION (jpi,jpk ) :: ltnmsk=.TRUE., lunmsk=.TRUE., lvnmsk=.TRUE.  ! checks
-  LOGICAL, DIMENSION (jpi,jpk ) :: ltsmsk=.TRUE., lusmsk=.TRUE., lvsmsk=.TRUE.
-
-  !! * Substitutions
+   !!------------------------------------------------------------------------------
+   !!   'key_obc'         :                                Open Boundary Conditions
+   !!------------------------------------------------------------------------------
+   !!   obc_dta           : read u, v, t, s data along each open boundary
+   !!------------------------------------------------------------------------------
+   !! * Modules used
+   USE oce             ! ocean dynamics and tracers 
+   USE dom_oce         ! ocean space and time domain
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+   USE phycst          ! physical constants
+   USE obc_par         ! ocean open boundary conditions
+   USE obc_oce         ! ocean open boundary conditions
+   USE in_out_manager  ! I/O logical units
+   USE lib_mpp         ! distributed memory computing
+   USE dynspg_oce
+   USE ioipsl          ! now only for  ymds2ju function 
+   USE iom             ! 
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! * Accessibility
+   PUBLIC obc_dta      ! routines called by step.F90
+   PUBLIC obc_dta_bt   ! routines called by dynspg_ts.F90
+
+   !! * Shared module variables
+   REAL(wp),  DIMENSION(2)              ::  zjcnes_obc   ! 
+   REAL(wp),  DIMENSION(:), ALLOCATABLE :: ztcobc
+   REAL(wp) :: rdt_obc
+   REAL(wp) :: zjcnes
+   INTEGER :: imm0, iyy0, idd0, iyy, imm, idd
+   INTEGER :: nt_a=2, nt_b=1, itobc, ndate0_cnes, nday_year0
+   INTEGER ::  itobce, itobcw, itobcs, itobcn, itobc_b  ! number of time steps in OBC files
+
+   INTEGER ::   &
+      ntobc      , &     !:  where we are in the obc file
+      ntobc_b    , &     !:  first record used
+      ntobc_a            !:  second record used
+
+   CHARACTER (len=40) :: &    ! name of data files
+      cl_obc_eTS   , cl_obc_eU,  &
+      cl_obc_wTS   , cl_obc_wU,  &
+      cl_obc_nTS   , cl_obc_nV,  &
+      cl_obc_sTS   , cl_obc_sV
+
+# if defined key_dynspg_ts
+   ! bt arrays for interpolating time dependent data on the boundaries
+   INTEGER :: nt_m=0, ntobc_m
+   REAL(wp), DIMENSION(jpj,0:jptobc) :: ubtedta, vbtedta, sshedta  ! East
+   REAL(wp), DIMENSION(jpj,0:jptobc) :: ubtwdta, vbtwdta, sshwdta	! West
+   REAL(wp), DIMENSION(jpi,0:jptobc) :: ubtndta, vbtndta, sshndta	! North
+   REAL(wp), DIMENSION(jpi,0:jptobc) :: ubtsdta, vbtsdta, sshsdta	! South
+   ! arrays used for interpolating time dependent data on the boundaries
+   REAL(wp), DIMENSION(jpj,jpk,0:jptobc) :: uedta, vedta, tedta, sedta    ! East
+   REAL(wp), DIMENSION(jpj,jpk,0:jptobc) :: uwdta, vwdta, twdta, swdta    ! West
+   REAL(wp), DIMENSION(jpi,jpk,0:jptobc) :: undta, vndta, tndta, sndta    ! North
+   REAL(wp), DIMENSION(jpi,jpk,0:jptobc) :: usdta, vsdta, tsdta, ssdta    ! South
+# else
+   ! bt arrays for interpolating time dependent data on the boundaries
+   REAL(wp), DIMENSION(jpj,jptobc) :: ubtedta, vbtedta, sshedta  ! East
+   REAL(wp), DIMENSION(jpj,jptobc) :: ubtwdta, vbtwdta, sshwdta        ! West
+   REAL(wp), DIMENSION(jpi,jptobc) :: ubtndta, vbtndta, sshndta        ! North
+   REAL(wp), DIMENSION(jpi,jptobc) :: ubtsdta, vbtsdta, sshsdta        ! South
+   ! arrays used for interpolating time dependent data on the boundaries
+   REAL(wp), DIMENSION(jpj,jpk,jptobc) :: uedta, vedta, tedta, sedta    ! East
+   REAL(wp), DIMENSION(jpj,jpk,jptobc) :: uwdta, vwdta, twdta, swdta    ! West
+   REAL(wp), DIMENSION(jpi,jpk,jptobc) :: undta, vndta, tndta, sndta    ! North
+   REAL(wp), DIMENSION(jpi,jpk,jptobc) :: usdta, vsdta, tsdta, ssdta    ! South
+# endif
+   LOGICAL, DIMENSION (jpj,jpk ) :: ltemsk=.TRUE., luemsk=.TRUE., lvemsk=.TRUE.  ! boolean msks
+   LOGICAL, DIMENSION (jpj,jpk ) :: ltwmsk=.TRUE., luwmsk=.TRUE., lvwmsk=.TRUE.  ! used for outliers
+   LOGICAL, DIMENSION (jpi,jpk ) :: ltnmsk=.TRUE., lunmsk=.TRUE., lvnmsk=.TRUE.  ! checks
+   LOGICAL, DIMENSION (jpi,jpk ) :: ltsmsk=.TRUE., lusmsk=.TRUE., lvsmsk=.TRUE.
+
+   !! * Substitutions
 #  include "obc_vectopt_loop_substitute.h90"
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2006)
@@ -70,876 +90,657 @@
 CONTAINS
 
-  SUBROUTINE obc_dta( kt )
-    !!---------------------------------------------------------------------------
-    !!                      ***  SUBROUTINE obc_dta  ***
-    !!                    
-    !! ** Purpose :   Find the climatological  boundary arrays for the specified date, 
-    !!                The boundary arrays are netcdf files. Three possible cases: 
-    !!                - one time frame only in the file (time dimension = 1).
-    !!                in that case the boundary data does not change in time.
-    !!                - many time frames. In that case,  if we have 12 frames
-    !!                we assume monthly fields. 
-    !!                Else, we assume that time_counter is in seconds 
-    !!                since the beginning of either the current year or a reference
-    !!                year given in the namelist.
-    !!                (no check is done so far but one would have to check the "unit"
-    !!                 attribute of variable time_counter).
-    !!
-    !!
-    !! History :
-    !!        !  98-05 (J.M. Molines) Original code
-    !!   8.5  !  02-10 (C. Talandier, A-M. Treguier) Free surface, F90
-    !!
-    !!   9.0  !  04-06 (F. Durand, A-M. Treguier) Netcdf BC files on input
-    !!        !  2007-2008 (C. Langlais, P. Mathiot, J.M. Molines) high frequency boundaries data
-    !!---------------------------------------------------------------------------
-    !! * Arguments
-    INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
-
-    !! * Local declarations
-    INTEGER ::   ji, jj, jk, ii, ij ,it  ! dummy loop indices
-    INTEGER ::  ikprint                                ! frequency for printouts.
-    INTEGER, SAVE :: immfile, iyyfile                     !
-    INTEGER :: nt              !  record indices (incrementation)
-    INTEGER :: istop           ! local error check
-
-    REAL(wp) ::   zxy, znum, zden ! time interpolation weight
-
-    ! variables for the julian day calculation
-    INTEGER :: iyear, imonth, iday
-    REAL(wp) :: zsec , zjulian, zjuliancnes   
-
-    ! IOM STUFF
-    INTEGER ::  idvar, id_e, id_w, id_n, id_s, id_x       ! file identifiers
-    INTEGER, DIMENSION(1)  :: itmp
-    CHARACTER(LEN=25) :: cl_vname
-
-    !!---------------------------------------------------------------------------
-
-    ! 0.  initialisation :
-    ! --------------------
-    IF ( kt == nit000  )  CALL obc_dta_ini ( kt )
-    IF ( nobc_dta == 0 )  RETURN   ! already done in obc_dta_ini
-    IF ( itobc == 1    )  RETURN   ! case of only one time frame in file done in obc_dta_ini
-
-    ! in the following code, we assume that obc data are read from files, with more than 1 time frame in it
-
-    iyyfile=iyy ; immfile = 00  ! set component of the current file name
-    IF ( cffile /= 'annual') immfile = imm   ! 
-    IF ( ln_obc_clim       ) iyyfile = 0000  ! assume that climatological files are labeled y0000
-
-    ! 1. Synchronize time of run with time of data files
-    !---------------------------------------------------
-    ! nday_year is the day number in the current year ( 1 for 01/01 )
-    zsec=MOD( (kt-nit000)*rdt - (nday_year - nday_year0 )*rday, rday ) ! number of seconds in the current day
-    IF (ln_obc_clim)  THEN 
-      zjcnes = nday_year - 1  + zsec/rday
-    ELSE
-      zjcnes = zjcnes + rdt/rday
-    ENDIF
-
-    ! look for 'before' record number in the current file
-    ntobc = nrecbef ()  ! this function return the record number for 'before', relative to zjcnes
-
-    IF (MOD(kt-1,10)==0) THEN
-       IF (lwp) WRITE(numout,*) 'kt= ',kt,' zjcnes =', zjcnes,' ndastp =',ndastp, 'mm =',imm 
-    END IF
-
-    ! 2. read a new data if necessary 
-    !--------------------------------
-    IF ( ntobc /= ntobc_b ) THEN
-    ! we need to read the 'after' record
-    ! swap working index:
-    nt=nt_b ; nt_b=nt_a ; nt_a=nt
-    ntobc_b = ntobc
-
-    ! new record number :
-    ntobc_a = ntobc_a + 1 
-
-    ! all tricky things related to record number, changing files etc... are managed by obc_read
-     
-    CALL obc_read (kt, nt_a, ntobc_a, iyyfile, immfile )
-
-    ! update zjcnes_obc
-    zjcnes_obc(nt_b)= ztcobc(ntobc_b)
-    zjcnes_obc(nt_a)= ztcobc(ntobc_a)
-    ENDIF
-
-    ! 3.   interpolation at each time step
-    ! ------------------------------------
-    IF ( ln_obc_clim) THEN
-      znum= MOD(zjcnes           - zjcnes_obc(nt_b), REAL(nyear_len(1),wp) ) ; IF ( znum < 0 ) znum = znum + REAL(nyear_len(1),wp)
-      zden= MOD(zjcnes_obc(nt_a) - zjcnes_obc(nt_b), REAL(nyear_len(1),wp) ) ; IF ( zden < 0 ) zden = zden + REAL(nyear_len(1),wp)
-    ELSE
-      znum= zjcnes           - zjcnes_obc(nt_b)
-      zden= zjcnes_obc(nt_a) - zjcnes_obc(nt_b)
-    ENDIF
-    zxy = znum / zden
-
-    IF( lp_obc_east ) THEN
-       !  fills sfoe, tfoe, ufoe ,vfoe
-       sfoe(:,:) = zxy * sedta (:,:,nt_a) + (1. - zxy)*sedta(:,:,nt_b)
-       tfoe(:,:) = zxy * tedta (:,:,nt_a) + (1. - zxy)*tedta(:,:,nt_b)
-       ufoe(:,:) = zxy * uedta (:,:,nt_a) + (1. - zxy)*uedta(:,:,nt_b)
-       vfoe(:,:) = zxy * vedta (:,:,nt_a) + (1. - zxy)*vedta(:,:,nt_b)
-    ENDIF
-
-    IF( lp_obc_west) THEN
-       !  fills sfow, tfow, ufow ,vfow
-       sfow(:,:) = zxy * swdta (:,:,nt_a) + (1. - zxy)*swdta(:,:,nt_b)
-       tfow(:,:) = zxy * twdta (:,:,nt_a) + (1. - zxy)*twdta(:,:,nt_b)
-       ufow(:,:) = zxy * uwdta (:,:,nt_a) + (1. - zxy)*uwdta(:,:,nt_b)
-       vfow(:,:) = zxy * vwdta (:,:,nt_a) + (1. - zxy)*vwdta(:,:,nt_b)
-    ENDIF
-
-    IF( lp_obc_north) THEN
-       !  fills sfon, tfon, ufon ,vfon
-       sfon(:,:) = zxy * sndta (:,:,nt_a) + (1. - zxy)*sndta(:,:,nt_b)
-       tfon(:,:) = zxy * tndta (:,:,nt_a) + (1. - zxy)*tndta(:,:,nt_b)
-       ufon(:,:) = zxy * undta (:,:,nt_a) + (1. - zxy)*undta(:,:,nt_b)
-       vfon(:,:) = zxy * vndta (:,:,nt_a) + (1. - zxy)*vndta(:,:,nt_b)
-    ENDIF
-
-    IF( lp_obc_south) THEN
-       !  fills sfos, tfos, ufos ,vfos
-       sfos(:,:) = zxy * ssdta (:,:,nt_a) + (1. - zxy)*ssdta(:,:,nt_b)
-       tfos(:,:) = zxy * tsdta (:,:,nt_a) + (1. - zxy)*tsdta(:,:,nt_b)
-       ufos(:,:) = zxy * usdta (:,:,nt_a) + (1. - zxy)*usdta(:,:,nt_b)
-       vfos(:,:) = zxy * vsdta (:,:,nt_a) + (1. - zxy)*vsdta(:,:,nt_b)
-    ENDIF
-  END SUBROUTINE obc_dta
-
-
-  SUBROUTINE obc_dta_ini (kt)
-    !!-----------------------------------------------------------------------------
-    !!                       ***  SUBROUTINE obc_dta_ini  ***
-    !!
-    !! ** Purpose :
-    !!      When obc_dta first call, realize some data initialization
-    !!
-    !! ** Method :
-    !!
-    !! History :
-    !!   9.0  ! 07-10 (J.M. Molines )
-    !!----------------------------------------------------------------------------
-    !! * Argument
-    INTEGER, INTENT(in)  :: kt      ! ocean time-step index
-
-    !! * Local declarations
-    INTEGER ::   ji,jj, it   ! dummy loop indices
-
-    REAL(wp) ::   zxy                                    ! time interpolation weight
-
-    INTEGER ::  ikprint                                ! frequency for printouts.
-
-    INTEGER, SAVE :: immfile, iyyfile                     !
-    INTEGER :: nt              !  record indices (incrementation)
-    INTEGER :: istop           ! local error check
-
-    ! variables for the julian day calculation
-    INTEGER :: iyear, imonth, iday
-    REAL(wp) :: zsec , zjulian, zjuliancnes   
-
-    ! IOM STUFF
-    INTEGER ::  idvar, id_e, id_w, id_n, id_s, id_x       ! file identifiers
-    INTEGER, DIMENSION(1)  :: itmp
-    CHARACTER(LEN=25) :: cl_vname
-
-    IF(lwp) WRITE(numout,*)
-    IF(lwp) WRITE(numout,*)  'obc_dta : find boundary data'
-    IF(lwp) WRITE(numout,*)  '~~~~~~~'
-    IF (lwp) THEN
-       IF ( nobc_dta == 0 ) THEN 
-          WRITE(numout,*)  '          OBC data taken from initial conditions.'
-       ELSE      
-          WRITE(numout,*)  '          OBC data taken from netcdf files.'
-       ENDIF
-    ENDIF
-    nday_year0 = nday_year  ! to remember the day when kt=nit000
-
-    sedta(:,:,:) = 0.e0 ; tedta(:,:,:) = 0.e0 ; uedta(:,:,:) = 0.e0 ; vedta(:,:,:) = 0.e0 ! East
-    swdta(:,:,:) = 0.e0 ; twdta(:,:,:) = 0.e0 ; uwdta(:,:,:) = 0.e0 ; vwdta(:,:,:) = 0.e0 ! West
-    sndta(:,:,:) = 0.e0 ; tndta(:,:,:) = 0.e0 ; undta(:,:,:) = 0.e0 ; vndta(:,:,:) = 0.e0 ! North
-    ssdta(:,:,:) = 0.e0 ; tsdta(:,:,:) = 0.e0 ; usdta(:,:,:) = 0.e0 ; vsdta(:,:,:) = 0.e0 ! South
-
-    sfoe(:,:) = 0.e0  ; tfoe(:,:) = 0.e0 ; ufoe(:,:) = 0.e0 ; vfoe(:,:) = 0.e0   ! East
-    sfow(:,:) = 0.e0  ; tfow(:,:) = 0.e0 ; ufow(:,:) = 0.e0 ; vfow(:,:) = 0.e0   ! West
-    sfon(:,:) = 0.e0  ; tfon(:,:) = 0.e0 ; ufon(:,:) = 0.e0 ; vfon(:,:) = 0.e0   ! North
-    sfos(:,:) = 0.e0  ; tfos(:,:) = 0.e0 ; ufos(:,:) = 0.e0 ; vfos(:,:) = 0.e0   ! South
-
-    IF (nobc_dta == 0 ) THEN   ! boundary data are the initial data of this run (set only at nit000)
-       IF (lp_obc_east) THEN  ! East
-          DO ji = nie0 , nie1    
-             sfoe(nje0p1:nje1m1,:) = temsk(nje0p1:nje1m1,:) * sn (ji+1 , nje0p1:nje1m1 , :)
-             tfoe(nje0p1:nje1m1,:) = temsk(nje0p1:nje1m1,:) * tn (ji+1 , nje0p1:nje1m1 , :)
-             ufoe(nje0p1:nje1m1,:) = uemsk(nje0p1:nje1m1,:) * un (ji   , nje0p1:nje1m1 , :)
-             vfoe(nje0p1:nje1m1,:) = vemsk(nje0p1:nje1m1,:) * vn (ji+1 , nje0p1:nje1m1 , :)
-          END DO
-       ENDIF
-
-       IF (lp_obc_west) THEN  ! West
-          DO ji = niw0 , niw1    
-             sfow(njw0p1:njw1m1,:) = twmsk(njw0p1:njw1m1,:) * sn (ji , njw0p1:njw1m1 , :)
-             tfow(njw0p1:njw1m1,:) = twmsk(njw0p1:njw1m1,:) * tn (ji , njw0p1:njw1m1 , :)
-             ufow(njw0p1:njw1m1,:) = uwmsk(njw0p1:njw1m1,:) * un (ji , njw0p1:njw1m1 , :)
-             vfow(njw0p1:njw1m1,:) = vwmsk(njw0p1:njw1m1,:) * vn (ji , njw0p1:njw1m1 , :)
-          END DO
-       ENDIF
-
-       IF (lp_obc_north) THEN ! North
-          DO jj = njn0 , njn1
-             sfon(nin0p1:nin1m1,:) = tnmsk(nin0p1:nin1m1,:) * sn (nin0p1:nin1m1 , jj+1 , :)
-             tfon(nin0p1:nin1m1,:) = tnmsk(nin0p1:nin1m1,:) * tn (nin0p1:nin1m1 , jj+1 , :)
-             ufon(nin0p1:nin1m1,:) = unmsk(nin0p1:nin1m1,:) * un (nin0p1:nin1m1 , jj+1 , :)
-             vfon(nin0p1:nin1m1,:) = vnmsk(nin0p1:nin1m1,:) * vn (nin0p1:nin1m1 , jj   , :)
-          END DO
-       ENDIF
-
-       IF (lp_obc_south) THEN ! South
-          DO jj = njs0 , njs1
-             sfos(nis0p1:nis1m1,:) = tsmsk(nis0p1:nis1m1,:) * sn (nis0p1:nis1m1 , jj , :)
-             tfos(nis0p1:nis1m1,:) = tsmsk(nis0p1:nis1m1,:) * tn (nis0p1:nis1m1 , jj , :)
-             ufos(nis0p1:nis1m1,:) = usmsk(nis0p1:nis1m1,:) * un (nis0p1:nis1m1 , jj , :)
-             vfos(nis0p1:nis1m1,:) = vsmsk(nis0p1:nis1m1,:) * vn (nis0p1:nis1m1 , jj , :)
-          END DO
-       ENDIF
-       RETURN  ! exit the routine all is done
-    ENDIF  ! nobc_dta = 0 
+   SUBROUTINE obc_dta( kt )
+      !!---------------------------------------------------------------------------
+      !!                      ***  SUBROUTINE obc_dta  ***
+      !!                    
+      !! ** Purpose :   Find the climatological  boundary arrays for the specified date, 
+      !!                The boundary arrays are netcdf files. Three possible cases: 
+      !!                - one time frame only in the file (time dimension = 1).
+      !!                in that case the boundary data does not change in time.
+      !!                - many time frames. In that case,  if we have 12 frames
+      !!                we assume monthly fields. 
+      !!                Else, we assume that time_counter is in seconds 
+      !!                since the beginning of either the current year or a reference
+      !!                year given in the namelist.
+      !!                (no check is done so far but one would have to check the "unit"
+      !!                 attribute of variable time_counter).
+      !!
+      !!
+      !! History :
+      !!        !  98-05 (J.M. Molines) Original code
+      !!   8.5  !  02-10 (C. Talandier, A-M. Treguier) Free surface, F90
+      !!
+      !!   9.0  !  04-06 (F. Durand, A-M. Treguier) Netcdf BC files on input
+      !!        !  2007-2008 (C. Langlais, P. Mathiot, J.M. Molines) high frequency boundaries data
+      !!---------------------------------------------------------------------------
+      !! * Arguments
+      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
+
+      !! * Local declarations
+      INTEGER, SAVE :: immfile, iyyfile                     !
+      INTEGER :: nt              !  record indices (incrementation)
+      REAL(wp) ::   zsec, zxy, znum, zden ! time interpolation weight
+
+      !!---------------------------------------------------------------------------
+
+      ! 0.  initialisation :
+      ! --------------------
+      IF ( kt == nit000  )  CALL obc_dta_ini ( kt )
+      IF ( nobc_dta == 0 )  RETURN   ! already done in obc_dta_ini
+      IF ( itobc == 1    )  RETURN   ! case of only one time frame in file done in obc_dta_ini
+
+      ! in the following code, we assume that obc data are read from files, with more than 1 time frame in it
+
+      iyyfile=iyy ; immfile = 00  ! set component of the current file name
+      IF ( cffile /= 'annual') immfile = imm   ! 
+      IF ( ln_obc_clim       ) iyyfile = 0000  ! assume that climatological files are labeled y0000
+
+      ! 1. Synchronize time of run with time of data files
+      !---------------------------------------------------
+      ! nday_year is the day number in the current year ( 1 for 01/01 )
+      zsec=MOD( (kt-nit000)*rdt - (nday_year - nday_year0 )*rday, rday ) ! number of seconds in the current day
+      IF (ln_obc_clim)  THEN 
+         zjcnes = nday_year - 1  + zsec/rday
+      ELSE
+         zjcnes = zjcnes + rdt/rday
+      ENDIF
+
+      ! look for 'before' record number in the current file
+      ntobc = nrecbef ()  ! this function return the record number for 'before', relative to zjcnes
+
+      IF (MOD(kt-1,10)==0) THEN
+         IF (lwp) WRITE(numout,*) 'kt= ',kt,' zjcnes =', zjcnes,' ndastp =',ndastp, 'mm =',imm 
+      END IF
+
+      ! 2. read a new data if necessary 
+      !--------------------------------
+      IF ( ntobc /= ntobc_b ) THEN
+         ! we need to read the 'after' record
+         ! swap working index:
+# if defined key_dynspg_ts
+         nt=nt_m ; nt_m=nt_b ; nt_b=nt
+# endif
+         nt=nt_b ; nt_b=nt_a ; nt_a=nt
+         ntobc_b = ntobc
+
+         ! new record number :
+         ntobc_a = ntobc_a + 1 
+
+         ! all tricky things related to record number, changing files etc... are managed by obc_read
+
+         CALL obc_read (kt, nt_a, ntobc_a, iyyfile, immfile )
+
+         ! update zjcnes_obc
+# if defined key_dynspg_ts
+         ntobc_m=mod(ntobc_b-2+itobc,itobc)+1
+         zjcnes_obc(nt_m)= ztcobc(ntobc_m)
+# endif
+         zjcnes_obc(nt_b)= ztcobc(ntobc_b)
+         zjcnes_obc(nt_a)= ztcobc(ntobc_a)
+      ENDIF
+
+      ! 3.   interpolation at each time step
+      ! ------------------------------------
+      IF( ln_obc_clim) THEN
+         znum= MOD(zjcnes           - zjcnes_obc(nt_b), REAL(nyear_len(1),wp) )
+         IF( znum < 0 ) znum = znum + REAL(nyear_len(1),wp)
+         zden= MOD(zjcnes_obc(nt_a) - zjcnes_obc(nt_b), REAL(nyear_len(1),wp) ) 
+         IF( zden < 0 ) zden = zden + REAL(nyear_len(1),wp)
+      ELSE
+         znum= zjcnes           - zjcnes_obc(nt_b)
+         zden= zjcnes_obc(nt_a) - zjcnes_obc(nt_b)
+      ENDIF
+      zxy = znum / zden
+
+      IF( lp_obc_east ) THEN
+         !  fills sfoe, tfoe, ufoe ,vfoe
+         sfoe(:,:) = zxy * sedta (:,:,nt_a) + (1. - zxy)*sedta(:,:,nt_b)
+         tfoe(:,:) = zxy * tedta (:,:,nt_a) + (1. - zxy)*tedta(:,:,nt_b)
+         ufoe(:,:) = zxy * uedta (:,:,nt_a) + (1. - zxy)*uedta(:,:,nt_b)
+         vfoe(:,:) = zxy * vedta (:,:,nt_a) + (1. - zxy)*vedta(:,:,nt_b)
+      ENDIF
+
+      IF( lp_obc_west) THEN
+         !  fills sfow, tfow, ufow ,vfow
+         sfow(:,:) = zxy * swdta (:,:,nt_a) + (1. - zxy)*swdta(:,:,nt_b)
+         tfow(:,:) = zxy * twdta (:,:,nt_a) + (1. - zxy)*twdta(:,:,nt_b)
+         ufow(:,:) = zxy * uwdta (:,:,nt_a) + (1. - zxy)*uwdta(:,:,nt_b)
+         vfow(:,:) = zxy * vwdta (:,:,nt_a) + (1. - zxy)*vwdta(:,:,nt_b)
+      ENDIF
+
+      IF( lp_obc_north) THEN
+         !  fills sfon, tfon, ufon ,vfon
+         sfon(:,:) = zxy * sndta (:,:,nt_a) + (1. - zxy)*sndta(:,:,nt_b)
+         tfon(:,:) = zxy * tndta (:,:,nt_a) + (1. - zxy)*tndta(:,:,nt_b)
+         ufon(:,:) = zxy * undta (:,:,nt_a) + (1. - zxy)*undta(:,:,nt_b)
+         vfon(:,:) = zxy * vndta (:,:,nt_a) + (1. - zxy)*vndta(:,:,nt_b)
+      ENDIF
+
+      IF( lp_obc_south) THEN
+         !  fills sfos, tfos, ufos ,vfos
+         sfos(:,:) = zxy * ssdta (:,:,nt_a) + (1. - zxy)*ssdta(:,:,nt_b)
+         tfos(:,:) = zxy * tsdta (:,:,nt_a) + (1. - zxy)*tsdta(:,:,nt_b)
+         ufos(:,:) = zxy * usdta (:,:,nt_a) + (1. - zxy)*usdta(:,:,nt_b)
+         vfos(:,:) = zxy * vsdta (:,:,nt_a) + (1. - zxy)*vsdta(:,:,nt_b)
+      ENDIF
+   END SUBROUTINE obc_dta
+
+
+   SUBROUTINE obc_dta_ini (kt)
+      !!-----------------------------------------------------------------------------
+      !!                       ***  SUBROUTINE obc_dta_ini  ***
+      !!
+      !! ** Purpose :
+      !!      When obc_dta first call, realize some data initialization
+      !!
+      !! ** Method :
+      !!
+      !! History :
+      !!   9.0  ! 07-10 (J.M. Molines )
+      !!----------------------------------------------------------------------------
+      !! * Argument
+      INTEGER, INTENT(in)  :: kt      ! ocean time-step index
+
+      !! * Local declarations
+      INTEGER ::   ji, jj   ! dummy loop indices
+      INTEGER, SAVE :: immfile, iyyfile                     !
+
+      ! variables for the julian day calculation
+      INTEGER :: iyear, imonth, iday
+      REAL(wp) :: zsec , zjulian, zjuliancnes   
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*)  'obc_dta : find boundary data'
+      IF(lwp) WRITE(numout,*)  '~~~~~~~'
+      IF (lwp) THEN
+         IF ( nobc_dta == 0 ) THEN 
+            WRITE(numout,*)  '          OBC data taken from initial conditions.'
+         ELSE      
+            WRITE(numout,*)  '          OBC data taken from netcdf files.'
+         ENDIF
+      ENDIF
+      nday_year0 = nday_year  ! to remember the day when kt=nit000
+
+      sedta(:,:,:) = 0.e0 ; tedta(:,:,:) = 0.e0 ; uedta(:,:,:) = 0.e0 ; vedta(:,:,:) = 0.e0 ! East
+      swdta(:,:,:) = 0.e0 ; twdta(:,:,:) = 0.e0 ; uwdta(:,:,:) = 0.e0 ; vwdta(:,:,:) = 0.e0 ! West
+      sndta(:,:,:) = 0.e0 ; tndta(:,:,:) = 0.e0 ; undta(:,:,:) = 0.e0 ; vndta(:,:,:) = 0.e0 ! North
+      ssdta(:,:,:) = 0.e0 ; tsdta(:,:,:) = 0.e0 ; usdta(:,:,:) = 0.e0 ; vsdta(:,:,:) = 0.e0 ! South
+
+      sfoe(:,:) = 0.e0  ; tfoe(:,:) = 0.e0 ; ufoe(:,:) = 0.e0 ; vfoe(:,:) = 0.e0   ! East
+      sfow(:,:) = 0.e0  ; tfow(:,:) = 0.e0 ; ufow(:,:) = 0.e0 ; vfow(:,:) = 0.e0   ! West
+      sfon(:,:) = 0.e0  ; tfon(:,:) = 0.e0 ; ufon(:,:) = 0.e0 ; vfon(:,:) = 0.e0   ! North
+      sfos(:,:) = 0.e0  ; tfos(:,:) = 0.e0 ; ufos(:,:) = 0.e0 ; vfos(:,:) = 0.e0   ! South
+
+      IF (nobc_dta == 0 ) THEN   ! boundary data are the initial data of this run (set only at nit000)
+         IF (lp_obc_east) THEN  ! East
+            DO ji = nie0 , nie1    
+               sfoe(nje0:nje1,:) = temsk(nje0:nje1,:) * sn (ji+1 , nje0:nje1 , :) * tmask(ji+1,nje0:nje1 , :)
+               tfoe(nje0:nje1,:) = temsk(nje0:nje1,:) * tn (ji+1 , nje0:nje1 , :) * tmask(ji+1,nje0:nje1 , :)
+               ufoe(nje0:nje1,:) = uemsk(nje0:nje1,:) * un (ji   , nje0:nje1 , :) * umask(ji,  nje0:nje1 , :)
+               vfoe(nje0:nje1,:) = vemsk(nje0:nje1,:) * vn (ji+1 , nje0:nje1 , :) * vmask(ji+1,nje0:nje1 , :)
+            END DO
+         ENDIF
+
+         IF (lp_obc_west) THEN  ! West
+            DO ji = niw0 , niw1    
+               sfow(njw0:njw1,:) = twmsk(njw0:njw1,:) * sn (ji , njw0:njw1 , :) * tmask(ji , njw0:njw1 , :)
+               tfow(njw0:njw1,:) = twmsk(njw0:njw1,:) * tn (ji , njw0:njw1 , :) * tmask(ji , njw0:njw1 , :)
+               ufow(njw0:njw1,:) = uwmsk(njw0:njw1,:) * un (ji , njw0:njw1 , :) * umask(ji , njw0:njw1 , :)
+               vfow(njw0:njw1,:) = vwmsk(njw0:njw1,:) * vn (ji , njw0:njw1 , :) * vmask(ji , njw0:njw1 , :)
+            END DO
+         ENDIF
+
+         IF (lp_obc_north) THEN ! North
+            DO jj = njn0 , njn1
+               sfon(nin0:nin1,:) = tnmsk(nin0:nin1,:) * sn (nin0:nin1 , jj+1 , :) * tmask(nin0:nin1 , jj+1 , :)
+               tfon(nin0:nin1,:) = tnmsk(nin0:nin1,:) * tn (nin0:nin1 , jj+1 , :) * tmask(nin0:nin1 , jj+1 , :)
+               ufon(nin0:nin1,:) = unmsk(nin0:nin1,:) * un (nin0:nin1 , jj+1 , :) * umask(nin0:nin1 , jj+1 , :)
+               vfon(nin0:nin1,:) = vnmsk(nin0:nin1,:) * vn (nin0:nin1 , jj   , :) * vmask(nin0:nin1 , jj   , :)
+            END DO
+         ENDIF
+
+         IF (lp_obc_south) THEN ! South
+            DO jj = njs0 , njs1
+               sfos(nis0:nis1,:) = tsmsk(nis0:nis1,:) * sn (nis0:nis1 , jj , :) * tmask(nis0:nis1 , jj , :)
+               tfos(nis0:nis1,:) = tsmsk(nis0:nis1,:) * tn (nis0:nis1 , jj , :) * tmask(nis0:nis1 , jj , :)
+               ufos(nis0:nis1,:) = usmsk(nis0:nis1,:) * un (nis0:nis1 , jj , :) * umask(nis0:nis1 , jj , :)
+               vfos(nis0:nis1,:) = vsmsk(nis0:nis1,:) * vn (nis0:nis1 , jj , :) * vmask(nis0:nis1 , jj , :)
+            END DO
+         ENDIF
+         RETURN  ! exit the routine all is done
+      ENDIF  ! nobc_dta = 0 
 
 !!!! In the following OBC data are read from files.
-    ! all logical-mask are initialzed to true when declared
-    WHERE ( temsk == 0 ) ltemsk=.FALSE. 
-    WHERE ( uemsk == 0 ) luemsk=.FALSE. 
-    WHERE ( vemsk == 0 ) lvemsk=.FALSE. 
-
-    WHERE ( twmsk == 0 ) ltwmsk=.FALSE. 
-    WHERE ( uwmsk == 0 ) luwmsk=.FALSE. 
-    WHERE ( vwmsk == 0 ) lvwmsk=.FALSE. 
-
-    WHERE ( tnmsk == 0 ) ltnmsk=.FALSE. 
-    WHERE ( unmsk == 0 ) lunmsk=.FALSE. 
-    WHERE ( vnmsk == 0 ) lvnmsk=.FALSE. 
-
-    WHERE ( tsmsk == 0 ) ltsmsk=.FALSE. 
-    WHERE ( usmsk == 0 ) lusmsk=.FALSE. 
-    WHERE ( vsmsk == 0 ) lvsmsk=.FALSE. 
-
-    iyear=1950;  imonth=01; iday=01;  zsec=0. 
-    ! zjuliancnes : julian day corresonding  to  01/01/1950
-    CALL ymds2ju(iyear, imonth, iday,zsec , zjuliancnes)
-
-    !current year and curent month 
-    iyy=INT(ndastp/10000) ; imm=INT((ndastp -iyy*10000)/100) ; idd=(ndastp-iyy*10000-imm*100)
-    IF (iyy <  1900)  iyy = iyy+1900  ! always assume that years are on 4 digits.
-    CALL ymds2ju(iyy, imm, idd ,zsec , zjulian)
-    ndate0_cnes = zjulian - zjuliancnes   ! jcnes day when call to obc_dta_ini
-
-    iyyfile=iyy ; immfile=0  ! set component of the current file name
-    IF ( cffile /= 'annual') immfile=imm
-    IF ( ln_obc_clim) iyyfile = 0  ! assume that climatological files are labeled y0000
-
-    CALL obc_dta_chktime ( iyyfile, immfile )
-
-    IF ( itobc == 1 ) THEN 
-       ! in this case we will provide boundary data only once.
-       nt_a=1 ; ntobc_a=1
-       CALL obc_read (nit000, nt_a, ntobc_a, iyyfile, immfile) 
-       IF( lp_obc_east ) THEN
-          !  fills sfoe, tfoe, ufoe ,vfoe
-          sfoe(:,:) =  sedta (:,:,1) ; tfoe(:,:) =  tedta (:,:,1)
-          ufoe(:,:) =  uedta (:,:,1) ; vfoe(:,:) =  vedta (:,:,1)
-       ENDIF
-
-       IF( lp_obc_west) THEN
-          !  fills sfow, tfow, ufow ,vfow
-          sfow(:,:) =  swdta (:,:,1) ; tfow(:,:) =  twdta (:,:,1)
-          ufow(:,:) =  uwdta (:,:,1) ; vfow(:,:) =  vwdta (:,:,1)
-       ENDIF
-
-       IF( lp_obc_north) THEN
-          !  fills sfon, tfon, ufon ,vfon
-          sfon(:,:) =  sndta (:,:,1) ; tfon(:,:) =  tndta (:,:,1)
-          ufon(:,:) =  undta (:,:,1) ; vfon(:,:) =  vndta (:,:,1)
-       ENDIF
-
-       IF( lp_obc_south) THEN
-          !  fills sfos, tfos, ufos ,vfos
-          sfos(:,:) =  ssdta (:,:,1) ; tfos(:,:) =  tsdta (:,:,1)
-          ufos(:,:) =  usdta (:,:,1) ; vfos(:,:) =  vsdta (:,:,1)
-       ENDIF
-       RETURN  ! we go out of obc_dta_ini -------------------------------------->>>>>
-    ENDIF
-
-    ! nday_year is the day number in the current year ( 1 for 01/01 )
-    ! we suppose that we always start from the begining of a day
-    !    zsec=MOD( (kt-nit000)*rdt - (nday_year - nday_year0 )*rday, rday ) ! number of seconds in the current day
-    zsec=0.e0  ! here, kt=nit000, nday_year = ndat_year0 
-
-    IF (ln_obc_clim)  THEN 
-      zjcnes = nday_year - 1  + zsec/rday  ! for clim file time is in days in a year
-    ELSE
-      zjcnes = ndate0_cnes + (nday_year - nday_year0 ) + zsec/rday
-    ENDIF
-
-    ! look for 'before' record number in the current file
-    ntobc = nrecbef ()
-
-    IF (lwp) WRITE(numout,*) 'obc files frequency :',cffile
-    IF (lwp) WRITE(numout,*) ' zjcnes0 =',zjcnes,' ndastp0 =',ndastp
-    IF (lwp) WRITE(numout,*) ' annee0 ',iyy,' month0 ', imm,' day0 ', idd
-    IF (lwp) WRITE(numout,*) 'first file open :',cl_obc_nTS
-
-    ! record initialisation
-    !--------------------
-    nt_b = 1 ; nt_a = 2
-
-    ntobc_a = ntobc + 1
-    ntobc_b = ntobc
-
-    CALL obc_read (kt, nt_b, ntobc_b, iyyfile, immfile)  ! read 'before' fields
-    CALL obc_read (kt, nt_a, ntobc_a, iyyfile, immfile)  ! read 'after' fields
-
-    zjcnes_obc(nt_b)= ztcobc(ntobc_b)
-    zjcnes_obc(nt_a)= ztcobc(ntobc_a)
-    ! 
-  END SUBROUTINE obc_dta_ini
-
-
-  SUBROUTINE obc_dta_chktime (kyyfile, kmmfile)
-   !
-   ! check the number of time steps in the files and read ztcobc 
-   !
-   ! * Arguments
-   INTEGER, INTENT(in) :: kyyfile, kmmfile
-   ! * local variables
-   INTEGER :: istop       ! error control
-   INTEGER :: ji          ! dummy loop index
-
-    INTEGER ::  idvar, id_e, id_w, id_n, id_s, id_x       ! file identifiers
-    INTEGER, DIMENSION(1)  :: itmp
-    CHARACTER(LEN=25) :: cl_vname
-
-    ntobc_a = 0; itobce =0 ; itobcw = 0; itobcn = 0; itobcs = 0
-    ! build file name
-    WRITE(cl_obc_eTS ,'("obc_east_TS_y",i4.4,"m",i2.2,".nc")'  ) kyyfile,kmmfile
-    WRITE(cl_obc_wTS ,'("obc_west_TS_y",i4.4,"m",i2.2,".nc")'  ) kyyfile,kmmfile
-    WRITE(cl_obc_nTS ,'("obc_north_TS_y",i4.4,"m",i2.2,".nc")' ) kyyfile,kmmfile
-    WRITE(cl_obc_sTS ,'("obc_south_TS_y",i4.4,"m",i2.2,".nc")' ) kyyfile,kmmfile
-
-    cl_vname = 'time_counter'
-    IF ( lp_obc_east ) THEN
-       CALL iom_open ( cl_obc_eTS , id_e )
-       idvar = iom_varid( id_e, cl_vname, kdimsz = itmp ); itobce=itmp(1)
-    ENDIF
-    IF ( lp_obc_west ) THEN
-       CALL iom_open ( cl_obc_wTS , id_w )
-       idvar = iom_varid( id_w, cl_vname, kdimsz = itmp ) ; itobcw=itmp(1)
-    ENDIF
-    IF ( lp_obc_north ) THEN
-       CALL iom_open ( cl_obc_nTS , id_n )
-       idvar = iom_varid( id_n, cl_vname, kdimsz = itmp ) ; itobcn=itmp(1)
-    ENDIF
-    IF ( lp_obc_south ) THEN
-       CALL iom_open ( cl_obc_sTS , id_s )
-       idvar = iom_varid( id_s, cl_vname, kdimsz = itmp ) ; itobcs=itmp(1)
-    ENDIF
-
-    itobc = MAX( itobce, itobcw, itobcn, itobcs )
-    istop = 0
-    IF ( lp_obc_east  .AND. itobce /= itobc ) istop = istop+1 
-    IF ( lp_obc_west  .AND. itobcw /= itobc ) istop = istop+1      
-    IF ( lp_obc_north .AND. itobcn /= itobc ) istop = istop+1
-    IF ( lp_obc_south .AND. itobcs /= itobc ) istop = istop+1 
-    nstop = nstop + istop
-
-    IF ( istop /=  0 )  THEN
-       WRITE(ctmp1,*) ' east, west, north, south: ', itobce, itobcw, itobcn, itobcs
-       CALL ctl_stop( 'obcdta : all files must have the same number of time steps', ctmp1 )
-    ENDIF
-
-    IF ( itobc == 1 ) THEN 
-       IF (lwp) THEN
-          WRITE(numout,*) ' obcdta found one time step only in the OBC files'
-          IF (ln_obc_clim) THEN
-             ! OK no problem
-          ELSE
-             ln_obc_clim=.true.
-             WRITE(numout,*) ' we force ln_obc_clim to T'
-          ENDIF
-       ENDIF
-    ELSE
-#if defined key_agrif
-       IF ( ASSOCIATED(ztcobc) ) DEALLOCATE ( ztcobc )
-#else
-       IF ( ALLOCATED(ztcobc) ) DEALLOCATE ( ztcobc )
-#endif
-       ALLOCATE (ztcobc(itobc))
-       DO ji=1,1   ! use a dummy loop to read ztcobc only once
-          IF ( lp_obc_east ) THEN
-             CALL iom_gettime ( id_e, ztcobc, cl_vname ) ; CALL iom_close (id_e) ; EXIT
-          ENDIF
-          IF ( lp_obc_west ) THEN
-             CALL iom_gettime ( id_w, ztcobc, cl_vname ) ; CALL iom_close (id_w) ; EXIT
-          ENDIF
-          IF ( lp_obc_north ) THEN
-             CALL iom_gettime ( id_n, ztcobc, cl_vname ) ; CALL iom_close (id_n) ; EXIT
-          ENDIF
-          IF ( lp_obc_south ) THEN
-             CALL iom_gettime ( id_s, ztcobc, cl_vname ) ; CALL iom_close (id_s) ; EXIT
-          ENDIF
-       END DO
-       rdt_obc = ztcobc(2)-ztcobc(1)  !  just an information, not used for any computation
-       IF (lwp) WRITE(numout,*) ' obcdta found', itobc,' time steps in the OBC files'
-       IF (lwp) WRITE(numout,*) ' time step of obc data :', rdt_obc,' days'            
-     ENDIF
-     zjcnes = zjcnes - rdt/rday  ! trick : zcnes is always incremented by rdt/rday in obc_dta!
-  END SUBROUTINE obc_dta_chktime
-
-
-#if defined key_dynspg_ts || defined key_dynspg_exp
-  SUBROUTINE obc_dta_bt( kt, kbt )
-    !!---------------------------------------------------------------------------
-    !!                      ***  SUBROUTINE obc_dta  ***
-    !!
-    !! ** Purpose :   time interpolation of barotropic data for time-splitting scheme
-    !!                Data at the boundary must be in m2/s 
-    !!
-    !! History :
-    !!   9.0  !  05-11 (V. garnier) Original code
-    !!---------------------------------------------------------------------------
-    !! * Arguments
-    INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
-    INTEGER, INTENT( in ) ::   kbt         ! barotropic ocean time-step index
-
-    !! * Local declarations
-    INTEGER ::   ji, jj, jk, ii, ij   ! dummy loop indices
-    INTEGER ::   id_e, id_w, id_n, id_s, fid  ! file identifiers
-    INTEGER ::   itimo, iman, imois, i15
-    INTEGER ::   itobcm, itobcp, itimom, itimop
-    REAL(wp) ::  zxy
-    INTEGER ::   isrel, ikt           ! number of seconds since 1/1/1992
-    INTEGER ::   iprint              ! frequency for printouts.
-
-    !!---------------------------------------------------------------------------
-
-    ! 1.   First call: check time frames available in files.
-    ! -------------------------------------------------------
-
-    IF( kt == nit000 ) THEN
-
-       ! 1.1  Barotropic tangential velocities set to zero
-       ! -------------------------------------------------
-       IF( lp_obc_east  ) vbtfoe(:) = 0.e0
-       IF( lp_obc_west  ) vbtfow(:) = 0.e0
-       IF( lp_obc_south ) ubtfos(:) = 0.e0
-       IF( lp_obc_north ) ubtfon(:) = 0.e0
-
-       ! 1.2  Sea surface height and normal barotropic velocities set to zero
-       !                               or initial conditions if nobc_dta == 0
-       ! --------------------------------------------------------------------
-
-       IF( lp_obc_east ) THEN
-          ! initialisation to zero
-          sshedta(:,:) = 0.e0
-          ubtedta(:,:) = 0.e0
-          !                                        ! ================== !
-          IF( nobc_dta == 0 )   THEN               ! initial state used !
-             !                                     ! ================== !
-             !  Fills sedta, tedta, uedta (global arrays)
-             !  Remark: this works for njzoom = 1. Should the definition of ij include njzoom?
-             DO ji = nie0, nie1
-                DO jj = nje0p1, nje1m1
-                   ij = jj -1 + njmpp
-                   sshedta(ij,1) = sshn(ji+1,jj) * tmask(ji+1,jj,1)
-                END DO
-             END DO
-          ENDIF
-       ENDIF
-
-       IF( lp_obc_west) THEN
-          ! initialisation to zero
-          sshwdta(:,:) = 0.e0
-          ubtwdta(:,:) = 0.e0
-          !                                        ! ================== !
-          IF( nobc_dta == 0 )   THEN               ! initial state used !
-             !                                     ! ================== !
-             !  Fills swdta, twdta, uwdta (global arrays)
-             !  Remark: this works for njzoom = 1. Should the definition of ij include njzoom?
-             DO ji = niw0, niw1
-                DO jj = njw0p1, njw1m1
-                   ij = jj -1 + njmpp
-                   sshwdta(ij,1) = sshn(ji,jj) * tmask(ji,jj,1)
-                END DO
-             END DO
-          ENDIF
-       ENDIF
-
-       IF( lp_obc_north) THEN
-          ! initialisation to zero
-          sshndta(:,:) = 0.e0
-          vbtndta(:,:) = 0.e0
-          !                                        ! ================== !
-          IF( nobc_dta == 0 )   THEN               ! initial state used !
-             !                                     ! ================== !
-             !  Fills sndta, tndta, vndta (global arrays)
-             !  Remark: this works for njzoom = 1. Should the definition of ij include njzoom?
-             DO jj = njn0, njn1
-                DO ji = nin0p1, nin1m1
-                   DO jk = 1, jpkm1
-                      ii = ji -1 + nimpp
-                      vbtndta(ii,1) = vbtndta(ii,1) + vndta(ii,jk,1)*fse3v(ji,jj,jk)
-                   END DO
-                   sshndta(ii,1) = sshn(ii,jj+1) * tmask(ji,jj+1,1)
-                END DO
-             END DO
-          ENDIF
-       ENDIF
-
-       IF( lp_obc_south) THEN
-          ! initialisation to zero
-          ssdta(:,:,:) = 0.e0
-          tsdta(:,:,:) = 0.e0
-          vsdta(:,:,:) = 0.e0
-          sshsdta(:,:) = 0.e0
-          vbtsdta(:,:) = 0.e0
-          !                                        ! ================== !
-          IF( nobc_dta == 0 )   THEN               ! initial state used !
-             !                                     ! ================== !
-             !  Fills ssdta, tsdta, vsdta (global arrays)
-             !  Remark: this works for njzoom = 1. Should the definition of ij include njzoom?
-             DO jj = njs0, njs1
-                DO ji = nis0p1, nis1m1
-                   DO jk = 1, jpkm1
-                      ii = ji -1 + nimpp
-                      vbtsdta(ii,1) = vbtsdta(ii,1) + vsdta(ii,jk,1)*fse3v(ji,jj,jk)
-                   END DO
-                   sshsdta(ii,1) = sshn(ji,jj) * tmask(ii,jj,1)
-                END DO
-             END DO
-          ENDIF
-       ENDIF
-
-    ENDIF        !       END IF kt == nit000
-
-    !!------------------------------------------------------------------------------------
-    ! 2.      Initialize the time we are at. Does this every time the routine is called,
-    !         excepted when nobc_dta = 0
-    !
-    IF( nobc_dta == 0) THEN
-       itimo = 1
-       zxy   = 0
-    ELSE
-       IF(ntobc == 1) THEN
-          itimo = 1
-       ELSE IF (ntobc == 12) THEN      !   BC are monthly
-          ! we assume we have climatology in that case
-          iman  = 12
-          i15   = nday / 16
-          imois = nmonth + i15 - 1
-          IF( imois == 0 )   imois = iman
-          itimo = imois
-       ELSE
-          IF(lwp) WRITE(numout,*) 'data other than constant or monthly',kt
-          iman  = ntobc
-          itimo = FLOOR( kt*rdt / tcobc(1))
-          isrel=kt*rdt
-       ENDIF
-    ENDIF
-
-    ! 2. Read two records in the file if necessary
-    ! ---------------------------------------------
-
-    IF( nobc_dta == 1 .AND. nlecto == 1 ) THEN
-
-       IF( lp_obc_east ) THEN
-          ! ... Read datafile and set sea surface height and barotropic velocity
-          ! ... initialise the sshedta, ubtedta arrays
-          sshedta(:,0) = sshedta(:,1)
-          ubtedta(:,0) = ubtedta(:,1)
-          CALL iom_open ( 'obceast_TS.nc', id_e )
-          CALL iom_get ( id_e, jpdom_unknown, 'vossurfh', sshedta(:,1), ktime=ntobc1 )
-          CALL iom_get ( id_e, jpdom_unknown, 'vossurfh', sshedta(:,2), ktime=ntobc2 )
-          IF( lk_dynspg_ts ) THEN
-             CALL iom_get (id_e, jpdom_unknown, 'vossurfh', sshedta(:,3), ktime=ntobc2+1 )
-          ENDIF
-          CALL iom_close ( id_e )
-          !
-          CALL iom_open ( 'obceast_U.nc', id_e )
-          CALL iom_get ( id_e, jpdom_unknown, 'vozoubt', ubtedta(:,1), ktime=ntobc1 )
-          CALL iom_get ( id_e, jpdom_unknown, 'vozoubt', ubtedta(:,2), ktime=ntobc2 )
-          IF( lk_dynspg_ts ) THEN
-             CALL iom_get ( id_e, jpdom_unknown, 'vozoubt', ubtedta(:,3), ktime=ntobc2+1 )
-          ENDIF
-          CALL iom_close ( id_e )
-          ! ... Usually printout is done only once at kt = nit000, unless nprint (namelist) > 1
-          IF( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
-             WRITE(numout,*)
-             WRITE(numout,*) ' Read East OBC barotropic data records ', ntobc1, ntobc2
-             iprint = (jpjef-jpjed+1)/20 +1
-             WRITE(numout,*)
-             WRITE(numout,*) ' Sea surface height record 1'
-             CALL prihre( sshedta(:,1), jpjef-jpjed+1, 1, 1, jpjef-jpjed+1, iprint, 1, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Normal transport (m2/s) record 1',iprint
-             CALL prihre( ubtedta(:,1), jpjef-jpjed+1, 1, 1, jpjef-jpjed+1, iprint, 1, 1, -3, 1., numout )
-          ENDIF
-       ENDIF
-
-       IF( lp_obc_west ) THEN
-          ! ... Read datafile and set temperature, salinity and normal velocity
-          ! ... initialise the swdta, twdta, uwdta arrays
-          sshwdta(:,0) = sshwdta(:,1)
-          ubtwdta(:,0) = ubtwdta(:,1)
-          CALL iom_open ( 'obcwest_TS.nc', id_w )
-          CALL iom_get ( id_w, jpdom_unknown, 'vossurfh', sshwdta(:,1), ktime=ntobc1 )
-          CALL iom_get ( id_w, jpdom_unknown, 'vossurfh', sshwdta(:,2), ktime=ntobc2 )
-          IF( lk_dynspg_ts ) THEN
-             CALL  ( id_w, jpdom_unknown, 'vossurfh', sshwdta(:,3), ktime=ntobc2+1 )
-          ENDIF
-          CALL iom_close ( id_w )
-          !
-          CALL iom_open ( 'obcwest_U.nc', id_w )
-          CALL iom_get ( id_w, jpdom_unknown, 'vozoubt', ubtwdta(:,1), ktime=ntobc1 )
-          CALL iom_get ( id_w, jpdom_unknown, 'vozoubt', ubtwdta(:,2), ktime=ntobc2 )
-          IF( lk_dynspg_ts ) THEN
-             CALL iom_get ( id_w, jpdom_unknown, 'vozoubt', ubtwdta(:,3), ktime=ntobc2+1 )
-          ENDIF
-          CALL iom_close ( id_w )
-          ! ... Usually printout is done only once at kt = nit000, unless nprint (namelist) > 1
-          IF( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
-             WRITE(numout,*)
-             WRITE(numout,*) ' Read West OBC barotropic data records ', ntobc1, ntobc2
-             iprint = (jpjwf-jpjwd+1)/20 +1
-             WRITE(numout,*)
-             WRITE(numout,*) ' Sea surface height record 1  - printout surface level'
-             CALL prihre( sshwdta(:,1), jpjwf-jpjwd+1, 1, 1, jpjwf-jpjwd+1, iprint, 1, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Normal transport (m2/s) record 1'
-             CALL prihre( ubtwdta(:,1), jpjwf-jpjwd+1, 1, 1, jpjwf-jpjwd+1, iprint, 1, 1, -3, 1., numout )
-          ENDIF
-       ENDIF
-
-       IF( lp_obc_north) THEN
-          ! ... Read datafile and set sea surface height and barotropic velocity
-          ! ... initialise the sshndta, ubtndta arrays
-          sshndta(:,0) = sshndta(:,1)
-          vbtndta(:,0) = vbtndta(:,1)
-          CALL iom_open ( 'obcnorth_TS.nc', id_n )
-          CALL iom_get (id_n, jpdom_unknown, 'vossurfh', sshndta(:,1), ktime=ntobc1 )
-          CALL iom_get (id_n, jpdom_unknown, 'vossurfh', sshndta(:,2), ktime=ntobc2 )
-          IF( lk_dynspg_ts ) THEN
-             CALL iom_get (id_n, jpdom_unknown, 'vossurfh', sshndta(:,3), ktime=ntobc2+1 )
-          ENDIF
-          CALL iom_close ( id_n )
-
-          CALL iom_open ( 'obcnorth_V.nc', id_n )
-          CALL iom_get (id_n, jpdom_unknown, 'vomevbt', vbtndta(:,1), ktime=ntobc1 )
-          CALL iom_get (id_n, jpdom_unknown, 'vomevbt', vbtndta(:,2), ktime=ntobc2 )
-          IF( lk_dynspg_ts ) THEN
-             CALL iom_get (id_n, jpdom_unknown, 'vomevbt', vbtndta(:,3), ktime=ntobc2+1 )
-          ENDIF
-          CALL iom_close ( id_n )
-
-          ! ... Usually printout is done only once at kt = nit000, unless nprint (namelist) > 1
-          IF( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
-             WRITE(numout,*)
-             WRITE(numout,*) ' Read North OBC barotropic data records ', ntobc1, ntobc2
-             iprint = (jpinf-jpind+1)/20 +1
-             WRITE(numout,*)
-             WRITE(numout,*) ' Sea surface height record 1  - printout surface level'
-             CALL prihre( sshndta(:,1), jpinf-jpind+1, 1, 1, jpinf-jpind+1, iprint, 1, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Normal transport (m2/s) record 1'
-             CALL prihre( vbtndta(:,1), jpinf-jpind+1, 1, 1, jpinf-jpind+1, iprint, 1, 1, -3, 1., numout )
-          ENDIF
-       ENDIF
-
-       IF( lp_obc_south) THEN
-          ! ... Read datafile and set sea surface height and barotropic velocity
-          ! ... initialise the sshsdta, ubtsdta arrays
-          sshsdta(:,0) = sshsdta(:,1)
-          vbtsdta(:,0) = vbtsdta(:,1)
-          CALL iom_open ( 'obcsouth_TS.nc', id_s )
-          CALL iom_get ( id_s, jpdom_unknown, 'vossurfh', sshsdta(:,1), ktime=ntobc1 )
-          CALL iom_get ( id_s, jpdom_unknown, 'vossurfh', sshsdta(:,2), ktime=ntobc2 )
-          IF( lk_dynspg_ts ) THEN
-             CALL iom_get ( id_s, jpdom_unknown, 'vossurfh', sshsdta(:,3), ktime=ntobc2+1 )
-          ENDIF
-          CALL iom_close ( id_s )
-
-          CALL iom_open ( 'obcsouth_V.nc', id_s )
-          CALL iom_get ( id_s, jpdom_unknown, 'vomevbt', vbtsdta(:,1), ktime=ntobc1 )
-          CALL iom_get ( id_s, jpdom_unknown, 'vomevbt', vbtsdta(:,2), ktime=ntobc2 )
-          IF( lk_dynspg_ts ) THEN
-             CALL iom_get ( id_s, jpdom_unknown, 'vomevbt', vbtsdta(:,3), ktime=ntobc2+1 )
-          ENDIF
-          CALL iom_close ( id_s )
-
-          ! ... Usually printout is done only once at kt = nit000, unless nprint (namelist) > 1
-          IF( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
-             WRITE(numout,*)
-             WRITE(numout,*) ' Read South OBC barotropic data records ', ntobc1, ntobc2
-             iprint = (jpisf-jpisd+1)/20 +1
-             WRITE(numout,*)
-             WRITE(numout,*) ' Sea surface height record 1  - printout surface level'
-             CALL prihre( sshsdta(:,1), jpisf-jpisd+1, 1, 1, jpisf-jpisd+1, iprint, 1, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Normal transport (m2/s) record 1'
-             CALL prihre( vbtsdta(:,1), jpisf-jpisd+1, 1, 1, jpisf-jpisd+1, iprint, 1, 1, -3, 1., numout )
-          ENDIF
-       ENDIF
-
-    ENDIF        !      end of the test on the condition to read or not the files
-
-    ! 3.  Call at every time step : Linear interpolation of BCs to current time step
-    ! ----------------------------------------------------------------------
-
-    IF( lk_dynspg_ts ) THEN
-       isrel = (kt-1)*rdt + kbt*(rdt/REAL(nn_baro,wp))
-
-       IF( nobc_dta == 1 ) THEN
-          isrel = (kt-1)*rdt + kbt*(rdt/REAL(nn_baro,wp))
-          itimo  = FLOOR(  kt*rdt    / (tcobc(2)-tcobc(1)) )
-          itimom = FLOOR( (kt-1)*rdt / (tcobc(2)-tcobc(1)) )
-          itimop = FLOOR( (kt+1)*rdt / (tcobc(2)-tcobc(1)) )
-          IF( itimom == itimo .AND. itimop == itimo ) THEN
-             itobcm = ntobc1
-             itobcp = ntobc2
-
-          ELSEIF ( itimom <= itimo .AND. itimop == itimo ) THEN
-             IF(  FLOOR( isrel / (tcobc(2)-tcobc(1)) ) < itimo ) THEN
-                itobcm = ntobc1-1
-                itobcp = ntobc2-1
-             ELSE
-                itobcm = ntobc1
-                itobcp = ntobc2
-             ENDIF
-
-          ELSEIF ( itimom == itimo .AND. itimop >= itimo ) THEN
-             IF(  FLOOR( isrel / (tcobc(2)-tcobc(1)) ) < itimop ) THEN
-                itobcm = ntobc1
-                itobcp = ntobc2
-             ELSE
-                itobcm = ntobc1+1
-                itobcp = ntobc2+1
-             ENDIF
-
-          ELSEIF ( itimom == itimo-1 .AND. itimop == itimo+1 ) THEN
-             IF(  FLOOR( isrel / (tcobc(2)-tcobc(1)) ) < itimo ) THEN
-                itobcm = ntobc1-1
-                itobcp = ntobc2-1
-             ELSEIF (  FLOOR( isrel / (tcobc(2)-tcobc(1)) ) < itimop ) THEN
-                itobcm = ntobc1
-                itobcp = ntobc2
-             ELSEIF (  FLOOR( isrel / (tcobc(2)-tcobc(1)) ) == itimop ) THEN
-                itobcm = ntobc1+1
-                itobcp = ntobc2+2
-             ELSE
-                IF(lwp) WRITE(numout, *) 'obc_dta_bt: You should not have seen this print! error 1?'
-             ENDIF
-          ELSE
-             IF(lwp) WRITE(numout, *) 'obc_dta_bt: You should not have seen this print! error 2?'
-          ENDIF
-
-       ENDIF
-
-    ELSE IF( lk_dynspg_exp ) THEN
-       isrel=kt*rdt
-       itobcm = ntobc1
-       itobcp = ntobc2
-    ENDIF
-
-    IF( ntobc == 1 .OR. nobc_dta == 0 ) THEN
-       zxy = 0.e0
-    ELSE IF( ntobc == 12 ) THEN
-       zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
-    ELSE
-       zxy = (tcobc(itobcm)-FLOAT(isrel)) / (tcobc(itobcm)-tcobc(itobcp))
-    ENDIF
-
-    IF( lp_obc_east ) THEN           !  fills sshfoe, ubtfoe (local to each processor)
-       DO jj = nje0p1, nje1m1
-          ij = jj -1 + njmpp
-          sshfoe(jj) = ( zxy * sshedta(ij,2) + (1.-zxy) * sshedta(ij,1) ) * temsk(jj,1)
-          ubtfoe(jj) = ( zxy * ubtedta(ij,2) + (1.-zxy) * ubtedta(ij,1) ) * uemsk(jj,1)
-       END DO
-    ENDIF
-
-    IF( lp_obc_west) THEN            !  fills sshfow, ubtfow (local to each processor)
-       DO jj = njw0p1, njw1m1
-          ij = jj -1 + njmpp
-          sshfow(jj) = ( zxy * sshwdta(ij,2) + (1.-zxy) * sshwdta(ij,1) ) * twmsk(jj,1)
-          ubtfow(jj) = ( zxy * ubtwdta(ij,2) + (1.-zxy) * ubtwdta(ij,1) ) * uwmsk(jj,1)
-       END DO
-    ENDIF
-
-    IF( lp_obc_north) THEN           !  fills sshfon, vbtfon (local to each processor)
-       DO ji = nin0p1, nin1m1
-          ii = ji -1 + nimpp
-          sshfon(ji) = ( zxy * sshndta(ii,2) + (1.-zxy) * sshndta(ii,1) ) * tnmsk(ji,1)
-          vbtfon(ji) = ( zxy * vbtndta(ii,2) + (1.-zxy) * vbtndta(ii,1) ) * vnmsk(ji,1)
-       END DO
-    ENDIF
-
-    IF( lp_obc_south) THEN           !  fills sshfos, vbtfos (local to each processor)
-       DO ji = nis0p1, nis1m1
-          ii = ji -1 + nimpp
-          sshfos(ji) = ( zxy * sshsdta(ii,2) + (1.-zxy) * sshsdta(ii,1) ) * tsmsk(ji,1)
-          vbtfos(ji) = ( zxy * vbtsdta(ii,2) + (1.-zxy) * vbtsdta(ii,1) ) * vsmsk(ji,1)
-       END DO
-    ENDIF
-
-  END SUBROUTINE obc_dta_bt
-
-#else
-  !!-----------------------------------------------------------------------------
-  !!   Default option
-  !!-----------------------------------------------------------------------------
-  SUBROUTINE obc_dta_bt ( kt, kbt )       ! Empty routine
-    !! * Arguments
-    INTEGER,INTENT(in) :: kt
-    INTEGER, INTENT( in ) ::   kbt         ! barotropic ocean time-step index
-    WRITE(*,*) 'obc_dta_bt: You should not have seen this print! error?', kt
-    WRITE(*,*) 'obc_dta_bt: You should not have seen this print! error?', kbt
-  END SUBROUTINE obc_dta_bt
-#endif
-
-
-  !!==============================================================================
-  SUBROUTINE obc_read (kt, nt_x, ntobc_x, iyy, imm)
-     !!-------------------------------------------------------------------------
-     !!                      ***  ROUTINE obc_read  ***
-     !!
-     !! ** Purpose :  Read the boundary data in files identified by iyy and imm
-     !!               According to the validated open boundaries, return the 
-     !!               following arrays :
-     !!                sedta, tedta : East OBC salinity and temperature
-     !!                uedta, vedta :   "   "  u and v velocity component      
-     !!
-     !!                swdta, twdta : West OBC salinity and temperature
-     !!                uwdta, vwdta :   "   "  u and v velocity component      
-     !!
-     !!                sndta, tndta : North OBC salinity and temperature
-     !!                undta, vndta :   "   "  u and v velocity component      
-     !!
-     !!                ssdta, tsdta : South OBC salinity and temperature
-     !!                usdta, vsdta :   "   "  u and v velocity component      
-     !!
-     !! ** Method  :  These fields are read in the record ntobc_x of the files.
-     !!               The number of records is already known. If  ntobc_x is greater
-     !!               than the number of record, this routine will look for next file,
-     !!               updating the indices (case of inter-annual obcs) or loop at the
-     !!               begining in case of climatological file (ln_obc_clim = true ).
-     !! -------------------------------------------------------------------------
-     !! History:     !  2005  ( P. Mathiot, C. Langlais ) Original code
-     !!              !  2008  ( J,M, Molines ) Use IOM and cleaning
-     !!--------------------------------------------------------------------------
-
-    ! * Arguments
-    INTEGER, INTENT( in ) :: kt, nt_x
-    INTEGER, INTENT( inout ) :: ntobc_x , iyy, imm      ! yes ! inout !
-
-    ! * Local variables
-    CHARACTER (len=40) :: &    ! file names
+      ! all logical-mask are initialzed to true when declared
+      WHERE ( temsk == 0 ) ltemsk=.FALSE. 
+      WHERE ( uemsk == 0 ) luemsk=.FALSE. 
+      WHERE ( vemsk == 0 ) lvemsk=.FALSE. 
+
+      WHERE ( twmsk == 0 ) ltwmsk=.FALSE. 
+      WHERE ( uwmsk == 0 ) luwmsk=.FALSE. 
+      WHERE ( vwmsk == 0 ) lvwmsk=.FALSE. 
+
+      WHERE ( tnmsk == 0 ) ltnmsk=.FALSE. 
+      WHERE ( unmsk == 0 ) lunmsk=.FALSE. 
+      WHERE ( vnmsk == 0 ) lvnmsk=.FALSE. 
+
+      WHERE ( tsmsk == 0 ) ltsmsk=.FALSE. 
+      WHERE ( usmsk == 0 ) lusmsk=.FALSE. 
+      WHERE ( vsmsk == 0 ) lvsmsk=.FALSE. 
+
+      iyear=1950;  imonth=01; iday=01;  zsec=0. 
+      ! zjuliancnes : julian day corresonding  to  01/01/1950
+      CALL ymds2ju(iyear, imonth, iday,zsec , zjuliancnes)
+
+      !current year and curent month 
+      iyy=INT(ndastp/10000) ; imm=INT((ndastp -iyy*10000)/100) ; idd=(ndastp-iyy*10000-imm*100)
+      IF (iyy <  1900)  iyy = iyy+1900  ! always assume that years are on 4 digits.
+      CALL ymds2ju(iyy, imm, idd ,zsec , zjulian)
+      ndate0_cnes = zjulian - zjuliancnes   ! jcnes day when call to obc_dta_ini
+
+      iyyfile=iyy ; immfile=0  ! set component of the current file name
+      IF ( cffile /= 'annual') immfile=imm
+      IF ( ln_obc_clim) iyyfile = 0  ! assume that climatological files are labeled y0000
+
+      CALL obc_dta_chktime ( iyyfile, immfile )
+
+      IF ( itobc == 1 ) THEN 
+         ! in this case we will provide boundary data only once.
+         nt_a=1 ; ntobc_a=1
+         CALL obc_read (nit000, nt_a, ntobc_a, iyyfile, immfile) 
+         IF( lp_obc_east ) THEN
+            !  fills sfoe, tfoe, ufoe ,vfoe
+            sfoe(:,:) =  sedta (:,:,1) ; tfoe(:,:) =  tedta (:,:,1)
+            ufoe(:,:) =  uedta (:,:,1) ; vfoe(:,:) =  vedta (:,:,1)
+         ENDIF
+
+         IF( lp_obc_west) THEN
+            !  fills sfow, tfow, ufow ,vfow
+            sfow(:,:) =  swdta (:,:,1) ; tfow(:,:) =  twdta (:,:,1)
+            ufow(:,:) =  uwdta (:,:,1) ; vfow(:,:) =  vwdta (:,:,1)
+         ENDIF
+
+         IF( lp_obc_north) THEN
+            !  fills sfon, tfon, ufon ,vfon
+            sfon(:,:) =  sndta (:,:,1) ; tfon(:,:) =  tndta (:,:,1)
+            ufon(:,:) =  undta (:,:,1) ; vfon(:,:) =  vndta (:,:,1)
+         ENDIF
+
+         IF( lp_obc_south) THEN
+            !  fills sfos, tfos, ufos ,vfos
+            sfos(:,:) =  ssdta (:,:,1) ; tfos(:,:) =  tsdta (:,:,1)
+            ufos(:,:) =  usdta (:,:,1) ; vfos(:,:) =  vsdta (:,:,1)
+         ENDIF
+         RETURN  ! we go out of obc_dta_ini -------------------------------------->>>>>
+      ENDIF
+
+      ! nday_year is the day number in the current year ( 1 for 01/01 )
+      ! we suppose that we always start from the begining of a day
+      !    zsec=MOD( (kt-nit000)*rdt - (nday_year - nday_year0 )*rday, rday ) ! number of seconds in the current day
+      zsec=0.e0  ! here, kt=nit000, nday_year = ndat_year0 
+
+      IF (ln_obc_clim)  THEN 
+         zjcnes = nday_year - 1  + zsec/rday  ! for clim file time is in days in a year
+      ELSE
+         zjcnes = ndate0_cnes + (nday_year - nday_year0 ) + zsec/rday
+      ENDIF
+
+      ! look for 'before' record number in the current file
+      ntobc = nrecbef ()
+
+      IF (lwp) WRITE(numout,*) 'obc files frequency :',cffile
+      IF (lwp) WRITE(numout,*) ' zjcnes0 =',zjcnes,' ndastp0 =',ndastp
+      IF (lwp) WRITE(numout,*) ' annee0 ',iyy,' month0 ', imm,' day0 ', idd
+      IF (lwp) WRITE(numout,*) 'first file open :',cl_obc_nTS
+
+      ! record initialisation
+      !--------------------
+      nt_b = 1 ; nt_a = 2
+
+      ntobc_a = ntobc + 1
+      ntobc_b = ntobc
+
+      CALL obc_read (kt, nt_b, ntobc_b, iyyfile, immfile)  ! read 'before' fields
+      CALL obc_read (kt, nt_a, ntobc_a, iyyfile, immfile)  ! read 'after' fields
+
+      ! additional frame in case of time-splitting
+# if defined key_dynspg_ts
+      nt_m = 0
+      ntobc_m=mod(ntobc_b-2+itobc,itobc)+1
+      zjcnes_obc(nt_m)= ztcobc(ntobc_m) ! FDbug has not checked that this is correct!!
+      IF (ln_rstart) THEN
+         CALL obc_read (kt, nt_m, ntobc_m, iyyfile, immfile)  ! read 'after' fields
+      ENDIF
+# endif
+
+      zjcnes_obc(nt_b)= ztcobc(ntobc_b)
+      zjcnes_obc(nt_a)= ztcobc(ntobc_a)
+      ! 
+   END SUBROUTINE obc_dta_ini
+
+
+   SUBROUTINE obc_dta_chktime (kyyfile, kmmfile)
+      !
+      ! check the number of time steps in the files and read ztcobc 
+      !
+      ! * Arguments
+      INTEGER, INTENT(in) :: kyyfile, kmmfile
+      ! * local variables
+      INTEGER :: istop       ! error control
+      INTEGER :: ji          ! dummy loop index
+
+      INTEGER ::  idvar, id_e, id_w, id_n, id_s       ! file identifiers
+      INTEGER, DIMENSION(1)  :: itmp
+      CHARACTER(LEN=25) :: cl_vname
+
+      ntobc_a = 0; itobce =0 ; itobcw = 0; itobcn = 0; itobcs = 0
+      ! build file name
+      IF(ln_obc_clim) THEN   ! revert to old convention for climatological OBC forcing
+         cl_obc_eTS='obceast_TS.nc'
+         cl_obc_wTS='obcwest_TS.nc'
+         cl_obc_nTS='obcnorth_TS.nc'
+         cl_obc_sTS='obcsouth_TS.nc'
+      ELSE                   ! convention for climatological OBC
+         WRITE(cl_obc_eTS ,'("obc_east_TS_y",i4.4,"m",i2.2,".nc")'  ) kyyfile,kmmfile
+         WRITE(cl_obc_wTS ,'("obc_west_TS_y",i4.4,"m",i2.2,".nc")'  ) kyyfile,kmmfile
+         WRITE(cl_obc_nTS ,'("obc_north_TS_y",i4.4,"m",i2.2,".nc")' ) kyyfile,kmmfile
+         WRITE(cl_obc_sTS ,'("obc_south_TS_y",i4.4,"m",i2.2,".nc")' ) kyyfile,kmmfile
+      ENDIF
+
+      cl_vname = 'time_counter'
+      IF ( lp_obc_east ) THEN
+         CALL iom_open ( cl_obc_eTS , id_e )
+         idvar = iom_varid( id_e, cl_vname, kdimsz = itmp ); itobce=itmp(1)
+      ENDIF
+      IF ( lp_obc_west ) THEN
+         CALL iom_open ( cl_obc_wTS , id_w )
+         idvar = iom_varid( id_w, cl_vname, kdimsz = itmp ) ; itobcw=itmp(1)
+      ENDIF
+      IF ( lp_obc_north ) THEN
+         CALL iom_open ( cl_obc_nTS , id_n )
+         idvar = iom_varid( id_n, cl_vname, kdimsz = itmp ) ; itobcn=itmp(1)
+      ENDIF
+      IF ( lp_obc_south ) THEN
+         CALL iom_open ( cl_obc_sTS , id_s )
+         idvar = iom_varid( id_s, cl_vname, kdimsz = itmp ) ; itobcs=itmp(1)
+      ENDIF
+
+      itobc = MAX( itobce, itobcw, itobcn, itobcs )
+      istop = 0
+      IF ( lp_obc_east  .AND. itobce /= itobc ) istop = istop+1 
+      IF ( lp_obc_west  .AND. itobcw /= itobc ) istop = istop+1      
+      IF ( lp_obc_north .AND. itobcn /= itobc ) istop = istop+1
+      IF ( lp_obc_south .AND. itobcs /= itobc ) istop = istop+1 
+      nstop = nstop + istop
+
+      IF ( istop /=  0 )  THEN
+         WRITE(ctmp1,*) ' east, west, north, south: ', itobce, itobcw, itobcn, itobcs
+         CALL ctl_stop( 'obcdta : all files must have the same number of time steps', ctmp1 )
+      ENDIF
+
+      IF ( itobc == 1 ) THEN 
+         IF (lwp) THEN
+            WRITE(numout,*) ' obcdta found one time step only in the OBC files'
+            IF (ln_obc_clim) THEN
+               ! OK no problem
+            ELSE
+               ln_obc_clim=.true.
+               WRITE(numout,*) ' we force ln_obc_clim to T'
+            ENDIF
+         ENDIF
+      ELSE
+         IF ( ALLOCATED(ztcobc) ) DEALLOCATE ( ztcobc )
+         ALLOCATE (ztcobc(itobc))
+         DO ji=1,1   ! use a dummy loop to read ztcobc only once
+            IF ( lp_obc_east ) THEN
+               CALL iom_gettime ( id_e, ztcobc, cl_vname ) ; CALL iom_close (id_e) ; EXIT
+            ENDIF
+            IF ( lp_obc_west ) THEN
+               CALL iom_gettime ( id_w, ztcobc, cl_vname ) ; CALL iom_close (id_w) ; EXIT
+            ENDIF
+            IF ( lp_obc_north ) THEN
+               CALL iom_gettime ( id_n, ztcobc, cl_vname ) ; CALL iom_close (id_n) ; EXIT
+            ENDIF
+            IF ( lp_obc_south ) THEN
+               CALL iom_gettime ( id_s, ztcobc, cl_vname ) ; CALL iom_close (id_s) ; EXIT
+            ENDIF
+         END DO
+         rdt_obc = ztcobc(2)-ztcobc(1)  !  just an information, not used for any computation
+         IF (lwp) WRITE(numout,*) ' obcdta found', itobc,' time steps in the OBC files'
+         IF (lwp) WRITE(numout,*) ' time step of obc data :', rdt_obc,' days'            
+      ENDIF
+      zjcnes = zjcnes - rdt/rday  ! trick : zcnes is always incremented by rdt/rday in obc_dta!
+   END SUBROUTINE obc_dta_chktime
+
+# if defined key_dynspg_ts || defined key_dynspg_exp
+   SUBROUTINE obc_dta_bt( kt, kbt )
+      !!---------------------------------------------------------------------------
+      !!                      ***  SUBROUTINE obc_dta  ***
+      !!
+      !! ** Purpose :   time interpolation of barotropic data for time-splitting scheme
+      !!                Data at the boundary must be in m2/s 
+      !!
+      !! History :
+      !!   9.0  !  05-11 (V. garnier) Original code
+      !!---------------------------------------------------------------------------
+      !! * Arguments
+      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
+      INTEGER, INTENT( in ) ::   kbt         ! barotropic ocean time-step index
+
+      !! * Local declarations
+      INTEGER ::   ji, jj  ! dummy loop indices
+      INTEGER ::   i15
+      INTEGER ::   itobcm, itobcp
+      REAL(wp) ::  zxy
+      INTEGER ::   isrel           ! number of seconds since 1/1/1992
+
+      !!---------------------------------------------------------------------------
+
+      ! 1.   First call: check time frames available in files.
+      ! -------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+
+         ! 1.1  Barotropic tangential velocities set to zero
+         ! -------------------------------------------------
+         IF( lp_obc_east  ) vbtfoe(:) = 0.e0
+         IF( lp_obc_west  ) vbtfow(:) = 0.e0
+         IF( lp_obc_south ) ubtfos(:) = 0.e0
+         IF( lp_obc_north ) ubtfon(:) = 0.e0
+
+         ! 1.2  Sea surface height and normal barotropic velocities set to zero
+         !                               or initial conditions if nobc_dta == 0
+         ! --------------------------------------------------------------------
+
+         IF( lp_obc_east ) THEN
+            ! initialisation to zero
+            sshedta(:,:) = 0.e0
+            ubtedta(:,:) = 0.e0
+            vbtedta(:,:) = 0.e0 ! tangential component
+            !                                        ! ================== !
+            IF( nobc_dta == 0 )   THEN               ! initial state used !
+               !                                     ! ================== !
+               !  Fills sedta, tedta, uedta (global arrays)
+               !  Remark: this works for njzoom = 1. Should the definition of ij include njzoom?
+               DO ji = nie0, nie1
+                  DO jj = 1, jpj
+                     sshedta(jj,1) = sshn(ji+1,jj) * tmask(ji+1,jj,1)
+                  END DO
+               END DO
+            ENDIF
+         ENDIF
+
+         IF( lp_obc_west) THEN
+            ! initialisation to zero
+            sshwdta(:,:) = 0.e0
+            ubtwdta(:,:) = 0.e0
+            vbtwdta(:,:) = 0.e0 ! tangential component
+            !                                        ! ================== !
+            IF( nobc_dta == 0 )   THEN               ! initial state used !
+               !                                     ! ================== !
+               !  Fills swdta, twdta, uwdta (global arrays)
+               !  Remark: this works for njzoom = 1. Should the definition of ij include njzoom?
+               DO ji = niw0, niw1
+                  DO jj = 1, jpj
+                     sshwdta(jj,1) = sshn(ji,jj) * tmask(ji,jj,1)
+                  END DO
+               END DO
+            ENDIF
+         ENDIF
+
+         IF( lp_obc_north) THEN
+            ! initialisation to zero
+            sshndta(:,:) = 0.e0
+            ubtndta(:,:) = 0.e0 ! tangential component
+            vbtndta(:,:) = 0.e0
+            !                                        ! ================== !
+            IF( nobc_dta == 0 ) THEN                 ! initial state used !
+               !                                     ! ================== !
+               !  Fills sndta, tndta, vndta (global arrays)
+               !  Remark: this works for njzoom = 1. Should the definition of ij include njzoom?
+               DO jj = njn0, njn1
+                  DO ji = 1, jpi
+                     sshndta(ji,1) = sshn(ji,jj+1) * tmask(ji,jj+1,1)
+                  END DO
+               END DO
+            ENDIF
+         ENDIF
+
+         IF( lp_obc_south) THEN
+            ! initialisation to zero
+            sshsdta(:,:) = 0.e0
+            ubtsdta(:,:) = 0.e0 ! tangential component
+            vbtsdta(:,:) = 0.e0
+            !                                        ! ================== !
+            IF( nobc_dta == 0 )   THEN               ! initial state used !
+               !                                     ! ================== !
+               !  Fills ssdta, tsdta, vsdta (global arrays)
+               !  Remark: this works for njzoom = 1. Should the definition of ij include njzoom?
+               DO jj = njs0, njs1
+                  DO ji = 1, jpi
+                     sshsdta(ji,1) = sshn(ji,jj) * tmask(ji,jj,1)
+                  END DO
+               END DO
+            ENDIF
+         ENDIF
+
+         IF( nobc_dta == 0 ) CALL obc_depth_average(1)   ! depth averaged velocity from the OBC depth-dependent frames
+
+      ENDIF        !       END kt == nit000
+
+      !!------------------------------------------------------------------------------------
+      ! 2.      Initialize the time we are at. Does this every time the routine is called,
+      !         excepted when nobc_dta = 0
+      !
+
+      ! 3.  Call at every time step : Linear interpolation of BCs to current time step
+      ! ----------------------------------------------------------------------
+
+      IF( lk_dynspg_ts ) THEN
+         isrel = (kt-1)*rdt + kbt*(rdt/REAL(nn_baro,wp))
+      ELSE IF( lk_dynspg_exp ) THEN
+         isrel=kt*rdt
+      ENDIF
+
+      itobcm = nt_b
+      itobcp = nt_a
+      IF( itobc == 1 .OR. nobc_dta == 0 ) THEN
+         zxy = 0.e0
+         itobcm = 1
+         itobcp = 1
+      ELSE IF( itobc == 12 ) THEN
+         i15   = nday / 16
+         zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
+      ELSE
+         zxy = (zjcnes_obc(nt_a)-FLOAT(isrel)) / (zjcnes_obc(nt_a)-zjcnes_obc(nt_b))
+         IF( zxy < 0. ) THEN   ! case of extrapolation, switch to old time frames
+            itobcm = nt_m
+            itobcp = nt_b
+            zxy = (zjcnes_obc(nt_b)-FLOAT(isrel)) / (zjcnes_obc(nt_b)-zjcnes_obc(nt_m))
+         ENDIF
+      ENDIF
+
+      IF( lp_obc_east ) THEN           !  fills sshfoe, ubtfoe (local to each processor)
+         DO jj = 1, jpj
+            sshfoe(jj) = zxy * sshedta(jj,itobcp) + (1.-zxy) * sshedta(jj,itobcm)
+            ubtfoe(jj) = zxy * ubtedta(jj,itobcp) + (1.-zxy) * ubtedta(jj,itobcm)
+            vbtfoe(jj) = zxy * vbtedta(jj,itobcp) + (1.-zxy) * vbtedta(jj,itobcm)
+         END DO
+      ENDIF
+
+      IF( lp_obc_west) THEN            !  fills sshfow, ubtfow (local to each processor)
+         DO jj = 1, jpj
+            sshfow(jj) = zxy * sshwdta(jj,itobcp) + (1.-zxy) * sshwdta(jj,itobcm)
+            ubtfow(jj) = zxy * ubtwdta(jj,itobcp) + (1.-zxy) * ubtwdta(jj,itobcm)
+            vbtfow(jj) = zxy * vbtwdta(jj,itobcp) + (1.-zxy) * vbtwdta(jj,itobcm)
+         END DO
+      ENDIF
+
+      IF( lp_obc_north) THEN           !  fills sshfon, vbtfon (local to each processor)
+         DO ji = 1, jpi
+            sshfon(ji) = zxy * sshndta(ji,itobcp) + (1.-zxy) * sshndta(ji,itobcm)
+            ubtfon(ji) = zxy * ubtndta(ji,itobcp) + (1.-zxy) * ubtndta(ji,itobcm)
+            vbtfon(ji) = zxy * vbtndta(ji,itobcp) + (1.-zxy) * vbtndta(ji,itobcm)
+         END DO
+      ENDIF
+
+      IF( lp_obc_south) THEN           !  fills sshfos, vbtfos (local to each processor)
+         DO ji = 1, jpi
+            sshfos(ji) = zxy * sshsdta(ji,itobcp) + (1.-zxy) * sshsdta(ji,itobcm)
+            ubtfos(ji) = zxy * ubtsdta(ji,itobcp) + (1.-zxy) * ubtsdta(ji,itobcm)
+            vbtfos(ji) = zxy * vbtsdta(ji,itobcp) + (1.-zxy) * vbtsdta(ji,itobcm)
+         END DO
+      ENDIF
+
+   END SUBROUTINE obc_dta_bt
+
+# else
+   !!-----------------------------------------------------------------------------
+   !!   Default option
+   !!-----------------------------------------------------------------------------
+   SUBROUTINE obc_dta_bt ( kt, kbt )       ! Empty routine
+      !! * Arguments
+      INTEGER,INTENT(in) :: kt
+      INTEGER, INTENT( in ) ::   kbt         ! barotropic ocean time-step index
+      WRITE(*,*) 'obc_dta_bt: You should not have seen this print! error?', kt
+      WRITE(*,*) 'obc_dta_bt: You should not have seen this print! error?', kbt
+   END SUBROUTINE obc_dta_bt
+# endif
+
+   SUBROUTINE obc_read (kt, nt_x, ntobc_x, iyy, imm)
+      !!-------------------------------------------------------------------------
+      !!                      ***  ROUTINE obc_read  ***
+      !!
+      !! ** Purpose :  Read the boundary data in files identified by iyy and imm
+      !!               According to the validated open boundaries, return the 
+      !!               following arrays :
+      !!                sedta, tedta : East OBC salinity and temperature
+      !!                uedta, vedta :   "   "  u and v velocity component      
+      !!
+      !!                swdta, twdta : West OBC salinity and temperature
+      !!                uwdta, vwdta :   "   "  u and v velocity component      
+      !!
+      !!                sndta, tndta : North OBC salinity and temperature
+      !!                undta, vndta :   "   "  u and v velocity component      
+      !!
+      !!                ssdta, tsdta : South OBC salinity and temperature
+      !!                usdta, vsdta :   "   "  u and v velocity component      
+      !!
+      !! ** Method  :  These fields are read in the record ntobc_x of the files.
+      !!               The number of records is already known. If  ntobc_x is greater
+      !!               than the number of record, this routine will look for next file,
+      !!               updating the indices (case of inter-annual obcs) or loop at the
+      !!               begining in case of climatological file (ln_obc_clim = true ).
+      !! -------------------------------------------------------------------------
+      !! History:     !  2005  ( P. Mathiot, C. Langlais ) Original code
+      !!              !  2008  ( J,M, Molines ) Use IOM and cleaning
+      !!--------------------------------------------------------------------------
+
+      ! * Arguments
+      INTEGER, INTENT( in ) :: kt, nt_x
+      INTEGER, INTENT( inout ) :: ntobc_x , iyy, imm      ! yes ! inout !
+
+      ! * Local variables
+      CHARACTER (len=40) :: &    ! file names
          cl_obc_eTS   , cl_obc_eU,  cl_obc_eV,&
          cl_obc_wTS   , cl_obc_wU,  cl_obc_wV,&
@@ -947,308 +748,353 @@
          cl_obc_sTS   , cl_obc_sU,  cl_obc_sV
 
-    INTEGER :: ikprint
-    REAL(wp) :: zmin, zmax   ! control of boundary values
-
-    !IOM stuff
-    INTEGER :: id_e, id_w, id_n, id_s, ji, jj
-    INTEGER, DIMENSION(2) :: istart, icount
-   
-    !--------------------------------------------------------------------------
-    IF ( ntobc_x > itobc ) THEN
-      IF (ln_obc_clim) THEN  ! just loop on the same file
-        ntobc_x = 1 
-      ELSE
-        ! need to change file : it is always for an 'after' data
-        IF ( cffile == 'annual' ) THEN ! go to next year file
-          iyy = iyy + 1
-        ELSE IF ( cffile =='monthly' ) THEN  ! go to next month file
-          imm = imm + 1 
-          IF ( imm == 13 ) THEN 
-            imm = 1 ; iyy = iyy + 1
-          ENDIF
-        ELSE
-         ctmp1='obcread : this type of obc file is not supported :( '
-         ctmp2=TRIM(cffile)
-         CALL ctl_stop (ctmp1, ctmp2)
-         ! cffile should be either annual or monthly ...
-        ENDIF
-       ! as the file is changed, need to update itobc etc ...
-        CALL obc_dta_chktime (iyy,imm)
-        ntobc_x = nrecbef() + 1 ! remember : this case occur for an after data
-      ENDIF
-    ENDIF
-
-    IF ( lp_obc_east ) THEN 
-       ! ... Read datafile and set temperature, salinity and normal velocity
-       ! ... initialise the sedta, tedta, uedta arrays
-       WRITE(cl_obc_eTS ,'("obc_east_TS_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       WRITE(cl_obc_eU  ,'("obc_east_U_y"   ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       WRITE(cl_obc_eV  ,'("obc_east_V_y"   ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       ! JMM this may change depending on the obc data format ...
-       istart(:)=(/nje0+njmpp-1,1/) ; icount(:)=(/nje1-nje0 +1,jpk/)
-       IF (lwp) WRITE(numout,*) 'read data in :', TRIM(cl_obc_eTS)
-       IF (nje1 >= nje0 ) THEN
-          CALL iom_open ( cl_obc_eTS , id_e )
-          CALL iom_get ( id_e, jpdom_unknown, 'votemper', tedta(nje0:nje1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_get ( id_e, jpdom_unknown, 'vosaline', sedta(nje0:nje1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close (id_e)
-          !
-          CALL iom_open ( cl_obc_eU , id_e )
-          CALL iom_get  ( id_e, jpdom_unknown, 'vozocrtx', uedta(nje0:nje1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close ( id_e )
-          !
-          CALL iom_open ( cl_obc_eV , id_e )
-          CALL iom_get ( id_e, jpdom_unknown, 'vomecrty', vedta(nje0:nje1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close ( id_e )
-
-          ! mask the boundary values
-          tedta(:,:,nt_x) = tedta(:,:,nt_x)*temsk(:,:) ;  sedta(:,:,nt_x) = sedta(:,:,nt_x)*temsk(:,:)
-          uedta(:,:,nt_x) = uedta(:,:,nt_x)*uemsk(:,:) ;  vedta(:,:,nt_x) = vedta(:,:,nt_x)*vemsk(:,:)
-
-          ! check any outliers 
-          zmin=MINVAL( sedta(:,:,nt_x), mask=ltemsk ) ; zmax=MAXVAL(sedta(:,:,nt_x), mask=ltemsk)
-          IF (  zmin < 5 .OR. zmax > 50)   THEN
-             CALL ctl_stop('Error in sedta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( tedta(:,:,nt_x), mask=ltemsk ) ; zmax=MAXVAL(tedta(:,:,nt_x), mask=ltemsk)
-          IF (  zmin < -10. .OR. zmax > 40)   THEN
-             CALL ctl_stop('Error in tedta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( uedta(:,:,nt_x), mask=luemsk ) ; zmax=MAXVAL(uedta(:,:,nt_x), mask=luemsk)
-          IF (  zmin < -5. .OR. zmax > 5.)   THEN
-             CALL ctl_stop('Error in uedta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( vedta(:,:,nt_x), mask=lvemsk ) ; zmax=MAXVAL(vedta(:,:,nt_x), mask=lvemsk)
-          IF (  zmin < -5. .OR. zmax > 5.)   THEN
-             CALL ctl_stop('Error in vedta',' routine obcdta')
-          ENDIF
-
-          !               Usually printout is done only once at kt = nit000, unless nprint (namelist) > 1      
-          IF ( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
-             WRITE(numout,*)
-             WRITE(numout,*) ' Read East OBC data records ', ntobc_x
-             ikprint = jpj/20 +1
-             WRITE(numout,*) ' Temperature  record 1 - printout every 3 level'
-             CALL prihre( tedta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Salinity  record 1 - printout every 3 level'
-             CALL prihre( sedta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Normal velocity U  record 1  - printout every 3 level'
-             CALL prihre( uedta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Tangential velocity V  record 1  - printout every 3 level'
-             CALL prihre( vedta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
-          ENDIF
-       ENDIF
-    ENDIF
+      INTEGER :: ikprint
+      REAL(wp) :: zmin, zmax   ! control of boundary values
+
+      !IOM stuff
+      INTEGER :: id_e, id_w, id_n, id_s
+      INTEGER, DIMENSION(2) :: istart, icount
+
+      !--------------------------------------------------------------------------
+      IF ( ntobc_x > itobc ) THEN
+         IF (ln_obc_clim) THEN  ! just loop on the same file
+            ntobc_x = 1 
+         ELSE
+            ! need to change file : it is always for an 'after' data
+            IF ( cffile == 'annual' ) THEN ! go to next year file
+               iyy = iyy + 1
+            ELSE IF ( cffile =='monthly' ) THEN  ! go to next month file
+               imm = imm + 1 
+               IF ( imm == 13 ) THEN 
+                  imm = 1 ; iyy = iyy + 1
+               ENDIF
+            ELSE
+               ctmp1='obcread : this type of obc file is not supported :( '
+               ctmp2=TRIM(cffile)
+               CALL ctl_stop (ctmp1, ctmp2)
+               ! cffile should be either annual or monthly ...
+            ENDIF
+            ! as the file is changed, need to update itobc etc ...
+            CALL obc_dta_chktime (iyy,imm)
+            ntobc_x = nrecbef() + 1 ! remember : this case occur for an after data
+         ENDIF
+      ENDIF
+
+      IF( lp_obc_east ) THEN 
+         ! ... Read datafile and set temperature, salinity and normal velocity
+         ! ... initialise the sedta, tedta, uedta arrays
+         IF(ln_obc_clim) THEN  ! revert to old convention for climatological OBC forcing
+            cl_obc_eTS='obceast_TS.nc'
+            cl_obc_eU ='obceast_U.nc'
+            cl_obc_eV ='obceast_V.nc'
+         ELSE                  ! convention for climatological OBC
+            WRITE(cl_obc_eTS ,'("obc_east_TS_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+            WRITE(cl_obc_eU  ,'("obc_east_U_y"   ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+            WRITE(cl_obc_eV  ,'("obc_east_V_y"   ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+         ENDIF
+         ! JMM this may change depending on the obc data format ...
+         istart(:)=(/nje0+njmpp-1,1/) ; icount(:)=(/nje1-nje0 +1,jpk/)
+         IF (lwp) WRITE(numout,*) 'read data in :', TRIM(cl_obc_eTS)
+         IF (nje1 >= nje0 ) THEN
+            CALL iom_open ( cl_obc_eTS , id_e )
+            CALL iom_get ( id_e, jpdom_unknown, 'votemper', tedta(nje0:nje1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_get ( id_e, jpdom_unknown, 'vosaline', sedta(nje0:nje1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+# if defined key_dynspg_ts || defined key_dynspg_exp
+            CALL iom_get ( id_e, jpdom_unknown, 'vossurfh', sshedta(nje0:nje1,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+# endif
+            CALL iom_close (id_e)
+            !
+            CALL iom_open ( cl_obc_eU , id_e )
+            CALL iom_get  ( id_e, jpdom_unknown, 'vozocrtx', uedta(nje0:nje1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_close ( id_e )
+            !
+            CALL iom_open ( cl_obc_eV , id_e )
+            CALL iom_get ( id_e, jpdom_unknown, 'vomecrty', vedta(nje0:nje1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_close ( id_e )
+
+            ! mask the boundary values
+            tedta(:,:,nt_x) = tedta(:,:,nt_x)*temsk(:,:) ;  sedta(:,:,nt_x) = sedta(:,:,nt_x)*temsk(:,:)
+            uedta(:,:,nt_x) = uedta(:,:,nt_x)*uemsk(:,:) ;  vedta(:,:,nt_x) = vedta(:,:,nt_x)*vemsk(:,:)
+
+            ! check any outliers 
+            zmin=MINVAL( sedta(:,:,nt_x), mask=ltemsk ) ; zmax=MAXVAL(sedta(:,:,nt_x), mask=ltemsk)
+            IF (  zmin < 5 .OR. zmax > 50)   THEN
+               CALL ctl_stop('Error in sedta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( tedta(:,:,nt_x), mask=ltemsk ) ; zmax=MAXVAL(tedta(:,:,nt_x), mask=ltemsk)
+            IF (  zmin < -10. .OR. zmax > 40)   THEN
+               CALL ctl_stop('Error in tedta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( uedta(:,:,nt_x), mask=luemsk ) ; zmax=MAXVAL(uedta(:,:,nt_x), mask=luemsk)
+            IF (  zmin < -5. .OR. zmax > 5.)   THEN
+               CALL ctl_stop('Error in uedta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( vedta(:,:,nt_x), mask=lvemsk ) ; zmax=MAXVAL(vedta(:,:,nt_x), mask=lvemsk)
+            IF (  zmin < -5. .OR. zmax > 5.)   THEN
+               CALL ctl_stop('Error in vedta',' routine obcdta')
+            ENDIF
+
+            !               Usually printout is done only once at kt = nit000, unless nprint (namelist) > 1      
+            IF ( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
+               WRITE(numout,*)
+               WRITE(numout,*) ' Read East OBC data records ', ntobc_x
+               ikprint = jpj/20 +1
+               WRITE(numout,*) ' Temperature  record 1 - printout every 3 level'
+               CALL prihre( tedta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Salinity  record 1 - printout every 3 level'
+               CALL prihre( sedta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Normal velocity U  record 1  - printout every 3 level'
+               CALL prihre( uedta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Tangential velocity V  record 1  - printout every 3 level'
+               CALL prihre( vedta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
+            ENDIF
+         ENDIF
+      ENDIF
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-    IF ( lp_obc_west ) THEN
-       ! ... Read datafile and set temperature, salinity and normal velocity
-       ! ... initialise the swdta, twdta, uwdta arrays
-       WRITE(cl_obc_wTS ,'("obc_west_TS_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       WRITE(cl_obc_wU  ,'("obc_west_U_y"   ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       WRITE(cl_obc_wV  ,'("obc_west_V_y"   ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       istart(:)=(/njw0+njmpp-1,1/) ; icount(:)=(/njw1-njw0 +1,jpk/)
-       IF (lwp) WRITE(numout,*) 'read data in :', TRIM(cl_obc_wTS)
-
-       IF ( njw1 >= njw0 ) THEN
-          CALL iom_open ( cl_obc_wTS , id_w )
-          CALL iom_get ( id_w, jpdom_unknown, 'votemper', twdta(njw0:njw1,:,nt_x), & 
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-
-          CALL iom_get ( id_w, jpdom_unknown, 'vosaline', swdta(njw0:njw1,:,nt_x), &
+      IF ( lp_obc_west ) THEN
+         ! ... Read datafile and set temperature, salinity and normal velocity
+         ! ... initialise the swdta, twdta, uwdta arrays
+         IF (ln_obc_clim) THEN   ! revert to old convention for climatological OBC forcing
+            cl_obc_wTS='obcwest_TS.nc'
+            cl_obc_wU ='obcwest_U.nc'
+            cl_obc_wV ='obcwest_V.nc'
+         ELSE                    ! convention for climatological OBC
+            WRITE(cl_obc_wTS ,'("obc_west_TS_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+            WRITE(cl_obc_wU  ,'("obc_west_U_y"   ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+            WRITE(cl_obc_wV  ,'("obc_west_V_y"   ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+         ENDIF
+         istart(:)=(/njw0+njmpp-1,1/) ; icount(:)=(/njw1-njw0 +1,jpk/)
+         IF (lwp) WRITE(numout,*) 'read data in :', TRIM(cl_obc_wTS)
+
+         IF ( njw1 >= njw0 ) THEN
+            CALL iom_open ( cl_obc_wTS , id_w )
+            CALL iom_get ( id_w, jpdom_unknown, 'votemper', twdta(njw0:njw1,:,nt_x), & 
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+
+            CALL iom_get ( id_w, jpdom_unknown, 'vosaline', swdta(njw0:njw1,:,nt_x), &
                &               ktime=ntobc_x , kstart=istart, kcount= icount)
-          CALL iom_close (id_w)
-          !
-          CALL iom_open ( cl_obc_wU , id_w )
-          CALL iom_get  ( id_w, jpdom_unknown, 'vozocrtx', uwdta(njw0:njw1,:,nt_x),&
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close ( id_w )
-          !
-          CALL iom_open ( cl_obc_wV , id_w )
-          CALL iom_get ( id_w, jpdom_unknown, 'vomecrty', vwdta(njw0:njw1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close ( id_w )
-
-          ! mask the boundary values
-          twdta(:,:,nt_x) = twdta(:,:,nt_x)*twmsk(:,:) ;  swdta(:,:,nt_x) = swdta(:,:,nt_x)*twmsk(:,:)
-          uwdta(:,:,nt_x) = uwdta(:,:,nt_x)*uwmsk(:,:) ;  vwdta(:,:,nt_x) = vwdta(:,:,nt_x)*vwmsk(:,:)
-
-          ! check any outliers
-          zmin=MINVAL( swdta(:,:,nt_x), mask=ltwmsk ) ; zmax=MAXVAL(swdta(:,:,nt_x), mask=ltwmsk)
-          IF (  zmin < 5 .OR. zmax > 50)   THEN
-             CALL ctl_stop('Error in swdta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( twdta(:,:,nt_x), mask=ltwmsk ) ; zmax=MAXVAL(twdta(:,:,nt_x), mask=ltwmsk)
-          IF (  zmin < -10. .OR. zmax > 40)   THEN
-             CALL ctl_stop('Error in twdta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( uwdta(:,:,nt_x), mask=luwmsk ) ; zmax=MAXVAL(uwdta(:,:,nt_x), mask=luwmsk)
-          IF (  zmin < -5. .OR. zmax > 5.)   THEN
-             CALL ctl_stop('Error in uwdta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( vwdta(:,:,nt_x), mask=lvwmsk ) ; zmax=MAXVAL(vwdta(:,:,nt_x), mask=lvwmsk)
-          IF (  zmin < -5. .OR. zmax > 5.)   THEN
-             CALL ctl_stop('Error in vwdta',' routine obcdta')
-          ENDIF
-
-
-          IF ( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
-             WRITE(numout,*)
-             WRITE(numout,*) ' Read West OBC data records ', ntobc_x
-             ikprint = jpj/20 +1
-             WRITE(numout,*) ' Temperature  record 1 - printout every 3 level'
-             CALL prihre( twdta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Salinity  record 1 - printout every 3 level'
-             CALL prihre( swdta(:,:,nt_x),jpj,jpk, 1, jpj, ikprint,   jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Normal velocity U  record 1  - printout every 3 level'
-             CALL prihre( uwdta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Tangential velocity V  record 1  - printout every 3 level'
-             CALL prihre( vwdta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
-          ENDIF
-       END IF
-    ENDIF
+# if defined key_dynspg_ts || defined key_dynspg_exp
+            CALL iom_get ( id_w, jpdom_unknown, 'vossurfh', sshwdta(njw0:njw1,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+# endif
+            CALL iom_close (id_w)
+            !
+            CALL iom_open ( cl_obc_wU , id_w )
+            CALL iom_get  ( id_w, jpdom_unknown, 'vozocrtx', uwdta(njw0:njw1,:,nt_x),&
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_close ( id_w )
+            !
+            CALL iom_open ( cl_obc_wV , id_w )
+            CALL iom_get ( id_w, jpdom_unknown, 'vomecrty', vwdta(njw0:njw1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_close ( id_w )
+
+            ! mask the boundary values
+            twdta(:,:,nt_x) = twdta(:,:,nt_x)*twmsk(:,:) ;  swdta(:,:,nt_x) = swdta(:,:,nt_x)*twmsk(:,:)
+            uwdta(:,:,nt_x) = uwdta(:,:,nt_x)*uwmsk(:,:) ;  vwdta(:,:,nt_x) = vwdta(:,:,nt_x)*vwmsk(:,:)
+
+            ! check any outliers
+            zmin=MINVAL( swdta(:,:,nt_x), mask=ltwmsk ) ; zmax=MAXVAL(swdta(:,:,nt_x), mask=ltwmsk)
+            IF (  zmin < 5 .OR. zmax > 50)   THEN
+               CALL ctl_stop('Error in swdta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( twdta(:,:,nt_x), mask=ltwmsk ) ; zmax=MAXVAL(twdta(:,:,nt_x), mask=ltwmsk)
+            IF (  zmin < -10. .OR. zmax > 40)   THEN
+               CALL ctl_stop('Error in twdta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( uwdta(:,:,nt_x), mask=luwmsk ) ; zmax=MAXVAL(uwdta(:,:,nt_x), mask=luwmsk)
+            IF (  zmin < -5. .OR. zmax > 5.)   THEN
+               CALL ctl_stop('Error in uwdta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( vwdta(:,:,nt_x), mask=lvwmsk ) ; zmax=MAXVAL(vwdta(:,:,nt_x), mask=lvwmsk)
+            IF (  zmin < -5. .OR. zmax > 5.)   THEN
+               CALL ctl_stop('Error in vwdta',' routine obcdta')
+            ENDIF
+
+
+            IF ( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
+               WRITE(numout,*)
+               WRITE(numout,*) ' Read West OBC data records ', ntobc_x
+               ikprint = jpj/20 +1
+               WRITE(numout,*) ' Temperature  record 1 - printout every 3 level'
+               CALL prihre( twdta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Salinity  record 1 - printout every 3 level'
+               CALL prihre( swdta(:,:,nt_x),jpj,jpk, 1, jpj, ikprint,   jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Normal velocity U  record 1  - printout every 3 level'
+               CALL prihre( uwdta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Tangential velocity V  record 1  - printout every 3 level'
+               CALL prihre( vwdta(:,:,nt_x), jpj, jpk, 1, jpj, ikprint, jpk, 1, -3, 1., numout )
+            ENDIF
+         END IF
+      ENDIF
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-    IF( lp_obc_north) THEN
-       WRITE(cl_obc_nTS ,'("obc_north_TS_y" ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       WRITE(cl_obc_nV  ,'("obc_north_V_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       WRITE(cl_obc_nU  ,'("obc_north_U_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       istart(:)=(/nin0+nimpp-1,1/) ; icount(:)=(/nin1-nin0 +1,jpk/)
-       IF (lwp) WRITE(numout,*) 'read data in :', TRIM(cl_obc_nTS)
-       IF ( nin1 >= nin0 ) THEN
-          CALL iom_open ( cl_obc_nTS , id_n )
-          CALL iom_get ( id_n, jpdom_unknown, 'votemper', tndta(nin0:nin1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_get ( id_n, jpdom_unknown, 'vosaline', sndta(nin0:nin1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close (id_n)
-          !
-          CALL iom_open ( cl_obc_nU , id_n )
-          CALL iom_get  ( id_n, jpdom_unknown, 'vozocrtx', undta(nin0:nin1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close ( id_n )
-          !
-          CALL iom_open ( cl_obc_nV , id_n )
-          CALL iom_get  ( id_n, jpdom_unknown, 'vomecrty', vndta(nin0:nin1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close ( id_n )
-
-          ! mask the boundary values
-          tndta(:,:,nt_x) = tndta(:,:,nt_x)*tnmsk(:,:) ;  sndta(:,:,nt_x) = sndta(:,:,nt_x)*tnmsk(:,:)
-          undta(:,:,nt_x) = undta(:,:,nt_x)*unmsk(:,:) ;  vndta(:,:,nt_x) = vndta(:,:,nt_x)*vnmsk(:,:)
-
-          ! check any outliers
-          zmin=MINVAL( sndta(:,:,nt_x), mask=ltnmsk ) ; zmax=MAXVAL(sndta(:,:,nt_x), mask=ltnmsk)
-          IF (  zmin < 5 .OR. zmax > 50)   THEN
-             CALL ctl_stop('Error in sndta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( tndta(:,:,nt_x), mask=ltnmsk ) ; zmax=MAXVAL(tndta(:,:,nt_x), mask=ltnmsk)
-          IF (  zmin < -10. .OR. zmax > 40)   THEN
-             CALL ctl_stop('Error in tndta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( undta(:,:,nt_x), mask=lunmsk ) ; zmax=MAXVAL(undta(:,:,nt_x), mask=lunmsk)
-          IF (  zmin < -5. .OR. zmax > 5.)   THEN
-             CALL ctl_stop('Error in undta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( vndta(:,:,nt_x), mask=lvnmsk ) ; zmax=MAXVAL(vndta(:,:,nt_x), mask=lvnmsk)
-          IF (  zmin < -5. .OR. zmax > 5.)   THEN
-             CALL ctl_stop('Error in vndta',' routine obcdta')
-          ENDIF
-
-          IF ( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
-             WRITE(numout,*)
-             WRITE(numout,*) ' Read North OBC data records ', ntobc_x
-             ikprint = jpi/20 +1
-             WRITE(numout,*) ' Temperature  record 1 - printout every 3 level'
-             CALL prihre( tndta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Salinity  record 1 - printout every 3 level'
-             CALL prihre( sndta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Normal velocity V  record 1  - printout every 3 level'
-             CALL prihre( vndta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Tangential  velocity U  record 1  - printout every 3 level'
-             CALL prihre( undta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
-          ENDIF
-       ENDIF
-    ENDIF
+      IF( lp_obc_north) THEN
+         IF(ln_obc_clim) THEN   ! revert to old convention for climatological OBC forcing
+            cl_obc_nTS='obcnorth_TS.nc'
+            cl_obc_nU ='obcnorth_U.nc'
+            cl_obc_nV ='obcnorth_V.nc'
+         ELSE                   ! convention for climatological OBC
+            WRITE(cl_obc_nTS ,'("obc_north_TS_y" ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+            WRITE(cl_obc_nV  ,'("obc_north_V_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+            WRITE(cl_obc_nU  ,'("obc_north_U_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+         ENDIF
+         istart(:)=(/nin0+nimpp-1,1/) ; icount(:)=(/nin1-nin0 +1,jpk/)
+         IF (lwp) WRITE(numout,*) 'read data in :', TRIM(cl_obc_nTS)
+         IF ( nin1 >= nin0 ) THEN
+            CALL iom_open ( cl_obc_nTS , id_n )
+            CALL iom_get ( id_n, jpdom_unknown, 'votemper', tndta(nin0:nin1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_get ( id_n, jpdom_unknown, 'vosaline', sndta(nin0:nin1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+# if defined key_dynspg_ts || defined key_dynspg_exp
+            CALL iom_get ( id_n, jpdom_unknown, 'vossurfh', sshndta(nin0:nin1,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+# endif
+            CALL iom_close (id_n)
+            !
+            CALL iom_open ( cl_obc_nU , id_n )
+            CALL iom_get  ( id_n, jpdom_unknown, 'vozocrtx', undta(nin0:nin1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_close ( id_n )
+            !
+            CALL iom_open ( cl_obc_nV , id_n )
+            CALL iom_get  ( id_n, jpdom_unknown, 'vomecrty', vndta(nin0:nin1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_close ( id_n )
+
+            ! mask the boundary values
+            tndta(:,:,nt_x) = tndta(:,:,nt_x)*tnmsk(:,:) ;  sndta(:,:,nt_x) = sndta(:,:,nt_x)*tnmsk(:,:)
+            undta(:,:,nt_x) = undta(:,:,nt_x)*unmsk(:,:) ;  vndta(:,:,nt_x) = vndta(:,:,nt_x)*vnmsk(:,:)
+
+            ! check any outliers
+            zmin=MINVAL( sndta(:,:,nt_x), mask=ltnmsk ) ; zmax=MAXVAL(sndta(:,:,nt_x), mask=ltnmsk)
+            IF (  zmin < 5 .OR. zmax > 50)   THEN
+               CALL ctl_stop('Error in sndta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( tndta(:,:,nt_x), mask=ltnmsk ) ; zmax=MAXVAL(tndta(:,:,nt_x), mask=ltnmsk)
+            IF (  zmin < -10. .OR. zmax > 40)   THEN
+               CALL ctl_stop('Error in tndta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( undta(:,:,nt_x), mask=lunmsk ) ; zmax=MAXVAL(undta(:,:,nt_x), mask=lunmsk)
+            IF (  zmin < -5. .OR. zmax > 5.)   THEN
+               CALL ctl_stop('Error in undta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( vndta(:,:,nt_x), mask=lvnmsk ) ; zmax=MAXVAL(vndta(:,:,nt_x), mask=lvnmsk)
+            IF (  zmin < -5. .OR. zmax > 5.)   THEN
+               CALL ctl_stop('Error in vndta',' routine obcdta')
+            ENDIF
+
+            IF ( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
+               WRITE(numout,*)
+               WRITE(numout,*) ' Read North OBC data records ', ntobc_x
+               ikprint = jpi/20 +1
+               WRITE(numout,*) ' Temperature  record 1 - printout every 3 level'
+               CALL prihre( tndta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Salinity  record 1 - printout every 3 level'
+               CALL prihre( sndta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Normal velocity V  record 1  - printout every 3 level'
+               CALL prihre( vndta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Tangential  velocity U  record 1  - printout every 3 level'
+               CALL prihre( undta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
+            ENDIF
+         ENDIF
+      ENDIF
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-    IF( lp_obc_south) THEN 
-       WRITE(cl_obc_sTS ,'("obc_south_TS_y" ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       WRITE(cl_obc_sV  ,'("obc_south_V_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       WRITE(cl_obc_sU  ,'("obc_south_U_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
-       istart(:)=(/nis0+nimpp-1,1/) ; icount(:)=(/nis1-nis0 +1,jpk/)
-       IF (lwp) WRITE(numout,*) 'read data in :', TRIM(cl_obc_sTS)
-       IF ( nis1 >= nis0 ) THEN 
-          CALL iom_open ( cl_obc_sTS , id_s )
-          CALL iom_get ( id_s, jpdom_unknown, 'votemper', tsdta(nis0:nis1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_get ( id_s, jpdom_unknown, 'vosaline', ssdta(nis0:nis1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close (id_s)
-          !
-          CALL iom_open ( cl_obc_sU , id_s )
-          CALL iom_get  ( id_s, jpdom_unknown, 'vozocrtx', usdta(nis0:nis1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close ( id_s )
-          !
-          CALL iom_open ( cl_obc_sV , id_s )
-          CALL iom_get  ( id_s, jpdom_unknown, 'vomecrty', vsdta(nis0:nis1,:,nt_x), &
-               &               ktime=ntobc_x , kstart=istart, kcount= icount )
-          CALL iom_close ( id_s )
-
-          ! mask the boundary values
-          tsdta(:,:,nt_x) = tsdta(:,:,nt_x)*tsmsk(:,:) ;  ssdta(:,:,nt_x) = ssdta(:,:,nt_x)*tsmsk(:,:)
-          usdta(:,:,nt_x) = usdta(:,:,nt_x)*usmsk(:,:) ;  vsdta(:,:,nt_x) = vsdta(:,:,nt_x)*vsmsk(:,:)
-
-          ! check any outliers
-          zmin=MINVAL( ssdta(:,:,nt_x), mask=ltsmsk ) ; zmax=MAXVAL(ssdta(:,:,nt_x), mask=ltsmsk)
-          IF (  zmin < 5 .OR. zmax > 50)   THEN
-             CALL ctl_stop('Error in ssdta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( tsdta(:,:,nt_x), mask=ltsmsk ) ; zmax=MAXVAL(tsdta(:,:,nt_x), mask=ltsmsk)
-          IF (  zmin < -10. .OR. zmax > 40)   THEN
-             CALL ctl_stop('Error in tsdta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( usdta(:,:,nt_x), mask=lusmsk ) ; zmax=MAXVAL(usdta(:,:,nt_x), mask=lusmsk)
-          IF (  zmin < -5. .OR. zmax > 5.)   THEN
-             CALL ctl_stop('Error in usdta',' routine obcdta')
-          ENDIF
-          zmin=MINVAL( vsdta(:,:,nt_x), mask=lvsmsk ) ; zmax=MAXVAL(vsdta(:,:,nt_x), mask=lvsmsk)
-          IF (  zmin < -5. .OR. zmax > 5.)   THEN
-             CALL ctl_stop('Error in vsdta',' routine obcdta')
-          ENDIF
-
-          IF ( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
-             WRITE(numout,*)
-             WRITE(numout,*) ' Read South OBC data records ', ntobc_x
-             ikprint = jpi/20 +1
-             WRITE(numout,*) ' Temperature  record 1 - printout every 3 level'
-             CALL prihre( tsdta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Salinity  record 1 - printout every 3 level'
-             CALL prihre( ssdta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Normal velocity V  record 1  - printout every 3 level'
-             CALL prihre( vsdta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
-             WRITE(numout,*)
-             WRITE(numout,*) ' Tangential velocity U  record 1  - printout every 3 level'
-             CALL prihre( usdta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
-          ENDIF
-       ENDIF
-    ENDIF
+      IF( lp_obc_south) THEN 
+         IF(ln_obc_clim) THEN   ! revert to old convention for climatological OBC forcing
+            cl_obc_sTS='obcsouth_TS.nc'
+            cl_obc_sU ='obcsouth_U.nc'
+            cl_obc_sV ='obcsouth_V.nc'
+         ELSE                    ! convention for climatological OBC
+            WRITE(cl_obc_sTS ,'("obc_south_TS_y" ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+            WRITE(cl_obc_sV  ,'("obc_south_V_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+            WRITE(cl_obc_sU  ,'("obc_south_U_y"  ,i4.4,"m",i2.2,".nc")' ) iyy,imm
+         ENDIF
+         istart(:)=(/nis0+nimpp-1,1/) ; icount(:)=(/nis1-nis0 +1,jpk/)
+         IF (lwp) WRITE(numout,*) 'read data in :', TRIM(cl_obc_sTS)
+         IF ( nis1 >= nis0 ) THEN 
+            CALL iom_open ( cl_obc_sTS , id_s )
+            CALL iom_get ( id_s, jpdom_unknown, 'votemper', tsdta(nis0:nis1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_get ( id_s, jpdom_unknown, 'vosaline', ssdta(nis0:nis1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+# if defined key_dynspg_ts || defined key_dynspg_exp
+            CALL iom_get ( id_s, jpdom_unknown, 'vossurfh', sshsdta(nis0:nis1,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+# endif
+            CALL iom_close (id_s)
+            !
+            CALL iom_open ( cl_obc_sU , id_s )
+            CALL iom_get  ( id_s, jpdom_unknown, 'vozocrtx', usdta(nis0:nis1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_close ( id_s )
+            !
+            CALL iom_open ( cl_obc_sV , id_s )
+            CALL iom_get  ( id_s, jpdom_unknown, 'vomecrty', vsdta(nis0:nis1,:,nt_x), &
+               &               ktime=ntobc_x , kstart=istart, kcount= icount )
+            CALL iom_close ( id_s )
+
+            ! mask the boundary values
+            tsdta(:,:,nt_x) = tsdta(:,:,nt_x)*tsmsk(:,:) ;  ssdta(:,:,nt_x) = ssdta(:,:,nt_x)*tsmsk(:,:)
+            usdta(:,:,nt_x) = usdta(:,:,nt_x)*usmsk(:,:) ;  vsdta(:,:,nt_x) = vsdta(:,:,nt_x)*vsmsk(:,:)
+
+            ! check any outliers
+            zmin=MINVAL( ssdta(:,:,nt_x), mask=ltsmsk ) ; zmax=MAXVAL(ssdta(:,:,nt_x), mask=ltsmsk)
+            IF (  zmin < 5 .OR. zmax > 50)   THEN
+               CALL ctl_stop('Error in ssdta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( tsdta(:,:,nt_x), mask=ltsmsk ) ; zmax=MAXVAL(tsdta(:,:,nt_x), mask=ltsmsk)
+            IF (  zmin < -10. .OR. zmax > 40)   THEN
+               CALL ctl_stop('Error in tsdta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( usdta(:,:,nt_x), mask=lusmsk ) ; zmax=MAXVAL(usdta(:,:,nt_x), mask=lusmsk)
+            IF (  zmin < -5. .OR. zmax > 5.)   THEN
+               CALL ctl_stop('Error in usdta',' routine obcdta')
+            ENDIF
+            zmin=MINVAL( vsdta(:,:,nt_x), mask=lvsmsk ) ; zmax=MAXVAL(vsdta(:,:,nt_x), mask=lvsmsk)
+            IF (  zmin < -5. .OR. zmax > 5.)   THEN
+               CALL ctl_stop('Error in vsdta',' routine obcdta')
+            ENDIF
+
+            IF ( lwp .AND.  ( kt == nit000 .OR. nprint /= 0 )  ) THEN
+               WRITE(numout,*)
+               WRITE(numout,*) ' Read South OBC data records ', ntobc_x
+               ikprint = jpi/20 +1
+               WRITE(numout,*) ' Temperature  record 1 - printout every 3 level'
+               CALL prihre( tsdta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Salinity  record 1 - printout every 3 level'
+               CALL prihre( ssdta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Normal velocity V  record 1  - printout every 3 level'
+               CALL prihre( vsdta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
+               WRITE(numout,*)
+               WRITE(numout,*) ' Tangential velocity U  record 1  - printout every 3 level'
+               CALL prihre( usdta(:,:,nt_x), jpi, jpk, 1, jpi, ikprint, jpk, 1, -3, 1., numout )
+            ENDIF
+         ENDIF
+      ENDIF
+
+# if defined key_dynspg_ts || defined key_dynspg_exp
+      CALL obc_depth_average(nt_x)   ! computation of depth-averaged velocity
+# endif
+
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  END SUBROUTINE obc_read 
-
-  INTEGER FUNCTION nrecbef()
+   END SUBROUTINE obc_read
+
+   INTEGER FUNCTION nrecbef()
       !!-----------------------------------------------------------------------
       !!                     ***    FUNCTION nrecbef   ***
@@ -1261,33 +1107,108 @@
       INTEGER :: it , idum
 
-    idum = itobc
-    DO it =1, itobc
-       IF ( ztcobc(it) > zjcnes ) THEN ;  idum = it - 1 ; EXIT ;  ENDIF
-    ENDDO
-    ! idum can be 0 (climato, before first record)
-    IF ( idum == 0 ) THEN
-       IF ( ln_obc_clim ) THEN
-         idum = itobc
-       ELSE
-         ctmp1='obc_dta: find ntobc == 0 for  non climatological file '
-         ctmp2='consider adding a first record in your data file '
-         CALL ctl_stop(ctmp1, ctmp2)
-       ENDIF
-    ENDIF
-    ! idum can be itobc ( zjcnes > ztcobc (itobc) )
-    !  This is not a problem ...
-    nrecbef = idum
-
-  END FUNCTION nrecbef
+      idum = itobc
+      DO it =1, itobc
+         IF ( ztcobc(it) > zjcnes ) THEN ;  idum = it - 1 ; EXIT ;  ENDIF
+         ENDDO
+         ! idum can be 0 (climato, before first record)
+         IF ( idum == 0 ) THEN
+            IF ( ln_obc_clim ) THEN
+               idum = itobc
+            ELSE
+               ctmp1='obc_dta: find ntobc == 0 for  non climatological file '
+               ctmp2='consider adding a first record in your data file '
+               CALL ctl_stop(ctmp1, ctmp2)
+            ENDIF
+         ENDIF
+         ! idum can be itobc ( zjcnes > ztcobc (itobc) )
+         !  This is not a problem ...
+         nrecbef = idum
+
+      END FUNCTION nrecbef
+
+      !!==============================================================================
+      SUBROUTINE obc_depth_average(nt_x)
+         !!-----------------------------------------------------------------------
+         !!                     ***    ROUTINE obc_depth_average   ***
+         !!
+         !!  Purpose : - compute the depth-averaged velocity from depth-dependent OBC frames
+         !!
+         !!    History : 2009-01 : ( Fred Dupont ) Original code
+         !!-----------------------------------------------------------------------
+
+         ! * Arguments
+         INTEGER, INTENT( in ) :: nt_x
+
+         ! * Local variables
+         INTEGER :: ji, jj, jk
+
+
+         IF( lp_obc_east ) THEN
+            ! initialisation to zero
+            ubtedta(:,nt_x) = 0.e0
+            vbtedta(:,nt_x) = 0.e0
+            DO ji = nie0, nie1
+               DO jj = 1, jpj
+                  DO jk = 1, jpkm1
+                     ubtedta(jj,nt_x) = ubtedta(jj,nt_x) + uedta(jj,jk,nt_x)*fse3u(ji,jj,jk)
+                     vbtedta(jj,nt_x) = vbtedta(jj,nt_x) + vedta(jj,jk,nt_x)*fse3v(ji+1,jj,jk)
+                  END DO
+               END DO
+            END DO
+         ENDIF
+
+         IF( lp_obc_west) THEN
+            ! initialisation to zero
+            ubtwdta(:,nt_x) = 0.e0
+            vbtwdta(:,nt_x) = 0.e0
+            DO ji = niw0, niw1
+               DO jj = 1, jpj
+                  DO jk = 1, jpkm1
+                     ubtwdta(jj,nt_x) = ubtwdta(jj,nt_x) + uwdta(jj,jk,1)*fse3u(ji,jj,jk)
+                     vbtwdta(jj,nt_x) = vbtwdta(jj,nt_x) + vwdta(jj,jk,1)*fse3v(ji,jj,jk)
+                  END DO
+               END DO
+            END DO
+         ENDIF
+
+         IF( lp_obc_north) THEN
+            ! initialisation to zero
+            ubtndta(:,nt_x) = 0.e0
+            vbtndta(:,nt_x) = 0.e0
+            DO jj = njn0, njn1
+               DO ji = 1, jpi
+                  DO jk = 1, jpkm1
+                     ubtndta(ji,nt_x) = ubtndta(ji,nt_x) + undta(ji,jk,nt_x)*fse3u(ji,jj+1,jk)
+                     vbtndta(ji,nt_x) = vbtndta(ji,nt_x) + vndta(ji,jk,nt_x)*fse3v(ji,jj,jk)
+                  END DO
+               END DO
+            END DO
+         ENDIF
+
+         IF( lp_obc_south) THEN
+            ! initialisation to zero
+            ubtsdta(:,nt_x) = 0.e0
+            vbtsdta(:,nt_x) = 0.e0
+            DO jj = njs0, njs1
+               DO ji = nis0, nis1
+                  DO jk = 1, jpkm1
+                     ubtsdta(ji,nt_x) = ubtsdta(ji,nt_x) + usdta(ji,jk,nt_x)*fse3u(ji,jj,jk)
+                     vbtsdta(ji,nt_x) = vbtsdta(ji,nt_x) + vsdta(ji,jk,nt_x)*fse3v(ji,jj,jk)
+                  END DO
+               END DO
+            END DO
+         ENDIF
+
+      END SUBROUTINE obc_depth_average
 
 #else
-  !!------------------------------------------------------------------------------
-  !!   default option:           Dummy module          NO Open Boundary Conditions
-  !!------------------------------------------------------------------------------
-CONTAINS
-  SUBROUTINE obc_dta( kt )             ! Dummy routine
-    INTEGER, INTENT (in) :: kt
-    WRITE(*,*) 'obc_dta: You should not have seen this print! error?', kt
-  END SUBROUTINE obc_dta
+      !!------------------------------------------------------------------------------
+      !!   default option:           Dummy module          NO Open Boundary Conditions
+      !!------------------------------------------------------------------------------
+   CONTAINS
+      SUBROUTINE obc_dta( kt )             ! Dummy routine
+         INTEGER, INTENT (in) :: kt
+         WRITE(*,*) 'obc_dta: You should not have seen this print! error?', kt
+      END SUBROUTINE obc_dta
 #endif
-END MODULE obcdta
+   END MODULE obcdta
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcdyn_bt.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcdyn_bt.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcdyn_bt.F90	(revision 2200)
@@ -23,5 +23,5 @@
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE lib_mpp         ! distributed memory computing
-   USE obccli          ! ocean open boundary conditions: climatology
+   USE obcdta          ! ocean open boundary conditions
    USE in_out_manager  ! I/O manager
    USE dynspg_oce      ! surface pressure gradient     (free surface with time-splitting)
@@ -99,5 +99,4 @@
       !! * Local declaration
       INTEGER ::   ji, jj, jk ! dummy loop indices
-      REAL(wp) ::   z05cx, ztau, zin
       !!------------------------------------------------------------------------------
 
@@ -134,5 +133,4 @@
       !! * Local declaration
       INTEGER ::   ji, jj, jk ! dummy loop indices
-      REAL(wp) ::   z05cx, ztau, zin
       !!------------------------------------------------------------------------------
 
@@ -166,5 +164,4 @@
       !! * Local declaration
       INTEGER ::   ji, jj, jk ! dummy loop indices
-      REAL(wp) ::   z05cx, ztau, zin
       !!------------------------------------------------------------------------------
 
@@ -200,5 +197,4 @@
       !! * Local declaration
       INTEGER ::   ji, jj, jk ! dummy loop indices
-      REAL(wp) ::   z05cx, ztau, zin
 
       !!------------------------------------------------------------------------------
@@ -235,5 +231,4 @@
       !! * Local declaration
       INTEGER ::   ji, jj, jk ! dummy loop indices
-      REAL(wp) ::   z05cx, ztau, zin
       !!------------------------------------------------------------------------------
 
@@ -268,5 +263,4 @@
       !! * Local declaration
       INTEGER ::   ji, jj, jk ! dummy loop indices
-      REAL(wp) ::   z05cx, ztau, zin
       !!------------------------------------------------------------------------------
 
@@ -298,5 +292,4 @@
       !! * Local declaration
       INTEGER ::   ji, jj, jk ! dummy loop indices
-      REAL(wp) ::   z05cx, ztau, zin
       !!------------------------------------------------------------------------------
 
@@ -330,5 +323,4 @@
       !! * Local declaration
       INTEGER ::   ji, jj, jk ! dummy loop indices
-      REAL(wp) ::   z05cx, ztau, zin
 
       !!------------------------------------------------------------------------------
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcini.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcini.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcini.F90	(revision 2200)
@@ -375,89 +375,84 @@
       END IF
 
-      IF ( ln_vol_cst .OR. lk_dynspg_flt ) THEN
-        ! ... Initialize obcumask and obcvmask for the Force filtering 
-        !     boundary condition in dynspg_flt
-        obcumask(:,:) = umask(:,:,1)
-        obcvmask(:,:) = vmask(:,:,1)
-
-        ! ... Initialize obctmsk on overlap region and obcs. This mask
-        !     is used in obcvol.F90 to calculate cumulate flux E-P. 
-        !     obc Tracer point are outside the domain ( U/V obc points) ==> masked by obctmsk
-        !     - no flux E-P on obcs and overlap region (jpreci = jprecj = 1)
-        obctmsk(:,:) = tmask_i(:,:)     
-
-        IF( lp_obc_east ) THEN
-           ! ... East obc Force filtering mask for the grad D
-           obcumask(nie0  :nie1  ,nje0p1:nje1m1) = 0.e0
-           obcvmask(nie0p1:nie1p1,nje0p1:nje1m1) = 0.e0
-           ! ... set to 0 on East OBC
-           obctmsk(nie0p1:nie1p1,nje0:nje1) = 0.e0
-        END IF
-  
-        IF( lp_obc_west ) THEN
-           ! ... West obc Force filtering mask for the grad D
-           obcumask(niw0:niw1,njw0:njw1) = 0.e0
-           obcvmask(niw0:niw1,njw0:njw1) = 0.e0
-           ! ... set to 0 on West OBC
-           obctmsk(niw0:niw1,njw0:njw1) = 0.e0
-        END IF
-  
-        IF( lp_obc_north ) THEN
-           ! ... North obc Force filtering mask for the grad D
-           obcumask(nin0p1:nin1m1,njn0p1:njn1p1) = 0.e0
-           obcvmask(nin0p1:nin1m1,njn0  :njn1  ) = 0.e0
-           ! ... set to 0 on North OBC
-           obctmsk(nin0:nin1,njn0p1:njn1p1) = 0.e0
-        END IF
-  
-        IF( lp_obc_south ) THEN
-           ! ... South obc Force filtering mask for the grad D
-           obcumask(nis0p1:nis1m1,njs0:njs1) = 0.e0
-           obcvmask(nis0p1:nis1m1,njs0:njs1) = 0.e0
-           ! ... set to 0 on South OBC
-           obctmsk(nis0:nis1,njs0:njs1) = 0.e0
-        END IF
-      ENDIF
-
-      IF ( ln_vol_cst .OR. lk_dynspg_flt  ) THEN
-
-         ! 3.1 Total lateral surface 
-         ! -------------------------
-         obcsurftot = 0.e0
-  
-         IF( lp_obc_east ) THEN ! ... East open boundary lateral surface
-            DO ji = nie0, nie1
-               DO jj = 1, jpj 
-                  obcsurftot = obcsurftot+hu(ji,jj)*e2u(ji,jj)*uemsk(jj,1) * MAX(obctmsk(ji,jj),obctmsk(ji+1,jj) )
-               END DO
+      ! ... Initialize obcumask and obcvmask for the Force filtering 
+      !     boundary condition in dynspg_flt
+      obcumask(:,:) = umask(:,:,1)
+      obcvmask(:,:) = vmask(:,:,1)
+
+      ! ... Initialize obctmsk on overlap region and obcs. This mask
+      !     is used in obcvol.F90 to calculate cumulate flux E-P. 
+      !     obc Tracer point are outside the domain ( U/V obc points) ==> masked by obctmsk
+      !     - no flux E-P on obcs and overlap region (jpreci = jprecj = 1)
+      obctmsk(:,:) = tmask_i(:,:)     
+
+      IF( lp_obc_east ) THEN
+         ! ... East obc Force filtering mask for the grad D
+         obcumask(nie0  :nie1  ,nje0p1:nje1m1) = 0.e0
+         obcvmask(nie0p1:nie1p1,nje0p1:nje1m1) = 0.e0
+         ! ... set to 0 on East OBC
+         obctmsk(nie0p1:nie1p1,nje0:nje1) = 0.e0
+      END IF
+
+      IF( lp_obc_west ) THEN
+         ! ... West obc Force filtering mask for the grad D
+         obcumask(niw0:niw1,njw0:njw1) = 0.e0
+         obcvmask(niw0:niw1,njw0:njw1) = 0.e0
+         ! ... set to 0 on West OBC
+         obctmsk(niw0:niw1,njw0:njw1) = 0.e0
+      END IF
+
+      IF( lp_obc_north ) THEN
+         ! ... North obc Force filtering mask for the grad D
+         obcumask(nin0p1:nin1m1,njn0p1:njn1p1) = 0.e0
+         obcvmask(nin0p1:nin1m1,njn0  :njn1  ) = 0.e0
+         ! ... set to 0 on North OBC
+         obctmsk(nin0:nin1,njn0p1:njn1p1) = 0.e0
+      END IF
+
+      IF( lp_obc_south ) THEN
+         ! ... South obc Force filtering mask for the grad D
+         obcumask(nis0p1:nis1m1,njs0:njs1) = 0.e0
+         obcvmask(nis0p1:nis1m1,njs0:njs1) = 0.e0
+         ! ... set to 0 on South OBC
+         obctmsk(nis0:nis1,njs0:njs1) = 0.e0
+      END IF
+
+      ! 3.1 Total lateral surface 
+      ! -------------------------
+      obcsurftot = 0.e0
+
+      IF( lp_obc_east ) THEN ! ... East open boundary lateral surface
+         DO ji = nie0, nie1
+            DO jj = 1, jpj 
+               obcsurftot = obcsurftot+hu(ji,jj)*e2u(ji,jj)*uemsk(jj,1) * MAX(obctmsk(ji,jj),obctmsk(ji+1,jj) )
             END DO
-         END IF
-  
-         IF( lp_obc_west ) THEN ! ... West open boundary lateral surface
-            DO ji = niw0, niw1
-               DO jj = 1, jpj 
-                  obcsurftot = obcsurftot+hu(ji,jj)*e2u(ji,jj)*uwmsk(jj,1) * MAX(obctmsk(ji,jj),obctmsk(ji+1,jj) )
-               END DO
+         END DO
+      END IF
+
+      IF( lp_obc_west ) THEN ! ... West open boundary lateral surface
+         DO ji = niw0, niw1
+            DO jj = 1, jpj 
+               obcsurftot = obcsurftot+hu(ji,jj)*e2u(ji,jj)*uwmsk(jj,1) * MAX(obctmsk(ji,jj),obctmsk(ji+1,jj) )
             END DO
-         END IF
-
-         IF( lp_obc_north ) THEN ! ... North open boundary lateral surface
-            DO jj = njn0, njn1
-               DO ji = 1, jpi
-                  obcsurftot = obcsurftot+hv(ji,jj)*e1v(ji,jj)*vnmsk(ji,1) * MAX(obctmsk(ji,jj),obctmsk(ji,jj+1) )
-               END DO
+         END DO
+      END IF
+
+      IF( lp_obc_north ) THEN ! ... North open boundary lateral surface
+         DO jj = njn0, njn1
+            DO ji = 1, jpi
+               obcsurftot = obcsurftot+hv(ji,jj)*e1v(ji,jj)*vnmsk(ji,1) * MAX(obctmsk(ji,jj),obctmsk(ji,jj+1) )
             END DO
-         END IF
-  
-         IF( lp_obc_south ) THEN ! ... South open boundary lateral surface
-            DO jj = njs0, njs1
-               DO ji = 1, jpi
-                  obcsurftot = obcsurftot+hv(ji,jj)*e1v(ji,jj)*vsmsk(ji,1) * MAX(obctmsk(ji,jj),obctmsk(ji,jj+1) )
-               END DO
+         END DO
+      END IF
+
+      IF( lp_obc_south ) THEN ! ... South open boundary lateral surface
+         DO jj = njs0, njs1
+            DO ji = 1, jpi
+               obcsurftot = obcsurftot+hv(ji,jj)*e1v(ji,jj)*vsmsk(ji,1) * MAX(obctmsk(ji,jj),obctmsk(ji,jj+1) )
             END DO
-         END IF
-  
-         IF( lk_mpp )   CALL mpp_sum( obcsurftot )   ! sum over the global domain
-      ENDIF
+         END DO
+      END IF
+
+      IF( lk_mpp )   CALL mpp_sum( obcsurftot )   ! sum over the global domain
 
       ! 5. Control print on mask 
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcrad.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcrad.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcrad.F90	(revision 2200)
@@ -115,5 +115,5 @@
       ! -------------------
 
-      IF( kt > nit000 ) THEN 
+      IF( kt > nit000 .OR. ln_rstart ) THEN 
 
          ! ... advance in time (time filter, array swap) 
@@ -379,5 +379,5 @@
       ! -------------------
 
-      IF( kt > nit000 ) THEN
+      IF( kt > nit000 .OR. ln_rstart ) THEN
 
          ! ... advance in time (time filter, array swap) 
@@ -648,5 +648,5 @@
       ! -------------------
 
-      IF( kt > nit000 ) THEN 
+      IF( kt > nit000 .OR. ln_rstart ) THEN 
 
          ! ... advance in time (time filter, array swap)
@@ -922,5 +922,5 @@
       ! --------------------
   
-      IF( kt > nit000) THEN 
+      IF( kt > nit000 .OR. ln_rstart ) THEN 
 
          ! ... advance in time (time filter, array swap)
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcrst.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcrst.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/OBC/obcrst.F90	(revision 2200)
@@ -278,5 +278,5 @@
       !! * Local declarations
       INTEGER ::   inum = 11            ! temporary logical unit
-      INTEGER ::   ji,jj,jk,ios
+      INTEGER ::   ji,jj,jk
       INTEGER ::   ino0,it0,nbobc0,jpieob0,jpiwob0,jpjnob0,jpjsob0
       INTEGER ::   ino1,it1,nbobc1,jpieob1,jpiwob1,jpjnob1,jpjsob1
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcana.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcana.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/SBC/sbcana.F90	(revision 2200)
@@ -88,10 +88,11 @@
          !
          nn_tau000 = MAX( nn_tau000, 1 )   ! must be >= 1
-         qns   (:,:) = rn_qns0
-         qsr   (:,:) = rn_qsr0
-         emp   (:,:) = rn_emp0
-         emps  (:,:) = rn_emp0
          !
       ENDIF
+
+      qns   (:,:) = rn_qns0
+      qsr   (:,:) = rn_qsr0
+      emp   (:,:) = rn_emp0
+      emps  (:,:) = rn_emp0
    
       ! Increase the surface stress to its nominal value during the first nn_tau000 time-steps
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/opa.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/opa.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/opa.F90	(revision 2200)
@@ -175,12 +175,11 @@
       !                             !--------------------------------------------!
 #if defined key_iomput
+      IF( Agrif_Root() ) THEN
 # if defined key_oasis3 || defined key_oasis4
-      CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis
-      CALL init_ioclient()                    ! io_server will get its communicators (if needed) from oasis (we don't see it)
-# else
-      CALL init_ioclient( ilocal_comm )       ! nemo local communicator (used or not) given by the io_server
+         CALL cpl_prism_init( ilocal_comm )   ! nemo local communicator given by oasis
 # endif
+         CALL  init_ioclient( ilocal_comm )   ! exchange io_server nemo local communicator with the io_server
+      ENDIF
       narea = mynode( cltxt, ilocal_comm )    ! Nodes selection
-
 #else
 # if defined key_oasis3 || defined key_oasis4
Index: /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/step.F90
===================================================================
--- /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/step.F90	(revision 2199)
+++ /branches/DEV_r2106_LOCEAN2010/NEMO/OPA_SRC/step.F90	(revision 2200)
@@ -82,7 +82,6 @@
 #endif   
                              indic = 0                ! reset to no error condition
-      IF( kstp /= nit000 )   CALL day      ( kstp )   ! Calendar (day was already called at nit000 in day_init)
+      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init)
                              CALL iom_setkt( kstp )   ! say to iom that we are at time step kstp
-                             CALL rst_opn  ( kstp )   ! Open the restart file
 
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
