Index: TOOLS/MOSAIX/CreateOasisGrids.bash
===================================================================
--- TOOLS/MOSAIX/CreateOasisGrids.bash	(revision 3671)
+++ TOOLS/MOSAIX/CreateOasisGrids.bash	(revision 3686)
@@ -67,4 +67,5 @@
 ## Command line parameters
 ## ===========================================================================
+set -e
 set -o verbose
 set -o xtrace
@@ -106,5 +107,5 @@
 ## ===========================================================================
 [[ -f ${OCE}_coordinates_mask.nc ]] || cp ${R_IN}/OCE/NEMO/${OCE}/${OCE}_coordinates_mask.nc  .
-[[ -f ${ATM}_grid.nc             ]] || cp ${R_IN}/ATM/${ATM}/${ATM}_grid.nc                   .
+[[ -f ${ATM}_grid.nc             ]] || cp ${R_IN}/ATM/GRID/${ATM}_grid.nc                   .
 
 #
@@ -129,8 +130,8 @@
 
 for OCEGRID in T U V ; do
-    ncks --fl_fmt=${FL_FMT} -C --history --append -v nav_lon_grid_${OCEGRID},nav_lat_grid_${OCEGRID},bounds_lon_grid_${OCEGRID},bounds_lat_grid_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT}.nc grids_${CplModel}.nc
-    ncks --fl_fmt=${FL_FMT} -C --history --append -v area_grid_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT}.nc areas_${CplModel}.nc
+    ncks --fl_fmt=${FL_FMT} -C --history --append --variable nav_lon_grid_${OCEGRID},nav_lat_grid_${OCEGRID},bounds_lon_grid_${OCEGRID},bounds_lat_grid_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT}.nc grids_${CplModel}.nc
+    ncks --fl_fmt=${FL_FMT} -C --history --append --variable area_grid_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT}.nc areas_${CplModel}.nc
     # Inverts mask values and switch to integer
-    ncks --fl_fmt=${FL_FMT} --history -C -v mask_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT}.nc mask_${OCEGRID}_tmp.nc
+    ncks --fl_fmt=${FL_FMT} --history -C --variable mask_${OCEGRID} ${OCE}_coordinates_mask_${FL_FMT}.nc mask_${OCEGRID}_tmp.nc
     ncatted --history \
 	    --attribute coordinates,mask_${OCEGRID},d,,         \
@@ -139,5 +140,5 @@
     mask_${OCEGRID}_tmp.nc
     
-    ncap2 --fl_fmt=${FL_FMT} --history --append -s "mask_${OCEGRID}=int(1-mask_${OCEGRID});"    mask_${OCEGRID}_tmp.nc masks_${CplModel}.nc
+    ncap2 --fl_fmt=${FL_FMT} --history --append --script "mask_${OCEGRID}=int(1-mask_${OCEGRID});"    mask_${OCEGRID}_tmp.nc masks_${CplModel}.nc
     ncatted --history \
 	    --attribute long_name,mask_${OCEGRID},o,c,"Land-sea mask" \
@@ -148,17 +149,17 @@
 done
 
-ncks --history --append -v lon,lat ${ATM}_grid_maskFrom_${OCE}_${FL_FMT}.nc grids_${CplModel}.nc
+ncks --history --append --variable lon,lat ${ATM}_grid_maskFrom_${OCE}_${FL_FMT}.nc grids_${CplModel}.nc
 
 #
 # We need to have different names for dimensions and variables
 # ----------------------------------------------------------------------------
-ncrename --history -v lon,alon   grids_${CplModel}.nc
-ncrename --history -v lat,alat   grids_${CplModel}.nc
+ncrename --history --variable lon,alon   grids_${CplModel}.nc
+ncrename --history --variable lat,alat   grids_${CplModel}.nc
 
 if [[ ${ATM} = dynamico* || ${ATM} = ICO* ]] ; then 
-    ncks --fl_fmt=${FL_FMT} --history --append -v bounds_lon,bounds_lat ${ATM}_grid_maskFrom_${OCE}_${FL_FMT}.nc grids_${CplModel}.nc
+    ncks --fl_fmt=${FL_FMT} --history --append --variable bounds_lon,bounds_lat ${ATM}_grid_maskFrom_${OCE}_${FL_FMT}.nc grids_${CplModel}.nc
 fi
 
-ncks --fl_fmt=${FL_FMT} --history -C --append -v aire   ${ATM}_grid_maskFrom_${OCE}_${FL_FMT}.nc areas_${CplModel}.nc
+ncks --fl_fmt=${FL_FMT} --history -C --append --variable aire   ${ATM}_grid_maskFrom_${OCE}_${FL_FMT}.nc areas_${CplModel}.nc
 ncatted --history --attribute coordinates,aire,d,,     \
 	--attribute _FillValue,aire,d,,                \
@@ -169,5 +170,5 @@
 	areas_${CplModel}.nc
 
-ncks --fl_fmt=${FL_FMT} --history -C -v OceMask         ${ATM}_grid_maskFrom_${OCE}_${FL_FMT}.nc OceMask_tmp.nc
+ncks --fl_fmt=${FL_FMT} --history -C --variable OceMask         ${ATM}_grid_maskFrom_${OCE}_${FL_FMT}.nc OceMask_tmp.nc
 ncatted --history \
 	--attribute coordinates,OceMask,d,,         \
@@ -176,5 +177,5 @@
 	--attribute missing_value,OceMask,d,,       \
 	OceMask_tmp.nc
-ncap2 --fl_fmt=${FL_FMT} --history --append -s "OceMask=int(1-OceMask)"            OceMask_tmp.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1
+ncap2 --fl_fmt=${FL_FMT} --history --append --script "OceMask=int(1-OceMask)"            OceMask_tmp.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1
 ncatted --history \
 	--attribute long_name,OceMask,o,c,"Land-sea mask"   \
@@ -186,15 +187,15 @@
 
 if [[ ${atm} = *dynamico* || ${atm} = ico* ]] ; then
-    ncrename --history -d cell,ycell grids_${CplModel}.nc
-    ncrename --history -d cell,ycell areas_${CplModel}.nc
-    ncrename --history -d cell,ycell masks_${CplModel}.nc
+    ncrename --history --dimension cell,ycell grids_${CplModel}.nc
+    ncrename --history --dimension cell,ycell areas_${CplModel}.nc
+    ncrename --history --dimension cell,ycell masks_${CplModel}.nc
 fi
 # if [[ ${atm} = *lmd* ]] ; then
-#     ncrename -d lon,tlmdlon  grids_${CplModel}.nc
-#     ncrename -d lat,tlmdlat  grids_${CplModel}.nc
-#     ncrename -d lon,tlmdlon  masks_${CplModel}.nc
-#     ncrename -d lat,tlmdlat  masks_${CplModel}.nc
-#     ncrename -d lon,tlmdlon  areas_${CplModel}.nc
-#     ncrename -d lat,tlmdlat  areas_${CplModel}.nc
+#     ncrename --dimension lon,tlmdlon  grids_${CplModel}.nc
+#     ncrename --dimension lat,tlmdlat  grids_${CplModel}.nc
+#     ncrename --dimension lon,tlmdlon  masks_${CplModel}.nc
+#     ncrename --dimension lat,tlmdlat  masks_${CplModel}.nc
+#     ncrename --dimension lon,tlmdlon  areas_${CplModel}.nc
+#     ncrename --dimension lat,tlmdlat  areas_${CplModel}.nc
 # fi
 
@@ -219,11 +220,11 @@
 EOF
     
-    ncap2 --fl_fmt=${FL_FMT} --history --append -S add_dim.nco  grids_${CplModel}_tmp.nc grids_${CplModel}.nc
+    ncap2 --fl_fmt=${FL_FMT} --history --append --script-file add_dim.nco  grids_${CplModel}_tmp.nc grids_${CplModel}.nc
     
     mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc
-    ncap2 --fl_fmt=${FL_FMT} --history --append -s 'defdim("xcell",1) ; OceMask[time_counter,ycell,xcell]=OceMask(:,:)'  masks_${CplModel}_tmp.nc masks_${CplModel}.nc
+    ncap2 --fl_fmt=${FL_FMT} --history --append --script 'defdim("xcell",1) ; OceMask[time_counter,ycell,xcell]=OceMask(:,:)'  masks_${CplModel}_tmp.nc masks_${CplModel}.nc
 
     mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc
-    ncap2 --fl_fmt=${FL_FMT} --history --append -s 'defdim("xcell",1) ; aire[ycell,xcell]=aire(:) ; '                       areas_${CplModel}_tmp.nc areas_${CplModel}.nc
+    ncap2 --fl_fmt=${FL_FMT} --history --append --script 'defdim("xcell",1) ; aire[ycell,xcell]=aire(:) ; '                       areas_${CplModel}_tmp.nc areas_${CplModel}.nc
 fi
 
@@ -235,5 +236,5 @@
     # -----------------------------------------------------------------------
     mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc
-    ncap2 --fl_fmt=${FL_FMT} --history --append -s "alon[lat,lon]=alon; alat[lat,lon]=alat"  grids_${CplModel}_tmp.nc grids_${CplModel}.nc
+    ncap2 --fl_fmt=${FL_FMT} --history --append --script "alon[lat,lon]=alon; alat[lat,lon]=alat"  grids_${CplModel}_tmp.nc grids_${CplModel}.nc
     ncatted --history \
 	    --attribute long_name,alon,o,c,"Longitude"    \
@@ -270,19 +271,20 @@
 EOF
     mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc
-    ncap2 --fl_fmt=${FL_FMT} --history -S add_bounds.nco -O grids_${CplModel}_tmp.nc grids_${CplModel}.nc
+    ncap2 --fl_fmt=${FL_FMT} --history --script-file add_bounds.nco -O grids_${CplModel}_tmp.nc grids_${CplModel}.nc
 fi
 
 #
-# Generates grid "aone" : same as t-ocean grid, with surfaces set to 1
+# Generates grid "o${atm}e" : same as t${atm} grid, with surfaces set to 1
+# and mask to 0 (ocean everywhere, to compute integral over the whole grid))
 # This grid is used when field are quantities instead of fluxes (i.e river flow)
 # ----------------------------------------------------------------------------
 mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc
-ncap2 --fl_fmt=${FL_FMT} --history -s "aone_lon=alon; aone_lat=alat; bounds_aone_lon=bounds_lon; bounds_aone_lat=bounds_lat; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc
+ncap2 --fl_fmt=${FL_FMT} --history --script "o${atm}_lon=alon; o${atm}_lat=alat; bounds_o${atm}_lon=bounds_lon; bounds_o${atm}_lat=bounds_lat; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc
 
 mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc
-ncap2 --fl_fmt=${FL_FMT} --history -s "aone_aire=aire*0+1; " areas_${CplModel}_tmp.nc areas_${CplModel}.nc
+ncap2 --fl_fmt=${FL_FMT} --history --script "o${atm}_aire=aire*0.0d+1.0d; "   areas_${CplModel}_tmp.nc areas_${CplModel}.nc
 
 mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc
-ncap2 --fl_fmt=${FL_FMT} --history -s "aone_mask=int(OceMask); " masks_${CplModel}_tmp.nc masks_${CplModel}.nc
+ncap2 --fl_fmt=${FL_FMT} --history --script "o${atm}_mask=int(OceMask)*0+0; " masks_${CplModel}_tmp.nc masks_${CplModel}.nc
 
 #
@@ -292,10 +294,10 @@
 do
     ocegrid=${OCEGRID~} # To lowercase
-    ncrename --history -v nav_lon_grid_${OCEGRID},${ocegrid}${oce}.lon     grids_${CplModel}.nc
-    ncrename --history -v nav_lat_grid_${OCEGRID},${ocegrid}${oce}.lat     grids_${CplModel}.nc
-    ncrename --history -v bounds_lon_grid_${OCEGRID},${ocegrid}${oce}.clo  grids_${CplModel}.nc
-    ncrename --history -v bounds_lat_grid_${OCEGRID},${ocegrid}${oce}.cla  grids_${CplModel}.nc
-    ncrename --history -v mask_${OCEGRID},${ocegrid}${oce}.msk             masks_${CplModel}.nc
-    ncrename --history -v area_grid_${OCEGRID},${ocegrid}${oce}.srf        areas_${CplModel}.nc
+    ncrename --history --variable nav_lon_grid_${OCEGRID},${ocegrid}${oce}.lon     grids_${CplModel}.nc
+    ncrename --history --variable nav_lat_grid_${OCEGRID},${ocegrid}${oce}.lat     grids_${CplModel}.nc
+    ncrename --history --variable bounds_lon_grid_${OCEGRID},${ocegrid}${oce}.clo  grids_${CplModel}.nc
+    ncrename --history --variable bounds_lat_grid_${OCEGRID},${ocegrid}${oce}.cla  grids_${CplModel}.nc
+    ncrename --history --variable mask_${OCEGRID},${ocegrid}${oce}.msk             masks_${CplModel}.nc
+    ncrename --history --variable area_grid_${OCEGRID},${ocegrid}${oce}.srf        areas_${CplModel}.nc
     
     ncatted --history \
@@ -306,17 +308,17 @@
 done
 
-ncrename --history -v alon,t${atm}.lon           grids_${CplModel}.nc
-ncrename --history -v alat,t${atm}.lat           grids_${CplModel}.nc
-ncrename --history -v aone_lon,o${atm}.lon       grids_${CplModel}.nc
-ncrename --history -v aone_lat,o${atm}.lat       grids_${CplModel}.nc
-ncrename --history -v OceMask,t${atm}.msk        masks_${CplModel}.nc
-ncrename --history -v aone_mask,o${atm}.msk      masks_${CplModel}.nc
-ncrename --history -v aire,t${atm}.srf           areas_${CplModel}.nc
-ncrename --history -v aone_aire,o${atm}.srf      areas_${CplModel}.nc
-
-ncrename --history -v bounds_lon,t${atm}.clo        grids_${CplModel}.nc
-ncrename --history -v bounds_lat,t${atm}.cla        grids_${CplModel}.nc
-ncrename --history -v bounds_aone_lon,o${atm}.clo   grids_${CplModel}.nc
-ncrename --history -v bounds_aone_lat,o${atm}.cla   grids_${CplModel}.nc
+ncrename --history --variable alon,t${atm}.lon                grids_${CplModel}.nc
+ncrename --history --variable alat,t${atm}.lat                grids_${CplModel}.nc
+ncrename --history --variable o${atm}_lon,o${atm}.lon         grids_${CplModel}.nc
+ncrename --history --variable o${atm}_lat,o${atm}.lat         grids_${CplModel}.nc
+ncrename --history --variable OceMask,t${atm}.msk             masks_${CplModel}.nc
+ncrename --history --variable o${atm}_mask,o${atm}.msk        masks_${CplModel}.nc
+ncrename --history --variable aire,t${atm}.srf                areas_${CplModel}.nc
+ncrename --history --variable o${atm}_aire,o${atm}.srf        areas_${CplModel}.nc
+
+ncrename --history --variable bounds_lon,t${atm}.clo          grids_${CplModel}.nc
+ncrename --history --variable bounds_lat,t${atm}.cla          grids_${CplModel}.nc
+ncrename --history --variable bounds_o${atm}_lon,o${atm}.clo  grids_${CplModel}.nc
+ncrename --history --variable bounds_o${atm}_lat,o${atm}.cla  grids_${CplModel}.nc
 
 for atmgrid in t o ; do
@@ -324,5 +326,5 @@
 	    --attribute bounds,${atmgrid}${atm}.lon,c,c,"${atmgrid}${atm}.clo"   \
 	    --attribute bounds,${atmgrid}${atm}.lat,c,c,"${atmgrid}${atm}.cla"   \
-	    --attribute units,${atmgrid}${atm}.clo,o,c,"degrees_east"         \
+	    --attribute units,${atmgrid}${atm}.clo,o,c,"degrees_east"            \
 	    --attribute units,${atmgrid}${atm}.cla,o,c,"degrees_north"        grids_${CplModel}.nc
 done
@@ -389,7 +391,7 @@
 for OCEGRID in T U V ; do
     ocegrid=${OCEGRID~} # Downcase name of grids
-    ncrename --history -d  x_grid_${OCEGRID},x${ocegrid}${oce}         grids_${CplModel}.nc
-    ncrename --history -d  y_grid_${OCEGRID},y${ocegrid}${oce}         grids_${CplModel}.nc
-    ncrename --history -d  nvertex_grid_${OCEGRID},crn${ocegrid}${oce} grids_${CplModel}.nc
+    ncrename --history --dimension  x_grid_${OCEGRID},x${ocegrid}${oce}         grids_${CplModel}.nc
+    ncrename --history --dimension  y_grid_${OCEGRID},y${ocegrid}${oce}         grids_${CplModel}.nc
+    ncrename --history --dimension  nvertex_grid_${OCEGRID},crn${ocegrid}${oce} grids_${CplModel}.nc
 done
 
Index: TOOLS/MOSAIX/CreateRestartAtm4Oasis.bash
===================================================================
--- TOOLS/MOSAIX/CreateRestartAtm4Oasis.bash	(revision 3671)
+++ TOOLS/MOSAIX/CreateRestartAtm4Oasis.bash	(revision 3686)
@@ -100,6 +100,6 @@
 ## Extract variables
 ## ===========================================================================
-ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 -v lon,lat,sols,soll,fract_oce,fract_sic,precip,snow,evap_sic,evap_oce,wind10m,taux_oce,tauy_oce,taux_sic,tauy_sic ${AtmFile} flxat_fields.nc
-ncwa --overwrite --fl_fmt=${FL_FMT} --history -a time_counter flxat_fields.nc flxat_fields_notime.nc # remove time dimension 
+ncks --overwrite --fl_fmt=${FL_FMT} --history --dimension time_counter,0,0 --variable lon,lat,sols,soll,fract_oce,fract_sic,precip,snow,evap_sic,evap_oce,wind10m,taux_oce,tauy_oce,taux_sic,tauy_sic ${AtmFile} flxat_fields.nc
+ncwa --overwrite --fl_fmt=${FL_FMT} --history --average time_counter flxat_fields.nc flxat_fields_notime.nc # remove time dimension 
 ncatted --history --attribute history,global,d,c,""  flxat_fields_notime.nc          # cleaning of history attributes
 
@@ -114,5 +114,5 @@
     ico_nbp=$( echo "sqrt(($dim_cell-2)/10)+1" | bc -l | sed 's/\..*//' )
     ATM=ICO${ico_nbp}
-    ncrename --history -d cell,y flxat_fields_notime.nc
+    ncrename --history --dimension cell,y flxat_fields_notime.nc
 cat <<EOF > add_dim.nco
 defdim("x",1) ;
@@ -133,5 +133,5 @@
 tauy_sic [y,x] = tauy_sic  ;
 EOF
-    ncap2 --history --overwrite --fl_fmt=${FL_FMT} -S add_dim.nco flxat_fields_notime.nc tmp_flxat_fields_notime.nc
+    ncap2 --history --overwrite --fl_fmt=${FL_FMT} --script-file add_dim.nco flxat_fields_notime.nc tmp_flxat_fields_notime.nc
     mv tmp_flxat_fields_notime.nc flxat_fields_notime.nc
 
@@ -147,11 +147,11 @@
     dim_lat=$(ncdump -h flxat_fields_notime.nc | grep "lat *=" | awk '{print $3}' )
     dim_lon=$(ncdump -h flxat_fields_notime.nc | grep "lon *=" | awk '{print $3}' )
-    ncrename --history -d lon,x flxat_fields_notime.nc
-    ncrename --history -d lat,y flxat_fields_notime.nc
+    ncrename --history --dimension lon,x flxat_fields_notime.nc
+    ncrename --history --dimension lat,y flxat_fields_notime.nc
 cat <<EOF > add_dim.nco
 lon[y,x] = lon ;
 lat[y,x] = lat ;
 EOF
-    ncap2 --history --overwrite --fl_fmt=${FL_FMT} -S add_dim.nco flxat_fields_notime.nc tmp_flxat_fields_notime.nc
+    ncap2 --history --overwrite --fl_fmt=${FL_FMT} --script-file add_dim.nco flxat_fields_notime.nc tmp_flxat_fields_notime.nc
     mv tmp_flxat_fields_notime.nc flxat_fields_notime.nc
     (( dim_lat = dim_lat - 1 ))
@@ -216,9 +216,9 @@
 //
 EOF
-ncap2 --overwrite --fl_fmt=${FL_FMT} -h -S create_flxat.nco flxat_fields_notime.nc tmp_flxat.nc
+ncap2 --overwrite --fl_fmt=${FL_FMT} --history --script-file create_flxat.nco flxat_fields_notime.nc tmp_flxat.nc
  
-ncks --fl_fmt=${FL_FMT} --overwrite -h -v lon,lat tmp_flxat.nc flxat.nc
-[[ ${IsUnstructured} = yes ]] && ncks --fl_fmt=${FL_FMT} --append -v bounds_lon,bounds_lat tmp_flxat.nc flxat.nc
-ncks --fl_fmt=${FL_FMT} --append  -h -v COTAUXXU,COTAUYYU,COTAUZZU,COTAUXXV,COTAUYYV,COTAUZZV,COTOTRAI,COTOTSNO,COTOTEVA,COICEVAP,COQSRMIX,COQNSMIX,COSHFICE,CONSFICE,CODFLXDT,COCALVIN,COLIQRUN,COWINDSP,COTAUMOD tmp_flxat.nc flxat.nc
+ncks --fl_fmt=${FL_FMT} --overwrite --history --variable lon,lat tmp_flxat.nc flxat.nc
+[[ ${IsUnstructured} = yes ]] && ncks --fl_fmt=${FL_FMT} --history --append --variable bounds_lon,bounds_lat tmp_flxat.nc flxat.nc
+ncks --fl_fmt=${FL_FMT} --append --history --variable COTAUXXU,COTAUYYU,COTAUZZU,COTAUXXV,COTAUYYV,COTAUZZV,COTOTRAI,COTOTSNO,COTOTEVA,COICEVAP,COQSRMIX,COQNSMIX,COSHFICE,CONSFICE,CODFLXDT,COCALVIN,COLIQRUN,COWINDSP,COTAUMOD tmp_flxat.nc flxat.nc
 
 ##
@@ -262,6 +262,6 @@
 ## ===========================================================================
 mv flxat.nc flxat_${ATM}_maskFrom_${OCE}.nc
-ncks -v COCALVIN flxat_${ATM}_maskFrom_${OCE}.nc icbrg_${ATM}_maskFrom_${OCE}.nc
-ncks -v COCALVIN flxat_${ATM}_maskFrom_${OCE}.nc icshf_${ATM}_maskFrom_${OCE}.nc
+ncks --history --variable COCALVIN flxat_${ATM}_maskFrom_${OCE}.nc icbrg_${ATM}_maskFrom_${OCE}.nc
+ncks --history --variable COCALVIN flxat_${ATM}_maskFrom_${OCE}.nc icshf_${ATM}_maskFrom_${OCE}.nc
 
 ##
Index: TOOLS/MOSAIX/CreateRestartOce4Oasis.bash
===================================================================
--- TOOLS/MOSAIX/CreateRestartOce4Oasis.bash	(revision 3671)
+++ TOOLS/MOSAIX/CreateRestartOce4Oasis.bash	(revision 3686)
@@ -104,8 +104,8 @@
 ## Extract variables
 ## ===========================================================================
-ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 -v ${IceVar} ${IceFile} sstoce_fields.nc
-ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 -v tos       ${OceFile} oce_fields.nc
+ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 --variable ${IceVar} ${IceFile} sstoce_fields.nc
+ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 --variable tos       ${OceFile} oce_fields.nc
 ncks --append --fl_fmt=${FL_FMT} --history oce_fields.nc   sstoce_fields.nc
-ncwa --overwrite --fl_fmt=${FL_FMT} --history -a time_counter sstoce_fields.nc sstoce_fields_notime.nc # Remove time dimension
+ncwa --overwrite --fl_fmt=${FL_FMT} --history --average time_counter sstoce_fields.nc sstoce_fields_notime.nc # Remove time dimension
 ncatted --history --attribute history,global,d,c,""  sstoce_fields_notime.nc           # Clean attributes
 
@@ -126,11 +126,11 @@
 
 cat <<EOF > create_sstoce.nco
-OIceFrac       = double ( ${IceVar}(:,:) ) ; 
+OIceFrc        = double ( ${IceVar}(:,:) ) ; 
 //tos.simple_fill_miss(tos)               ;
-O_SSTSST[y,x]  = double ( (tos   (:,:) + 273.15d) * (1.0d-OIceFrac) ) ;
-//O_AlbIce[y,x]  = double ( ialb   (:,:)            * OIceFrac(:,:)   ) ;
-//O_TepIce[y,x]  = double ( (tsice (:,:) + 273.15d) * OIceFrac(:,:)   ) ;
-O_AlbIce[y,x]  = double (   0.65d            * OIceFrac(:,:)   ) ;
-O_TepIce[y,x]  = double ( (-20.0d + 273.15d) * OIceFrac(:,:)   ) ;
+O_SSTSST[y,x]  = double ( (tos   (:,:) + 273.15d) * (1.0d-OIceFrc) ) ;
+//O_AlbIce[y,x]  = double ( ialb   (:,:)            * OIceFrc(:,:)   ) ;
+//O_TepIce[y,x]  = double ( (tsice (:,:) + 273.15d) * OIceFrc(:,:)   ) ;
+O_AlbIce[y,x]  = double (   0.65d            * OIceFrc(:,:)   ) ;
+O_TepIce[y,x]  = double ( (-20.0d + 273.15d) * OIceFrc(:,:)   ) ;
 O_OCurx1[y,x]  = 0.0d ;
 O_OCury1[y,x]  = 0.0d ;
@@ -138,7 +138,7 @@
 EOF
 
-ncap2 --overwrite --fl_fmt=${FL_FMT} --history -S create_sstoce.nco sstoce_fields_notime.nc tmp_sstoc.nc
+ncap2 --overwrite --fl_fmt=${FL_FMT} --history --script-file create_sstoce.nco sstoce_fields_notime.nc tmp_sstoc.nc
 
-ncks --fl_fmt=${FL_FMT} --overwrite --history -v OIceFrac,O_SSTSST,O_AlbIce,O_TepIce,O_OCurx1,O_OCury1,O_OCurz1 tmp_sstoc.nc sstoc.nc
+ncks --fl_fmt=${FL_FMT} --overwrite --history --variable OIceFrc,O_SSTSST,O_AlbIce,O_TepIce,O_OCurx1,O_OCury1,O_OCurz1 tmp_sstoc.nc sstoc.nc
 
 ncatted --history --attribute comment,O_SSTSST,o,c,"SST weighted by fraction of open ocean"          sstoc.nc
Index: TOOLS/MOSAIX/CreateWeightsMask.bash
===================================================================
--- TOOLS/MOSAIX/CreateWeightsMask.bash	(revision 3671)
+++ TOOLS/MOSAIX/CreateWeightsMask.bash	(revision 3686)
@@ -44,6 +44,6 @@
 # Defines models
 # ==============
-#OCE=ORCA2.3
-OCE=eORCA1.2
+OCE=ORCA2.3
+#OCE=eORCA1.2
 #OCE=ORCA025
 
@@ -77,9 +77,7 @@
     ( curie | irene )
     set +vx
-    module unload cdo nco ferret
-    module unload netcdf hdf5
-    module load python # /2.7.12
-    module load netcdf/4.3.3.1_hdf5_parallel # Version for XIOS
-    module load nco
+    module purge
+    source /ccc/cont003/home/dsm/p86ipsl/.env_intel17.0.2_curie;
+    source /ccc/cont003/home/dsm/p86ipsl/.env_netcdf4.3.3.1_curie
     R_IN=$(ccc_home -u igcmg --cccwork)/IGCM
     TMPDIR=${SCRATCHDIR}/TMP
@@ -169,7 +167,7 @@
 ## ===========================================================================
 cp dia_t${oce}_to_t${atm}_1storder.nc  dia_t${oce}_to_t${atm}_1storder_mask.nc
-ncks --alphabetize --history --overwrite -v OceFrac dia_t${oce}_to_t${atm}_1storder_mask.nc  ${ATM}_grid_maskFrom_${OCE}.nc
-ncks --alphabetize --history --append    -v aire    atm_grid.nc                              ${ATM}_grid_maskFrom_${OCE}.nc
-[[ ${atm} = *ico* ]] && ncks --alphabetize --history --append -v bounds_lon,bounds_lat atm_grid.nc                              ${ATM}_grid_maskFrom_${OCE}.nc
+ncks --alphabetize --history --overwrite --variable OceFrac dia_t${oce}_to_t${atm}_1storder_mask.nc  ${ATM}_grid_maskFrom_${OCE}.nc
+ncks --alphabetize --history --append    --variable aire    atm_grid.nc                              ${ATM}_grid_maskFrom_${OCE}.nc
+[[ ${atm} = *ico* ]] && ncks --alphabetize --history --append --variable bounds_lon,bounds_lat atm_grid.nc                              ${ATM}_grid_maskFrom_${OCE}.nc
 
 cat <<EOF > creation_masque.nco
@@ -178,7 +176,7 @@
 EOF
 ncap2 --history --overwrite --script-file creation_masque.nco dia_t${oce}_to_t${atm}_1storder_mask.nc tmp_dia_t${oce}_to_t${atm}_1storder_mask.nc ; mv tmp_dia_t${oce}_to_t${atm}_1storder_mask.nc dia_t${oce}_to_t${atm}_1storder_mask.nc
-ncrename --history -v OceFrac,OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc
-
-ncks --alphabetize --history --append  -v OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc   ${ATM}_grid_maskFrom_${OCE}.nc
+ncrename --history --variable OceFrac,OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc
+
+ncks --alphabetize --history --append --variable OceMask dia_t${oce}_to_t${atm}_1storder_mask.nc   ${ATM}_grid_maskFrom_${OCE}.nc
 
 
@@ -276,6 +274,6 @@
 OceMask [time_counter,cell] = OceMask (:) ;
 EOF
-    ncap2 -O --history --script-file add_time.nco   ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc
-    ncks --alphabetize -O --mk_rec time_counter ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc
+    ncap2 --overwrite --history --script-file add_time.nco   ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc
+    ncks --alphabetize --overwrite --mk_rec time_counter ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc
     ncatted --history \
 	    -a coordinates,OceFrac,c,c,"time_counter cell" \
@@ -289,6 +287,6 @@
 OceMask [time_counter,lat,lon] = OceMask (:,:) ;
 EOF
-    ncap2 -O --history --script-file add_time.nco   ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc
-    ncks --alphabetize -O --mk_rec time_counter ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc
+    ncap2 --overwrite --history --script-file add_time.nco   ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc
+    ncks --alphabetize --overwrite --mk_rec time_counter ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc
     ncatted --history \
 	    -a coordinates,OceFrac,c,c,"time_counter lat lon" \
@@ -452,7 +450,7 @@
 	    ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_a_to_o}
 	    
-	    ncks --alphabetize --history --overwrite  -v src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_o_to_a} rmp_tmp.nc
+	    ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_o_to_a} rmp_tmp.nc
 	    mv rmp_tmp.nc ${file_o_to_a}
-	    ncks --alphabetize --history --overwrite  -v src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_a_to_o} rmp_tmp.nc
+	    ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_a_to_o} rmp_tmp.nc
 	    mv rmp_tmp.nc ${file_a_to_o}
 
@@ -490,7 +488,7 @@
 	    ncap2 --history --append --script-file add_varatm.nco ${ATM}_grid_maskFrom_${OCE}.nc ${file_a_to_o}
 
-	    ncks --alphabetize --history --overwrite  -v src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_area,dst_grid_imask ${file_o_to_a} rmp_tmp.nc
+	    ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_corner_lon,src_grid_corner_lat,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_area,dst_grid_imask ${file_o_to_a} rmp_tmp.nc
 	    mv rmp_tmp.nc ${file_o_to_a}
-	    ncks --alphabetize --history --overwrite  -v src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_a_to_o} rmp_tmp.nc
+	    ncks --alphabetize --history --overwrite --variable src_address,dst_address,remap_matrix,src_grid_dims,src_grid_center_lat,src_grid_center_lon,src_grid_area,src_grid_imask,dst_grid_dims,dst_grid_center_lat,dst_grid_center_lon,dst_grid_corner_lon,dst_grid_corner_lat,dst_grid_area,dst_grid_imask ${file_a_to_o} rmp_tmp.nc
 	    mv rmp_tmp.nc ${file_a_to_o}
 
