Index: TOOLS/CPLRESTART/CreateRestartAtm4Oasis.bash
===================================================================
--- TOOLS/CPLRESTART/CreateRestartAtm4Oasis.bash	(revision 6226)
+++ TOOLS/CPLRESTART/CreateRestartAtm4Oasis.bash	(revision 6228)
@@ -28,4 +28,5 @@
 # Usage exemples :
 # CreateRestartAtm4Oasis.bash --oce ORCA2.3 /ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/ATM/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_histmth.nc
+# CreateRestartAtm4Oasis.bash --oce eORCA1.2 /ccc/store/cont003/gencmip6/p86maf/IGCM_OUT/IPSLCM6/PROD/piControl/CM61-LR-pi-03/ATM/Output/MO/CM61-LR-pi-03_23400101_23491231_1M_histmth.nc
 # CreateRestartAtm4Oasis.bash --oce ORCA2.3 /ccc/work/cont003/gencmip6/bedidil/SAVE8_ORCA2/STORE1/dynamico_grid.nc
 # CreateRestartAtm4Oasis.bash --oce ORCA2.3 /ccc/work/cont003/gencmip6/bedidil/SAVE9_ORCA2_DYN30_1MO/STORE1/histmth.nc
@@ -49,16 +50,30 @@
 if [[ $(hostname) = curie* ]] ; then arch=curie ; center=tgcc ; fi
 if [[ $(hostname) = irene* ]] ; then arch=irene ; center=tgcc ; fi
+if [[ $(hostname) = lsce*  ]] ; then arch=spip  ; center=spip ; fi
 
 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
+    ( irene )
+    set +e
+    R_IN=$(ccc_home -u igcmg --cccwork)/IGCM
+    TMPDIR=${CCCWORKDIR}/TMP
+    SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}}
+    MpiRun="time ccc_mprun"
+    PyRun="time ccc_mprun -n 1" # Needed to force python to run on one process only
+    module purge
+    module load hdf5
+    module load netcdf-c
     module load nco
-    R_IN=$(ccc_home -u igcmg --cccwork)/IGCM
-    TMPDIR=${SCRATCHDIR}/TMP
-    SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}}
+    module load cdo
+    module load python3
+    module load datadir/igcmg
+    module list
+    set -e
+    ;;
+    ( spip )
+    R_IN=${HOME}/Scratch/IGCM
+    TMPDIR=${HOME}/Scratch/TMP
+    SUBMIT_DIR=$(pwd)
+    MpiRun="/opt/local/bin/mpirun -n 1"
+    PyRun="time"
     ;;
     ( * )
@@ -87,4 +102,7 @@
     shift
 done
+
+
+set -e
 
 #AtmFile=${1:-/ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/ATM/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_histmth.nc}
@@ -135,11 +153,4 @@
     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
-
-cat<<EOF > lonlat2xyz.nco
-// Value at North Pole for DYNAMICO grid 
-where ( lat(:,:) >= 90.0d ) COTAUXXU = double(-tau_y) ;
-where ( lat(:,:) >= 90.0d ) COTAUYYU = double( tau_x) ;
-// Value at South Pole for DYNAMICO grid ?
-EOF
 else
     # lat/lon
@@ -158,14 +169,5 @@
     ATM=LMD${dim_lon}${dim_lat}
     (( n_lat = dim_lat - 1 ))
-cat<<EOF > lonlat2xyz.nco
-// Value at North Pole for LMDZ lon/lat grid
-COTAUXXU(0,:) = double( -tau_x (0, 0) ) ;
-COTAUYYU(0,:) = double( -tau_y (0, 0) ) ;
-COTAUZZU(0,:) =  0.0d ; 
-// Value at south Pole for LMDZ lon/lat grid ?
-COTAUXXU(${n_lat},:) = double( -tau_x (${n_lat}, 0) ) ;
-COTAUYYU(${n_lat},:) = double( -tau_y (${n_lat}, 0) ) ;
-COTAUZZU(${n_lat},:) =  0.0d ; 
-EOF
+
 
 fi
@@ -178,45 +180,7 @@
 ## ===========================================================================
 
-cat <<EOF > create_flxat.nco
-//
-*fract_oce_plus_sic  = double(fract_oce + fract_sic) ; // ocean fraction
-*fract_oce_norm[y,x] = 0.0d ; *fract_sic_norm[y,x] = 0.0d ; 
-where (fract_oce_plus_sic >  0.0d ) fract_oce_norm = double(fract_oce)/fract_oce_plus_sic ; // free ocean vs. total ocean fraction
-where (fract_oce_plus_sic >  0.0d ) fract_sic_norm = double(fract_sic)/fract_oce_plus_sic ; // sea ice vs. total ocean fraction
-//
-COTOTRAI[y,x] = double(precip-snow)    ;  //  Liquid precip
-COTOTSNO[y,x] = double(snow)           ;  //  Solid precipitation
-COTOTEVA[y,x] = double(evap_oce*fract_oce_norm + evap_sic*fract_sic_norm) ;
-COICEVAP[y,x] = double(evap_sic)       ; // Evaporation on sea ice
-COQSRMIX[y,x] = double(sols)           ; // Heat flux short wave
-COQNSMIX[y,x] = double(soll)           ; // Heat flux minus short wave
-COSHFICE[y,x] = double(sols)           ; // Heat flux short wave over sea ice
-CONSFICE[y,x] = double(soll)           ; // Heat flux minus short wave over sea ice
-CODFLXDT[y,x] = -20.0d       ; // W/m2 - dQ/dt
-COCALVIN[y,x] =   0.0d       ; // Calving of icebergs, solid
-COLIQRUN[y,x] =   0.0d       ; // River run-off , liquid
-COWINDSP[y,x] = double( wind10m )      ; // Wind speed at 10m high
-COTAUMOD[y,x] =   0.0d                 ; // Wind stress modulus
-// Wind stress
-*tau_x[y,x] = double(taux_oce*fract_oce_norm + taux_sic*fract_sic_norm) ; 
-*tau_y[y,x] = double(tauy_oce*fract_oce_norm + tauy_sic*fract_sic_norm) ;
-COTAUMOD[y,x] = sqrt ( double(tau_x*tau_x + tau_y*tau_y) )  ; 
-// Wind stress, from east/north components to geocentric
-*rpi = acos (-1.0d) ;  *rad = rpi / 180.0d  ; 
-COTAUXXU[y,x] = double( -tau_x * sin(rad * lon) - tau_y * sin(rad * lat) * cos(rad * lon) ); 
-COTAUYYU[y,x] = double(  tau_x * cos(rad * lon) - tau_y * sin(rad * lat) * sin(rad * lon) );
-COTAUZZU[y,x] = double(  tau_y * cos(rad * lat) ) ;
-// Value at North Pole
-#include "lonlat2xyz.nco"
-//
-COTAUXXV[y,x] = COTAUXXU ;
-COTAUYYV[y,x] = COTAUYYU ;
-COTAUZZV[y,x] = COTAUZZU ;
-//
-EOF
-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 --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
+python3 create_flxat.py --IsUnstructured=${IsUnstructured} --input flxat_fields_notime.nc --output tmp_flxat.nc
+
+[[ ${IsUnstructured} = yes ]] && ncks --fl_fmt=${FL_FMT} --history --append --variable bounds_lon,bounds_lat flxat.nc  tmp_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
 
@@ -251,7 +215,7 @@
         --attribute Comment,global,o,c,"Preliminary attempt - Do not trust !" \
 	--attribute SVN_Author,global,o,c,"$Author$"                 \
-        --attribute SVN_Date,global,o,c,"$Date$"                            \
+        --attribute SVN_Date,global,o,c,"$Date$" \
 	--attribute SVN_Revision,global,o,c,"$Revision$"               \
-	--attribute SVN_Id,global,o,c,"$Id$"                                \
+	--attribute SVN_Id,global,o,c,"$Id$" \
 	flxat.nc
 
