Index: TOOLS/MOSAIX/CalvingWeights.py
===================================================================
--- TOOLS/MOSAIX/CalvingWeights.py	(revision 4183)
+++ TOOLS/MOSAIX/CalvingWeights.py	(revision 4186)
@@ -43,5 +43,5 @@
 parser.add_argument ('--repartition_var' , help='Variable name for iceshelf'      , type=str, default=None)
 parser.add_argument ('--output'  , help='output rmp file name', default='rmp_tlmd_to_torc_calving_64bit.nc' )
-parser.add_argument ('--fmt'     , help='NetCDF file format, using nco syntax', default='64bits', choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] )
+parser.add_argument ('--fmt'     , help='NetCDF file format, using nco syntax', default='64bit', choices=['classic', 'netcdf3', '64bit', '64bit_data', '64bit_data', 'netcdf4', 'netcdf4_classsic'] )
 
 # Parse command line
@@ -308,5 +308,5 @@
 f_calving.Program         = "Generated by " + sys.argv[0] + " with flags " + str(sys.argv[1:])
 f_calving.repartitionType = myargs.type
-if myargs.type in ['iceberg', 'iceshelf' ] :
+if myargs.type in [ 'iceberg', 'iceshelf' ] :
     f_calving.repartitionFile = myargs.repartition_file
     f_calving.repartitionVar  = repartitionVar
@@ -333,11 +333,11 @@
 f_calving.SVN_HeadURL     = "$HeadURL$"
 
-d_nb_zone          = f_calving.createDimension ('nb_zone'         ,   nb_zone )
-d_num_links        = f_calving.createDimension ('num_links'       , num_links )
-d_num_wgts         = f_calving.createDimension ('num_wgts'        ,         1 )
+d_nb_zone   = f_calving.createDimension ('nb_zone'         ,   nb_zone )
+d_num_links = f_calving.createDimension ('num_links'       , num_links )
+d_num_wgts  = f_calving.createDimension ('num_wgts'        ,         1 )
 
 d_src_grid_size    = f_calving.createDimension ('src_grid_size'   , src_grid_size )
 d_src_grid_corners = f_calving.createDimension ('src_grid_corners', src_clo.shape[0]  )
-D_src_grid_rank    = f_calving.createDimension ('src_grid_rank'   ,        2  )
+d_src_grid_rank    = f_calving.createDimension ('src_grid_rank'   ,        2  )
 
 d_dst_grid_size    = f_calving.createDimension ('dst_grid_size'   , dst_grid_size )
@@ -398,4 +398,9 @@
 v_dst_repartition = f_calving.createVariable ( 'dst_repartition' , 'f8', ('nb_zone', 'dst_grid_size',)  )
 
+v_dst_southLimit = f_calving.createVariable ('dst_southLimit', 'f4', ('nb_zone',) )
+v_dst_northLimit = f_calving.createVariable ('dst_northLimit', 'f4', ('nb_zone',) )
+v_dst_southLimit[:] = np.min(limit_lat, axis=(1,) ) 
+v_dst_northLimit[:] = np.max(limit_lat, axis=(1,) ) 
+
 v_dst_grid_dims      [:] = ( dst_jpi, dst_jpi ) 
 v_dst_grid_center_lon[:] = dst_lon[:].ravel()
Index: TOOLS/MOSAIX/CreateOasisGrids.bash
===================================================================
--- TOOLS/MOSAIX/CreateOasisGrids.bash	(revision 4183)
+++ TOOLS/MOSAIX/CreateOasisGrids.bash	(revision 4186)
@@ -54,24 +54,24 @@
 PROGRAM=$(basename ${0})
 
-case ${arch} in
-    ( 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
-    R_IN=$(ccc_home -u igcmg --cccwork)/IGCM
-    TMPDIR=${SCRATCHDIR}/TMP
-    SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}}
-    ;;
-    ( spip )
-    R_IN=${HOME}/Scratch/IGCM
-    TMPDIR=${HOME}/Scratch/TMP
-    SUBMIT_DIR=$(pwd)
-    MPIRUN=/opt/local/bin/mpirun-openmpi-gcc49 -n 2
-    ;; 
-    ( * ) exit -1 ;;
-esac
+# case ${arch} in
+#     ( 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
+#     R_IN=$(ccc_home -u igcmg --cccwork)/IGCM
+#     TMPDIR=${SCRATCHDIR}/TMP
+#     SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}}
+#     ;;
+#     ( spip )
+#     R_IN=${HOME}/Scratch/IGCM
+#     TMPDIR=${HOME}/Scratch/TMP
+#     SUBMIT_DIR=$(pwd)
+#     MPIRUN=/opt/local/bin/mpirun-openmpi-gcc49 -n 2
+#     ;; 
+#     ( * ) exit -1 ;;
+# esac
 
 ##
@@ -185,5 +185,7 @@
 
 ncks --fl_fmt=${FL_FMT3} --history -C --variable OceMask         ${ATM}_grid_maskFrom_${OCE}_${FL_FMT3}.nc OceMask_tmp.nc
+ncwa --history --overwrite --average time_counter OceMask_tmp.nc OceMask_tmp2.nc # Suppress time dimension
 ncatted --history \
+	--attribute cell_methods,OceMask,d,c,       \
 	--attribute coordinates,OceMask,d,,         \
 	--attribute online_operation,OceMask,d,,    \
@@ -191,5 +193,5 @@
 	--attribute missing_value,OceMask,d,,       \
 	OceMask_tmp.nc
-ncap2 --fl_fmt=${FL_FMT3} --history --append --script "OceMask=int(1-OceMask)"            OceMask_tmp.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1
+ncap2 --fl_fmt=${FL_FMT3} --history --append --script "OceMask=int(1-OceMask)" OceMask_tmp2.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1
 rm OceMask_tmp.nc
 ncatted --history \
@@ -216,10 +218,10 @@
 
 #
-echo ${Titre}"DYNAMICO grids : 1) Set correct order of dimensions, 2) Add a dimension"${Norm}
-# ----------------------------------------------------------------------------
 if [[ ${atm} = dynamico* || ${atm} = ico* ]] ; then
+    echo ${Titre}"DYNAMICO grids : 1) Set correct order of dimensions, 2) Add a dimension"${Norm}
+    # -------------------------------------------------------------------------------------------
     mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc
     ncpdq --permute nvertex,ycell,xcell  grids_${CplModel}_tmp.nc grids_${CplModel}.nc
-    
+
     mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc
     cat <<EOF >add_dim.nco
@@ -232,16 +234,18 @@
 //
 EOF
-    
+   
     ncap2 --fl_fmt=${FL_FMT3} --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_FMT3} --history --append --script 'defdim("xcell",1) ; OceMask[time_counter,ycell,xcell]=OceMask(:,:)'  masks_${CplModel}_tmp.nc masks_${CplModel}.nc
+    ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) '   masks_${CplModel}_tmp.nc masks_${CplModel}.nc
+    mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc
+    ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'OceMask[ycell,xcell]=OceMask'  masks_${CplModel}_tmp.nc masks_${CplModel}.nc
 
     mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc
-    ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) ; aire[ycell,xcell]=aire(:) ; '                    areas_${CplModel}_tmp.nc areas_${CplModel}.nc
+    ncap2 --fl_fmt=${FL_FMT3} --history --append --script 'defdim("xcell",1) ; aire[ycell,xcell]=aire ; ' areas_${CplModel}_tmp.nc areas_${CplModel}.nc
 
     rm -f grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc
 fi
-
+ 
 #
 echo ${Titre}"Some changes specific to LMDZ lon/lat grid"${Norm}
@@ -292,4 +296,5 @@
 
 #
+ 
 echo ${Titre}"Generates grid o${atm}, 'o' meaning 'one'"${Norm}
 # same as t${atm} grid, with surfaces set to 1
@@ -308,8 +313,40 @@
 rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc masks_${CplModel}_tmp.nc
 
+
+echo ${Titre}"Generates grid o${oce}, 'o' meaning 'one'"${Norm}
+# same as t${oce} 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_FMT3} --history --script "nav_lon_grid_O=nav_lon_grid_T; nav_lat_grid_O=nav_lat_grid_T; bounds_lon_grid_O=bounds_lon_grid_T; bounds_lat_grid_O=bounds_o${oce}_lat=bounds_lat_grid_T; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc
+
+mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc
+ncap2 --fl_fmt=${FL_FMT3} --history --script "area_grid_O=area_grid_T*0.0d+1.0d;"   areas_${CplModel}_tmp.nc areas_${CplModel}.nc
+
+ncks -C --history --overwrite -v maskutil_T ${OCE}_coordinates_mask_${FL_FMT3}.nc maskutil_T_${FL_FMT3}.nc
+ncap2 --fl_fmt=${FL_FMT3} --history --append --script "mask_O=maskutil_T; " maskutil_T_${FL_FMT3}.nc masks_${CplModel}.nc
+
+rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc 
+
+
+echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals"${Norm}
+# --------------------------------------------------------------------------------------------------------
+
+mv grids_${CplModel}.nc grids_${CplModel}_tmp.nc
+ncap2 --fl_fmt=${FL_FMT3} --history --script "nav_lon_grid_C=nav_lon_grid_T; nav_lat_grid_C=nav_lat_grid_T; bounds_lon_grid_C=bounds_lon_grid_T; bounds_lat_grid_C=bounds_o${oce}_lat=bounds_lat_grid_T; " grids_${CplModel}_tmp.nc grids_${CplModel}.nc
+
+mv areas_${CplModel}.nc areas_${CplModel}_tmp.nc
+ncap2 --fl_fmt=${FL_FMT3} --history --script "area_grid_C=area_grid_T ; "   areas_${CplModel}_tmp.nc areas_${CplModel}.nc
+
+#mv masks_${CplModel}.nc masks_${CplModel}_tmp.nc
+ncap2 --fl_fmt=${FL_FMT3} --history --append --script "mask_C=maskutil_T; " maskutil_T_${FL_FMT3}.nc masks_${CplModel}.nc
+
+rm grids_${CplModel}_tmp.nc areas_${CplModel}_tmp.nc maskutil_T_${FL_FMT3}.nc
+
 #
 echo ${Titre}"Final renaming"${Norm}
 # ----------------------------------------------------------------------------
-for OCEGRID in T U V
+for OCEGRID in T U V O C
 do
     ocegrid=${OCEGRID~} # To lowercase
@@ -342,5 +379,6 @@
 ncrename --history --variable bounds_o${atm}_lat,o${atm}.cla  grids_${CplModel}.nc
 
-for atmgrid in t o ; do
+for ATMGRID in T O ; do
+    atmgrid=${ATMGRID~} # To lowercase
     ncatted --history \
 	    --attribute bounds,${atmgrid}${atm}.lon,c,c,"${atmgrid}${atm}.clo"   \
@@ -414,5 +452,5 @@
 
 ## ===========================================================================
-echo ${Titre}"exit from CreateOasisGrids "${Norm}
+echo ${Titre}"Exit from CreateOasisGrids "${Norm}
 
 ## ===========================================================================
Index: TOOLS/MOSAIX/CreateWeightsMask.bash
===================================================================
--- TOOLS/MOSAIX/CreateWeightsMask.bash	(revision 4183)
+++ TOOLS/MOSAIX/CreateWeightsMask.bash	(revision 4186)
@@ -5,7 +5,6 @@
 #MSUB -eo
 #MSUB -n 16                 # Number of processors
-#MSUB -T 1800               # Time limit (seconds)
+#MSUB -T 7200               # Time limit (seconds)
 #MSUB -q skylake
-#MSUB -Q test
 #MSUB -p gen2212
 #MSUB -m work
@@ -45,5 +44,5 @@
 couleurs=( "Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Yellow" "White" )
 for i in $(seq 0 7 ) ; do eval "export ${couleurs[$i]}=$(tput setf $i)" ; done
-export Norm=$(tput sgr0 )
+export Norm=$(tput sgr0)
 export Titre=${Bold}${Blue}
 
@@ -56,25 +55,31 @@
 echo ${Titre}"Defines models"${Norm}
 # ==============
-OCE=ORCA2.3
-#OCE=eORCA1.2
+#OCE=ORCA2.3
+OCE=eORCA1.2
 #OCE=eORCA025
 
 #ATM=ICO30
-#ATM=ICO40
+ATM=ICO40
 #ATM=ICO450
-ATM=LMD9695
+#ATM=LMD9695
 #ATM=LMD144142
 #ATM=LMD256256
 
-# Runoff parameter (LMDZ grids only)
-atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=1000.0
-
-if [[ ${OCE} = ORCA2.3  && ${ATM} = LMD9695   ]] ; then atmCoastWidth=2 ; oceCoastWidth=1 ; searchRadius=1000.0 ; fi
-if [[ ${OCE} = ORCA2.3  && ${ATM} = LMD144142 ]] ; then atmCoastWidth=2 ; oceCoastWidth=1 ; searchRadius=1000.0 ; fi
-if [[ ${OCE} = eORCA1.2 && ${ATM} = LMD9695   ]] ; then atmCoastWidth=2 ; oceCoastWidth=3 ; searchRadius=1000.0 ; fi
-if [[ ${OCE} = eORCA1.2 && ${ATM} = LMD144142 ]] ; then atmCoastWidth=2 ; oceCoastWidth=3 ; searchRadius=1000.0 ; fi
+echo ${Titre}"ATM model : ${ATM}"${Norm}
+echo ${Titre}"OCE model : ${OCE}"${Norm}
+
+# Runoff parameter. atmCoastWidth and oceCoastWidth in grid points, searchRadius in km
+atmCoastWidth=2 ; oceCoastWidth=2 ; searchRadius=600.0
+runOff_atmQuantity=Quantity runOff_oceQuantity=Surfacic
+
+[[ ${ATM} = ICO*     ]] && atmCoastWidth=0 # Parameter relevant for LMD rectilinear grid only
+[[ ${ATM} = LMD*     ]] && atmCoastWidth=2
+[[ ${OCE} = ORCA2.3  ]] && oceCoastWidth=1
+[[ ${OCE} = eORCA1.2 ]] && oceCoastWidth=3
+[[ ${OCE} = eORCA025 ]] && oceCoastWidth=1
+
 
 # Default values, used to create ocean fraction on atmospheric grid 
-DefaultValues=( Direction=o2a,oceGrid=t,atmGrid=t,Order=1st,Quantity=false,Renormalize=false,useArea=false,maskSrc=true,maskDst=false )
+DefaultValues=( Direction=o2a,oceGrid=t,atmGrid=t,Order=1st,Quantity=false,Renormalize=false,useArea=false,maskSrc=true,maskDst=false,Name=OceFrac )
 
 ## List of weights to build
@@ -98,30 +103,29 @@
 #   maskDst     : true to use the destination grid mask, false to use all grid points
 #
-# Classic cases 
-AtmOceFluxes=" Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true" # Heat and water fluxes
-OceAtmTemp="   Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true" # Temperature, sea-ice fraction, albedo
-AtmOceStressU="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true" # Wind stress to NEMO U point
-AtmOceStressV="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true" # Wind stress to NEMO V point
+# Classic cases for IPSLCM6
+AtmOceFluxes="  Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes
+OceAtmTemp="    Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=TempIceAlb" # Temperature, sea-ice fraction, albedo
+AtmOceStressU=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO U point
+AtmOceStressV=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO V point
+AtmOceQuantity="Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity"   # e.g. runoff
 # Other cases
-OceAtmFluxes=" Direction=o2a,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true" # e.g. CO2 fluxes
-AtmOceTemp="   Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true" # e.g. T and S correction from DWL parametrization
-AtmOceCoastal="Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=c,oceGrid=t,useArea=true,maskSrc=true,maskDst=true"  # Runoff atm to oce, limited to oce coastal points
-
-CommandList=( ${AtmOceFluxes} Runoff Calving )
-
-#CommandList=( Runoff Calving ) #\
-#    Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true  \
-#    Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true  \
-#    Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true  \
-#    Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true  \
-#    Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=c,oceGrid=t,useArea=true,maskSrc=true,maskDst=true   \
-#    Calving \
-#    Runoff  \
-#    )
-
+OceAtmFluxes=" Direction=o2a,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes
+AtmOceTemp="   Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=OceTemp" # e.g. T and S correction from DWL parametrization
+
+# Standard list for IPSLCM6
+#CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} Runoff Calving Grids )
+
+# More comprehesive list for IPSLCM6 with new features
+CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids )
+
+# Debugs
+#CommandList=( Runoff )
+#CommandList=( ${AtmOceFluxes} ${OceAtmTemp} Runoff Calving Grids )
+#CommandList=( Calving )
+#CommandList=( Grids )
 
 
 Comment="Preliminary attempt - Do not trust !"
-#Version
+Version="_v0"
 
 ## ===========================================================================
@@ -130,4 +134,5 @@
 ##
 ## ===========================================================================
+Tag="_MOSAIX"
 SUBMIT_DIR=$(pwd)
 
@@ -152,4 +157,7 @@
 function setValues {
     #
+    read_Command "Direction=None,Order=None,Quantity=None,Renormalize=None,atmGrid=None,oceGrid=None,useArea=None,maskSrc=None,maskDst=None"
+    read_Command ${1}
+    #
     oceGrid=${oceGrid,,} ; atmGrid=${atmGrid,,}
     OCEGRID=${oceGrid^^} ; ATMGRID=${atmGrid^^}
@@ -171,6 +179,10 @@
 	( false ) AreaName=NoArea ;;
     esac
-    
-    Suffix=${Order}Order_${NormName}_${QuantName}_${AreaName}
+
+    if [[ "${Name}" != "None" ]] ; then
+	Suffix=${Name}
+    else
+	Suffix=${Order}Order_${NormName}_${QuantName}_${AreaName}
+    fi
 
     case ${Direction} in
@@ -184,7 +196,8 @@
 	;;
     esac
-    echo ${Green}"${SRC} ${SRCGRID} toward ${DST} ${DSTGRID} - ${Order} Order - Normalize: ${Renormalize} - Quantity: ${QuantName} - Area: ${AreaName}  "${Norm}	     
+    echo ${Green}"${SRC} ${SRCGRID} toward ${DST} ${DSTGRID} - ${Order} Order - Normalize: ${Renormalize} - Quantity: ${QuantName} - Area: ${AreaName}  "${Norm}
+    echo ${Green}"Suffix : ${Suffix}"${Norm}
 }
-    
+
 #
 # Defines computer
@@ -203,5 +216,5 @@
     PROGRAM=${BRIDGE_MSUB_REQNAME}
     MpiRun="time ccc_mprun"
-    PyRun="ccc_mprun -n 1"
+    PyRun="time ccc_mprun -n 1"
     source ${SUBMIT_DIR}/arch.env
     module load nco
@@ -263,31 +276,31 @@
 ncks --overwrite --fl_fmt=${FMT_OASIS} --history ${ATM}_grid.nc             ${ATM}_grid_${FMT_OASIS}.nc
 #
-echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals # A passer dans CreateWeights"${Norm}
-# --------------------------------------------------------------------------------------------------------
-cat <<EOF >add_c_grid.nco
-defdim("x_grid_C", \$x_grid_T.size) ;
-defdim("y_grid_C", \$y_grid_T.size) ;
-defdim("nvertex_grid_C",  4)         ;
-nav_lon_grid_C[y_grid_C,x_grid_C]    = nav_lon_grid_T(:,:)    ;
-nav_lat_grid_C[y_grid_C,x_grid_C]    = nav_lat_grid_T(:,:)    ;
-bounds_lon_grid_C[y_grid_C,x_grid_C,nvertex_grid_C] = bounds_lon_grid_T(:,:,:) ;
-bounds_lat_grid_C[y_grid_C,x_grid_C,nvertex_grid_C] = bounds_lat_grid_T(:,:,:) ;
-mask_C[y_grid_C,x_grid_C]            = maskutil_T(:,:)        ; 
-area_grid_C[y_grid_C,x_grid_C]       = area_grid_T(:,:)       ;
-EOF
-
-ncap2 --overwrite --history --script-file add_c_grid.nco ${OCE}_coordinates_mask.nc tmp_${OCE}_coordinates_mask.nc
-ncatted --history --attribute bounds,nav_lon_grid_C,m,c,"bounds_lon_grid_C" tmp_${OCE}_coordinates_mask.nc
-ncatted --history --attribute bounds,nav_lat_grid_C,m,c,"bounds_lat_grid_C" tmp_${OCE}_coordinates_mask.nc
-ncks --history --overwrite --variable nav_lon_grid_C,nav_lat_grid_C       tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc
-ncks --history --append    --variable bounds_lon_grid_C,bounds_lat_grid_C tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc
-ncks --history --append    --variable area_grid_C             tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc 
-
-ncks --history --append C_${OCE}_coordinates_mask.nc            ${OCE}_coordinates_mask.nc
-rm C_${OCE}_coordinates_mask.nc
-
-ncks --history --overwrite --fl_fmt=${FMT_OASIS} ${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask_${FMT_OASIS}.nc
-
-ls -al
+# echo ${Titre}"Creates OCEAN C grid : redundant points removed to compute proper integrals # A passer dans CreateWeights"${Norm}
+# # --------------------------------------------------------------------------------------------------------
+# cat <<EOF >add_c_grid.nco
+# defdim("x_grid_C", \$x_grid_T.size) ;
+# defdim("y_grid_C", \$y_grid_T.size) ;
+# defdim("nvertex_grid_C",  4)         ;
+# nav_lon_grid_C[y_grid_C,x_grid_C]    = nav_lon_grid_T(:,:)    ;
+# nav_lat_grid_C[y_grid_C,x_grid_C]    = nav_lat_grid_T(:,:)    ;
+# bounds_lon_grid_C[y_grid_C,x_grid_C,nvertex_grid_C] = bounds_lon_grid_T(:,:,:) ;
+# bounds_lat_grid_C[y_grid_C,x_grid_C,nvertex_grid_C] = bounds_lat_grid_T(:,:,:) ;
+# mask_C[y_grid_C,x_grid_C]            = maskutil_T(:,:)        ; 
+# area_grid_C[y_grid_C,x_grid_C]       = area_grid_T(:,:)       ;
+# EOF
+
+# ncap2 --overwrite --history --script-file add_c_grid.nco ${OCE}_coordinates_mask.nc tmp_${OCE}_coordinates_mask.nc
+# ncatted --history --attribute bounds,nav_lon_grid_C,m,c,"bounds_lon_grid_C" tmp_${OCE}_coordinates_mask.nc
+# ncatted --history --attribute bounds,nav_lat_grid_C,m,c,"bounds_lat_grid_C" tmp_${OCE}_coordinates_mask.nc
+# ncks --history --overwrite --variable nav_lon_grid_C,nav_lat_grid_C       tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc
+# ncks --history --append    --variable bounds_lon_grid_C,bounds_lat_grid_C tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc
+# ncks --history --append    --variable area_grid_C             tmp_${OCE}_coordinates_mask.nc C_${OCE}_coordinates_mask.nc 
+
+# ncks --history --append C_${OCE}_coordinates_mask.nc            ${OCE}_coordinates_mask.nc
+# rm C_${OCE}_coordinates_mask.nc
+
+# ncks --history --overwrite --fl_fmt=${FMT_OASIS} ${OCE}_coordinates_mask.nc ${OCE}_coordinates_mask_${FMT_OASIS}.nc
+
+# ls -al
 
 ##
@@ -295,7 +308,5 @@
 ## ===========================================================================
 echo "Command parameters : ${Command}"
-read_Command ${DefaultValues}
-read_Command ${Command}
-setValues
+setValues ${DefaultValues}
 
 cp iodef_oce_to_atm.xml   iodef.xml
@@ -416,11 +427,8 @@
 do
     echo "Command parameters : ${Command}"
-    read_Command ${DefaultValues}
-    read_Command ${Command}
-
+    setValues ${Command}
     if [[ ${Command} = "Runoff"  ]] ; then okRunoff=yes  ; continue ; fi
     if [[ ${Command} = "Calving" ]] ; then okCalving=yes ; continue ; fi
-    
-    setValues
+    if [[ ${Command} = "Grids"   ]] ; then okGrids=yes   ; continue ; fi
     
     ln -fs ${OCE}_coordinates_mask.nc  oce_grid.nc
@@ -620,8 +628,9 @@
 done
 
+ls
 ##
 echo ${Titre}"Add missing variables in rmp files"${Norm}
 ## ===========================================================================
-for $(ls rmpFile in rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc* 2>/dev/null) ; do
+for rmpFile in $(ls rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc 2>/dev/null) ; do
     echo ${rmpFile}
     a_to_o=false ; o_to_a=false
@@ -760,8 +769,8 @@
 
 ##
+## ============================================================================
 echo ${Titre}"Creates and save auxiliary files for OASIS : grids.nc, areas.nc and masks.nc"${Norm}
-## ============================================================================
-bash ${SUBMIT_DIR}/CreateOasisGrids.bash --oce ${OCE} --atm ${ATM}
-
+cp ${SUBMIT_DIR}/CreateOasisGrids.bash .
+bash CreateOasisGrids.bash --oce ${OCE} --atm ${ATM}
 
 
@@ -769,10 +778,12 @@
 echo ${Titre}"Runoff weights"${Norm}
 ## ===========================================================================
-if [[ "X${okRunoff}" = "Xyes" && "${atm}" = "lmd" ]] ; then
+#if [[ "X${okRunoff}" = "Xyes" && "${atm}" = "lmd" ]] ; then
+if [[ "X${okRunoff}" = "Xyes" ]] ; then
     ${PyRun} python3 -u cotes_etal.py --oce=${OCE} --atm=${ATM} \
 	      --atmCoastWidth=${atmCoastWidth} --oceCoastWidth=${oceCoastWidth} --searchRadius=${searchRadius} \
 	      --grids=grids_${OCE}x${ATM}.nc --areas=areas_${OCE}x${ATM}.nc --masks=masks_${OCE}x${ATM}.nc \
-	      --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${FMT_OASIS}.nc \
-              --fmt=${FMT_OASIS}
+	      --o2a=${ATM}_grid_maskFrom_${OCE}.nc --output=rmp_t${atm}_to_t${oce}_runoff_${runOff_atmQuantity}_to_${runOff_oceQuantity}_${FMT_OASIS}.nc \
+              --fmt=${FMT_OASIS} \
+	      --atmQuantity=${runOff_atmQuantity} --oceQuantity=${runOff_oceQuantity}
 fi
 
@@ -783,13 +794,12 @@
     case ${OCE} in
 	( eORCA025 )
-	cp ${R_IN}/OCE/NEMO/ORCA025_LIM3_PISCES/v3.6_stable/eORCA_R025_runoff_v1.1.nc .
-	${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_full_${FMT_OASIS}.nc     --fmt=${FMT_OASIS} \
-		  --oce=${OCE} --atm=${ATM} --type=full     --dir=.
+	# cp ${R_IN}/OCE/NEMO/ORCA025_LIM3_PISCES/v3.6_stable/eORCA_R025_runoff_v1.1.nc .
+	cp /ccc/work/cont003/gencmip6/deshayej/eORCA_R025_runoff_v1.2.nc .
 	${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_nosouth_${FMT_OASIS}.nc  --fmt=${FMT_OASIS} \
-		  --oce=${OCE} --atm=${ATM} --type=nosouth  --dir=.  --repartition_file=eORCA_R025_runoff_v1.1.nc
+		  --oce=${OCE} --atm=${ATM} --type=nosouth  --dir=. 
 	${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceberg_${FMT_OASIS}.nc  --fmt=${FMT_OASIS} \
-		  --oce=${OCE} --atm=${ATM} --type=iceberg  --dir=.  --repartition_file=eORCA_R025_runoff_v1.1.nc --repartition_var=sornficbisf
+		  --oce=${OCE} --atm=${ATM} --type=iceberg  --dir=.  --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=Icb_flux
 	${PyRun} python3 -u CalvingWeights.py --output=rmp_t${atm}_to_t${oce}_calving_iceshelf_${FMT_OASIS}.nc --fmt=${FMT_OASIS} \
-		  --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=.  --repartition_file=eORCA_R025_runoff_v1.1.nc --repartition_var=sofwfisf
+		  --oce=${OCE} --atm=${ATM} --type=iceshelf --dir=.  --repartition_file=eORCA_R025_runoff_v1.2.nc --repartition_var=sornfisf
 	;;
 	
@@ -827,8 +837,9 @@
 done
 
-cp areas_${OCE}x${ATM}.nc ${SUBMIT_DIR}
-cp grids_${OCE}x${ATM}.nc ${SUBMIT_DIR}
-cp masks_${OCE}x${ATM}.nc ${SUBMIT_DIR}
-
+if [[ "X${okGrids}" = "Xyes" ]] ; then
+    cp areas_${OCE}x${ATM}.nc ${SUBMIT_DIR}
+    cp grids_${OCE}x${ATM}.nc ${SUBMIT_DIR}
+    cp masks_${OCE}x${ATM}.nc ${SUBMIT_DIR}
+fi
 
 ##
@@ -892,5 +903,5 @@
 EOF
 
-cp README.txt ${SUBMIT_DIR}/README_${OCE}x${ATM}.txt
+cp README.txt ${SUBMIT_DIR}/README_${OCE}x${ATM}_MOSAIX.txt
 
 ## ===========================================================================
Index: TOOLS/MOSAIX/cotes_etal.py
===================================================================
--- TOOLS/MOSAIX/cotes_etal.py	(revision 4183)
+++ TOOLS/MOSAIX/cotes_etal.py	(revision 4186)
@@ -37,5 +37,5 @@
 epsfrac = np.dtype('float64').type(1.0E-10)
 pi      = np.pi
-rad     = pi/np.dtype('float64').type(180.0)
+rad     = pi/np.dtype('float64').type(180.0)  # Conversion from degrees to radian
 ra      = np.dtype('float64').type(6371229.0) # Earth radius
 
@@ -56,8 +56,10 @@
 # Adding arguments
 parser.add_argument ('--oce'          , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025'] )
-parser.add_argument ('--atm'          , help='atm model name (LMD*)', type=str, default='LMD9695'    )
+parser.add_argument ('--atm'          , help='atm model name', type=str, default='LMD9695'    )
 parser.add_argument ('--atmCoastWidth', help='width of the coastal band in atmosphere (in grid points)', type=int, default=1 )
 parser.add_argument ('--oceCoastWidth', help='width of the coastal band in ocean (in grid points)'     , type=int, default=2 )
-parser.add_argument ('--searchRadius' , help='max distance to connect a land point to an ocean point (in km)', type=float, default=600000.0)
+parser.add_argument ('--atmQuantity'  , help='Quantity if atm provides quantities (m/s), Surfacic if atm provided flux (m/s/m2)'  , type=str, default='Quantity', choices=['Quantity', 'Surfacic'] )
+parser.add_argument ('--oceQuantity'  , help='Quantity if oce requires quantities (ks/s), Surfacic if oce requires flux (m/s/m2)' , type=str, default='Surfacic', choices=['Quantity', 'Surfacic'] )
+parser.add_argument ('--searchRadius' , help='max distance to connect a land point to an ocean point (in km)', type=float, default=600.0 )
 parser.add_argument ('--grids' , help='grids file name', default='grids.nc' )
 parser.add_argument ('--areas' , help='masks file name', default='areas.nc' )
@@ -93,4 +95,11 @@
 if myargs.fmt == 'netcdf4_classic' : FmtNetcdf = 'NETCDF4_CLASSIC'
 
+#
+if atm_Name.find('LMD') >= 0 : atm_n = 'lmd' ; atmDomainType = 'rectilinear'
+if atm_Name.find('ICO') >= 0 : atm_n = 'ico' ; atmDomainType = 'unstructured'
+
+print ('atmQuantity : ' + str (myargs.atmQuantity) )
+print ('oceQuantity : ' + str (myargs.oceQuantity) )
+    
 ### Read coordinates of all models
 ###
@@ -104,46 +113,57 @@
 o2aFrac = np.where ( np.abs(o2aFrac) < 1E10, o2aFrac, 0.0)
 
-atm_grid_center_lat = gridFile['tlmd.lat'][:]
-atm_grid_center_lon = gridFile['tlmd.lon'][:]
-atm_grid_corner_lat = gridFile['tlmd.cla'][:]
-atm_grid_corner_lon = gridFile['tlmd.clo'][:]
-
-atm_grid_area       = areaFile['tlmd.srf'][:]
-atm_grid_imask      = 1-maskFile['tlmd.msk'][:].squeeze()
-atm_grid_dims       = atm_grid_area.shape
-(atm_nvertex, atm_jpj, atm_jpi) = atm_grid_corner_lat.shape
+(atm_nvertex, atm_jpj, atm_jpi) = gridFile['t'+atm_n+'.clo'][:].shape
+atm_grid_size = atm_jpj*atm_jpi
+atm_grid_rank = len(gridFile['t'+atm_n+'.lat'][:].shape)
+
+atm_grid_center_lat = gridFile['t'+atm_n+'.lat'][:].ravel()
+atm_grid_center_lon = gridFile['t'+atm_n+'.lon'][:].ravel()
+atm_grid_corner_lat = np.reshape ( gridFile['t'+atm_n+'.cla'][:], (atm_nvertex, atm_grid_size) )
+atm_grid_corner_lon = np.reshape ( gridFile['t'+atm_n+'.clo'][:], (atm_nvertex, atm_grid_size) )
+atm_grid_area       = areaFile['t'+atm_n+'.srf'][:].ravel()
+atm_grid_imask      = 1-maskFile['t'+atm_n+'.msk'][:].squeeze().ravel()
+atm_grid_dims       = gridFile['t'+atm_n+'.lat'][:].shape
+
 atm_perio = 0
-atm_grid_pmask = nemo.lbc_mask (atm_grid_imask, 'T', atm_perio)
-atm_address = np.reshape ( np.arange(atm_jpj*atm_jpi), (atm_jpj, atm_jpi) )
-atm_grid_size = atm_jpj*atm_jpi
-
-oce_grid_center_lat = gridFile['torc.lat'][:]
-oce_grid_center_lon = gridFile['torc.lon'][:]
-oce_grid_corner_lat = gridFile['torc.cla'][:]
-oce_grid_corner_lon = gridFile['torc.clo'][:]
-oce_grid_area       = areaFile['torc.srf'][:]
-oce_grid_imask      = 1-maskFile['torc.msk'][:]
-oce_grid_dims       = oce_grid_area.shape
-(oce_nvertex, oce_jpj, oce_jpi) = oce_grid_corner_lat.shape ; jpon=oce_jpj*oce_jpj
+atm_grid_pmask = atm_grid_imask
+atm_address = np.arange(atm_jpj*atm_jpi)
+
+
+(oce_nvertex, oce_jpj, oce_jpi) = gridFile['torc.cla'][:].shape ; jpon=oce_jpj*oce_jpj
+oce_grid_size = oce_jpj*oce_jpi
+oce_grid_rank = len(gridFile['torc.lat'][:].shape)
+
+oce_grid_center_lat = gridFile['torc.lat'][:].ravel()
+oce_grid_center_lon = gridFile['torc.lon'][:].ravel()
+oce_grid_corner_lat = np.reshape( gridFile['torc.cla'][:], (oce_nvertex, oce_grid_size) )
+oce_grid_corner_lon = np.reshape( gridFile['torc.clo'][:], (oce_nvertex, oce_grid_size) )
+oce_grid_area       = areaFile['torc.srf'][:].ravel()
+oce_grid_imask      = 1-maskFile['torc.msk'][:].ravel()
+oce_grid_dims       = gridFile['torc.lat'][:].shape
 if oce_jpi ==  182 : oce_perio = 4 # ORCA 2
 if oce_jpi ==  362 : oce_perio = 6 # ORCA 1
 if oce_jpi == 1442 : oce_perio = 6 # ORCA 025
-oce_grid_pmask = nemo.lbc_mask (oce_grid_imask, 'T', oce_perio)
-oce_address = np.reshape ( np.arange(oce_jpj*oce_jpi), (oce_jpj, oce_jpi) )
-oce_grid_size = oce_jpj*oce_jpi
+oce_grid_pmask = nemo.lbc_mask (np.reshape(oce_grid_imask, (oce_jpj,oce_jpi)), 'T', oce_perio).ravel()
+oce_address = np.arange(oce_jpj*oce_jpi)
 
 ## Fill closed sea with image processing library
-oce_grid_imask = nemo.lbc_mask ( 1-ndimage.binary_fill_holes (1-nemo.lbc(oce_grid_imask, nperio=oce_perio, cd_type='T')), nperio=oce_perio, cd_type='T' )
-
+oce_grid_imask2D = np.reshape(oce_grid_pmask,(oce_jpj,oce_jpi))
+oce_grid_imask2D = nemo.lbc_mask ( 1-ndimage.binary_fill_holes (1-nemo.lbc(oce_grid_imask2D, nperio=oce_perio, cd_type='T')), nperio=oce_perio, cd_type='T' )
+oce_grid_imask = oce_grid_imask2D.ravel()
 ## 
 print ("Determination d'une bande cotiere ocean")
 
-oceLand  = np.where (oce_grid_pmask[:] < 0.5, True, False)
-oceOcean = np.where (oce_grid_pmask[:] > 0.5, True, False)
+oceLand2D  = np.reshape ( np.where (oce_grid_pmask[:] < 0.5, True, False), (oce_jpj, oce_jpi) )
+oceOcean2D = np.reshape ( np.where (oce_grid_pmask[:] > 0.5, True, False), (oce_jpj, oce_jpi) )
 
 NNocean = 1+2*oceCoastWidth
-oceOceanFiltered = ndimage.uniform_filter(oceOcean.astype(float), size=NNocean)
-oceCoast = np.where (oceOceanFiltered<(1.0-0.5/(NNocean**2)),True,False) & oceOcean
-oceCoast = nemo.lbc_mask (oceCoast, oce_perio, 'T')
+oceOceanFiltered2D = ndimage.uniform_filter(oceOcean2D.astype(float), size=NNocean)
+oceCoast2D = np.where (oceOceanFiltered2D<(1.0-0.5/(NNocean**2)),True,False) & oceOcean2D
+oceCoast2D = nemo.lbc_mask (np.reshape(oceCoast2D,(oce_jpj,oce_jpi)), oce_perio, 'T').ravel()
+
+oceOceanFiltered = oceOceanFiltered2D.ravel()
+oceLand  = oceLand2D.ravel()
+oceOcean = oceOcean2D.ravel()
+oceCoast = oceCoast2D.ravel()
 
 print ('Number of points in oceLand  : ' + str(oceLand.sum()) )
@@ -166,13 +186,23 @@
 atmOceanFrac = np.where (o2aFrac[:] > epsfrac       , True, False)
 
-NNatm = 1+2*atmCoastWidth
-atmLandFiltered = ndimage.uniform_filter(atmLand.astype(float), size=NNatm)
-atmCoast = np.where (atmLandFiltered<(1.0-0.5/(NNatm**2)),True,False) & atmLandFrac
-atmCoast = nemo.lbc_mask (atmCoast, 1, 'T')
-
-print ('Number of points in atmLand  : ' + str(atmLand.sum()) )
-print ('Number of points in atmOcean : ' + str(atmOcean.sum()) )
-print ('Number of points in atmCoast : ' + str(atmCoast.sum()) )
-
+## La suite marche avec LMDZ seulement !!
+if atmDomainType == 'rectilinear' :
+    NNatm = 1+2*atmCoastWidth
+    atmLand2D = np.reshape ( atmLand, ( atm_jpj, atm_jpi) )
+
+    atmLandFiltered2D = ndimage.uniform_filter(atmLand2D.astype(float), size=NNatm)
+    atmCoast2D = np.where (atmLandFiltered2D<(1.0-0.5/(NNatm**2)),True,False) & atmLandFrac
+    
+    atmLandFiltered = atmLandFiltered2D.ravel()
+    atmCoast = atmCoast2D.ravel()
+
+    print ('Number of points in atmLand  : ' + str(atmLand.sum())  )
+    print ('Number of points in atmOcean : ' + str(atmOcean.sum()) )
+    print ('Number of points in atmCoast : ' + str(atmCoast.sum()) )
+
+else :
+    atmCoast = atmFrac
+    
+    
 # Arrays with coastal points only
 atmCoast_grid_center_lon = atm_grid_center_lon[atmCoast]
@@ -183,4 +213,5 @@
 atmCoast_address         = atm_address        [atmCoast]
 
+# Initialisations before the loop
 remap_matrix = np.empty ( shape=(0), dtype=np.float64 )
 atm_address  = np.empty ( shape=(0), dtype=np.int32   )
@@ -191,14 +222,16 @@
     z_dist = geodist ( atmCoast_grid_center_lon[ja], atmCoast_grid_center_lat[ja], oceCoast_grid_center_lon, oceCoast_grid_center_lat)
     z_mask = np.where ( z_dist*ra < searchRadius, True, False)
-    num_links = z_mask.sum()
+    num_links = np.int(z_mask.sum())
     if num_links == 0 : continue
     z_area = oceCoast_grid_area[z_mask].sum()
-    poids = 1.0 / z_area
-    #print ( num_links, z_mask.sum(), z_area )
+    poids = np.ones ((num_links),dtype=np.float64) / z_area
+    if myargs.atmQuantity == 'Surfacic' : poids = poids * atm_grid_area[ja]
+    if myargs.oceQuantity == 'Quantity' : poids = poids * oceCoast_grid_area[z_mask]
+    if  ja % (len(atmCoast_grid_pmask)//50) == 0 : # Control print
+        print ( 'ja:{:8d}, num_links:{:8d},  z_area:{:8.4e},  atm area:{:8.4e},  weights sum:{:8.4e}  '.format(ja, num_links, z_area, atm_grid_area[ja], poids.sum() ) )
     #
-    matrix_local     = np.ones ((num_links),dtype=np.float64) * poids
-    # address on source grid : all links points to the same LMDZ point.
+    matrix_local = poids
     atm_address_local = np.ones(num_links, dtype=np.int32 ) * atmCoast_address[ja]
-    # address on destination grid
+    # Address on destination grid
     oce_address_local = oceCoast_address[z_mask]
     # Append to global tabs
@@ -252,14 +285,14 @@
 f_runoff.SVN_HeadURL     = "$HeadURL$"
 
-d_num_links        = f_runoff.createDimension ('num_links'       , num_links )
-d_num_wgts         = f_runoff.createDimension ('num_wgts'        ,         1 )
+d_num_links = f_runoff.createDimension ('num_links'       , num_links )
+d_num_wgts  = f_runoff.createDimension ('num_wgts'        ,         1 )
 
 d_atm_grid_size    = f_runoff.createDimension ('src_grid_size'   , atm_grid_size )
 d_atm_grid_corners = f_runoff.createDimension ('src_grid_corners', atm_grid_corner_lon.shape[0]  )
-d_atm_grid_rank    = f_runoff.createDimension ('src_grid_rank'   ,        2  )
+d_atm_grid_rank    = f_runoff.createDimension ('src_grid_rank'   , atm_grid_rank  )
 
 d_oce_grid_size    = f_runoff.createDimension ('dst_grid_size'   , oce_grid_size )
 d_oce_grid_corners = f_runoff.createDimension ('dst_grid_corners', oce_grid_corner_lon.shape[0] )
-d_oce_grid_rank    = f_runoff.createDimension ('dst_grid_rank'   ,        2  )
+d_oce_grid_rank    = f_runoff.createDimension ('dst_grid_rank'   , oce_grid_rank  )
 
 v_remap_matrix = f_runoff.createVariable ( 'remap_matrix', 'f8', ('num_links', 'num_wgts') )
@@ -289,11 +322,11 @@
 
 v_atm_grid_dims      [:] = atm_grid_dims
-v_atm_grid_center_lon[:] = atm_grid_center_lon[:].ravel()
-v_atm_grid_center_lat[:] = atm_grid_center_lat[:].ravel()
-v_atm_grid_corner_lon[:] = atm_grid_corner_lon.reshape( (atm_jpi*atm_jpj, d_atm_grid_corners.__len__()) )
-v_atm_grid_corner_lat[:] = atm_grid_corner_lat.reshape( (atm_jpi*atm_jpj, d_atm_grid_corners.__len__()) )
-v_atm_grid_area      [:] = atm_grid_area[:].ravel()
-v_atm_grid_imask     [:] = atm_grid_imask[:].ravel()
-v_atm_grid_pmask     [:] = atm_grid_pmask[:].ravel()
+v_atm_grid_center_lon[:] = atm_grid_center_lon[:]
+v_atm_grid_center_lat[:] = atm_grid_center_lat[:]
+v_atm_grid_corner_lon[:] = atm_grid_corner_lon
+v_atm_grid_corner_lat[:] = atm_grid_corner_lat
+v_atm_grid_area      [:] = atm_grid_area[:]
+v_atm_grid_imask     [:] = atm_grid_imask[:]
+v_atm_grid_pmask     [:] = atm_grid_pmask[:]
 
 # --
@@ -316,11 +349,11 @@
 
 v_oce_grid_dims      [:] = oce_grid_dims
-v_oce_grid_center_lon[:] = oce_grid_center_lon[:].ravel()
-v_oce_grid_center_lat[:] = oce_grid_center_lat[:].ravel()
-v_oce_grid_corner_lon[:] = oce_grid_corner_lon.reshape( (oce_jpi*oce_jpj, d_oce_grid_corners.__len__()) )
-v_oce_grid_corner_lat[:] = oce_grid_corner_lon.reshape( (oce_jpi*oce_jpj, d_oce_grid_corners.__len__()) )
-v_oce_grid_area      [:] = oce_grid_area[:].ravel()
-v_oce_grid_imask     [:] = oce_grid_imask[:].ravel()
-v_oce_grid_pmask     [:] = oce_grid_pmask[:].ravel()
+v_oce_grid_center_lon[:] = oce_grid_center_lon[:]
+v_oce_grid_center_lat[:] = oce_grid_center_lat[:]
+v_oce_grid_corner_lon[:] = oce_grid_corner_lon
+v_oce_grid_corner_lat[:] = oce_grid_corner_lon
+v_oce_grid_area      [:] = oce_grid_area[:]
+v_oce_grid_imask     [:] = oce_grid_imask[:]
+v_oce_grid_pmask     [:] = oce_grid_pmask[:]
 
 v_atm_lon_addressed   = f_runoff.createVariable ( 'src_lon_addressed'  , 'f8', ('num_links',) )
@@ -338,33 +371,35 @@
 v_atm_lon_addressed.long_name="Longitude" ; v_atm_lon_addressed.standard_name="longitude" ; v_atm_lon_addressed.units="degrees_east"
 v_atm_lat_addressed.long_name="Latitude"  ; v_atm_lat_addressed.standard_name="latitude"  ; v_atm_lat_addressed.units="degrees_north"
-v_atm_lon_addressed  [:] = atm_grid_center_lon.ravel()[atm_address].ravel()
-v_atm_lat_addressed  [:] = atm_grid_center_lat.ravel()[atm_address].ravel()
-v_atm_area_addressed [:] = atm_grid_area.ravel()[atm_address].ravel()
-v_atm_imask_addressed[:] = 1-atm_grid_imask.ravel()[atm_address].ravel()
-v_atm_pmask_addressed[:] = 1-atm_grid_pmask.ravel()[atm_address].ravel()
+v_atm_lon_addressed  [:] = atm_grid_center_lon[atm_address]
+v_atm_lat_addressed  [:] = atm_grid_center_lat[atm_address]
+v_atm_area_addressed [:] = atm_grid_area[atm_address]
+v_atm_imask_addressed[:] = 1-atm_grid_imask[atm_address]
+v_atm_pmask_addressed[:] = 1-atm_grid_pmask[atm_address]
 
 v_oce_lon_addressed.long_name="Longitude" ; v_oce_lon_addressed.standard_name="longitude" ; v_oce_lon_addressed.units="degrees_east"
 v_oce_lat_addressed.long_name="Latitude"  ; v_oce_lat_addressed.standard_name="latitude"  ; v_oce_lat_addressed.units="degrees_north"
-v_oce_lon_addressed  [:] = oce_grid_center_lon.ravel()[oce_address].ravel()
-v_oce_lat_addressed  [:] = oce_grid_center_lat.ravel()[oce_address].ravel()
-v_oce_area_addressed [:] = oce_grid_area.ravel()[oce_address].ravel()
-v_oce_imask_addressed[:] = 1-oce_grid_imask.ravel()[oce_address].ravel()
-v_oce_pmask_addressed[:] = 1-oce_grid_pmask.ravel()[oce_address].ravel()
-
-v_atmLand         = f_runoff.createVariable ( 'atmLand'        , 'i4', ('src_grid_size',) )
-v_atmLandFiltered = f_runoff.createVariable ( 'atmLandFiltered', 'f4', ('src_grid_size',) )
-v_atmLandFrac     = f_runoff.createVariable ( 'atmLandFrac'    , 'i4', ('src_grid_size',) )
-v_atmFrac         = f_runoff.createVariable ( 'atmFrac'        , 'i4', ('src_grid_size',) )
-v_atmOcean        = f_runoff.createVariable ( 'atmOcean'       , 'i4', ('src_grid_size',) )
-v_atmOceanFrac    = f_runoff.createVariable ( 'atmOceanFrac'   , 'i4', ('src_grid_size',) )
-v_atmCoast        = f_runoff.createVariable ( 'atmCoast'       , 'i4', ('src_grid_size',) ) 
-
-v_atmLand[:]         = atmLand.ravel()
-v_atmLandFrac[:]     = atmLandFrac.ravel()
-v_atmLandFiltered[:] = atmLandFiltered.ravel()
-v_atmFrac[:]         = atmFrac.ravel()
-v_atmOcean[:]        = atmOcean.ravel()
-v_atmOceanFrac[:]    = atmOceanFrac.ravel()
-v_atmCoast[:]        = atmCoast.ravel()
+v_oce_lon_addressed  [:] = oce_grid_center_lon[oce_address]
+v_oce_lat_addressed  [:] = oce_grid_center_lat[oce_address]#.ravel()
+v_oce_area_addressed [:] = oce_grid_area[oce_address]
+v_oce_imask_addressed[:] = 1-oce_grid_imask[oce_address]
+v_oce_pmask_addressed[:] = 1-oce_grid_pmask[oce_address]
+
+if atmDomainType == 'rectilinear' :
+    v_atmLand         = f_runoff.createVariable ( 'atmLand'        , 'i4', ('src_grid_size',) )
+    v_atmLandFiltered = f_runoff.createVariable ( 'atmLandFiltered', 'f4', ('src_grid_size',) )
+    v_atmLandFrac     = f_runoff.createVariable ( 'atmLandFrac'    , 'i4', ('src_grid_size',) )
+    v_atmFrac         = f_runoff.createVariable ( 'atmFrac'        , 'i4', ('src_grid_size',) )
+    v_atmOcean        = f_runoff.createVariable ( 'atmOcean'       , 'i4', ('src_grid_size',) )
+    v_atmOceanFrac    = f_runoff.createVariable ( 'atmOceanFrac'   , 'i4', ('src_grid_size',) )
+    
+    v_atmLand[:]         = atmLand
+    v_atmLandFrac[:]     = atmLandFrac
+    v_atmLandFiltered[:] = atmLandFiltered
+    v_atmFrac[:]         = atmFrac
+    v_atmOcean[:]        = atmOcean
+    v_atmOceanFrac[:]    = atmOceanFrac
+
+v_atmCoast         = f_runoff.createVariable ( 'atmCoast'       , 'i4', ('src_grid_size',) ) 
+v_atmCoast[:]      = atmCoast
 
 v_oceLand          = f_runoff.createVariable ( 'oceLand'         , 'i4', ('dst_grid_size',) )
@@ -373,8 +408,8 @@
 v_oceCoast         = f_runoff.createVariable ( 'oceCoast'        , 'i4', ('dst_grid_size',) )
 
-v_oceLand[:]      = oceLand.ravel()
-v_oceOcean[:]     = oceOcean.ravel()
-v_oceOceanFiltered[:]     = oceOceanFiltered.ravel()
-v_oceCoast[:]     = oceCoast.ravel()
+v_oceLand[:]      = oceLand
+v_oceOcean[:]     = oceOcean
+v_oceOceanFiltered[:]     = oceOceanFiltered
+v_oceCoast[:]     = oceCoast
 
 f_runoff.sync ()
Index: TOOLS/MOSAIX/rangement.bash
===================================================================
--- TOOLS/MOSAIX/rangement.bash	(revision 4183)
+++ TOOLS/MOSAIX/rangement.bash	(revision 4186)
@@ -17,9 +17,9 @@
 # ============================================================
 
-for ATM in LMD144142 LMD9695 LMD256256 ICO30 ICO40 ICO450 dynamico30 dynamico40 dynamico450
+for ATM in LMD144142 LMD9695 LMD256256 LMD144x142 LMD96x95 LMD256x256 ICO30 ICO40 ICO450 dynamico30 dynamico40 dynamico450
 do
     for OCE in ORCA2.3 eORCA1.2 eORCA025 ORCA025 
     do
-	Liste=$(ls README_${OCE}x${ATM}.txt *${ATM}*_*${OCE}*.nc *${OCE}*_*${ATM}*.nc  *${ATM}x${OCE}*.nc *${OCE}x${ATM}*.nc 2> /dev/null  )
+	Liste=$(ls README_${OCE}x${ATM}*.txt *${ATM}*_*${OCE}*.nc *${OCE}*_*${ATM}*.nc  *${ATM}x${OCE}*.nc *${OCE}x${ATM}*.nc 2> /dev/null  )
 
 	if [[ -z ${Liste} ]] ; then
