Index: NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/launch_sasf.sh
===================================================================
--- NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/launch_sasf.sh	(revision 13686)
+++ NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/launch_sasf.sh	(revision 13690)
@@ -14,4 +14,13 @@
 CONFIG_BLD="STATION_ASF2" ; # name of config as build in NEMO... (directory inside "tests" actually contains the compiled test-case?)
 
+# Atmo + SSX forcing to use and sea-ice support?
+#     => NFORC: name of forcing
+#     => i_sea_ice: whether to compute fluxes over sea-ice as well
+#     => SFORC: string sufficient to copy relevant files as in "*${SFORC}*.nc"
+#NFORC="PAPA"         ; i_sea_ice=0 ; SFORC="Station_PAPA_50N-145W"
+#NFORC="ERA5_arctic" ; i_sea_ice=1 ; SFORC="ERA5_arctic_surface_81N_36p75E_1h" ; # "ERA5_arctic" WITH ice/air flux computation
+NFORC="ERA5_arctic" ; i_sea_ice=0 ; SFORC="ERA5_arctic_surface_81N_36p75E_1h" ; # "ERA5_arctic" WITHOUT ice/air flux computation
+
+
 # Root directory NEMOGCM reference depository where to fetch compiled STATION_ASF nemo.exe + default namelists:
 NEMO_REF_DIR="`dirname ${PWD} | sed -e 's|/tests/STATION_ASF||g'`" ; # that should normally do the trick!
@@ -28,10 +37,4 @@
 
 
-# Atmo + SSX forcing to use and wheter to compute fluxes over sea-ice as well (i_sea_ice=1)
-#############################################################################################
-i_sea_ice=0 ; # default does not compute fluxes over sea-ice
-#
-NFORC="ERA5_arctic" ; i_sea_ice=1 ; FORC="ERA5_arctic_surface_81N_36p75E_1h" ; # string sufficient to copy relevant files as in "*${FORC}*.nc"
-#NFORC="PAPA" ; FORC="Station_PAPA_50N-145W" ; # string sufficient to copy relevant files as in "*${FORC}*.nc"
 
 
@@ -154,7 +157,7 @@
 # Copy forcing to work directory:
 echo ; echo "Forcing files to use:"
-\ls -l ${DATA_IN_DIR}/*${FORC}*.nc
-echo
-rsync -avP ${DATA_IN_DIR}/*${FORC}*.nc ${PROD_DIR}/
+\ls -l ${DATA_IN_DIR}/*${SFORC}*.nc
+echo
+rsync -avP ${DATA_IN_DIR}/*${SFORC}*.nc ${PROD_DIR}/
 echo; echo
 
Index: NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/plot_station_asf_OCE.py
===================================================================
--- NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/plot_station_asf_OCE.py	(revision 13686)
+++ NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/plot_station_asf_OCE.py	(revision 13690)
@@ -1,10 +1,15 @@
 #!/usr/bin/env python3
 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-
-# Post-diagnostic of STATION_ASF /  L. Brodeau, 2019
+#
+##########################################################################################
+# Post-diagnostic of STATION_ASF for ocean only  (no sea-ice support)
+#
+#  L. Brodeau, 2020
+##########################################################################################
 
 import sys
 from os import path as path
-import math
+import argparse as ap
+from math import floor, ceil, copysign, log
 import numpy as nmp
 from netCDF4 import Dataset,num2date
@@ -14,33 +19,17 @@
 import matplotlib.dates as mdates
 
-
-cforcing = 'PAPA' ; # name of forcing ('PAPA', 'ERA5_arctic', etc...)
-
-cy1     = '2018' ; # First year
-cy2     = '2018' ; # Last year
-
-jt0 = 0
-
 dir_figs='.'
 size_fig=(13,8)
 size_fig0=(12,10)
-fig_ext='svg'
 
 clr_red = '#AD0000'
-clr_sat = '#ffed00'
 clr_mod = '#008ab8'
 
 rDPI=100.
 
-L_ALGOS = [ 'COARE3p6' , 'ECMWF'   , 'NCAR' , 'ANDREAS' ]
-l_color = [  '#ffed00' , '#008ab8' , '0.4'  , '0.8'     ] ; # colors to differentiate algos on the plot
-l_width = [     3      ,    2      ,  1     ,  3        ] ; # line-width to differentiate algos on the plot
-l_style = [    '-'     ,   '-'     , '--'   , '-'       ] ; # line-style
-
-
-# Variables to compare for A GIVEN algorithm
-###############################################
-#L_VNEM0 = [ 
-
+L_ALGOS = [ 'ANDREAS' , 'COARE3p6' , 'ECMWF'   , 'NCAR' ]
+l_color = [ '0.85'    ,  '#ffed00' , '#008ab8' , '0.4'  ] ; # colors to differentiate algos on the plot
+l_width = [  4        ,     3      ,    2      ,  1     ] ; # line-width to differentiate algos on the plot
+l_style = [ '-'       ,    '-'     ,   '-'     , '--'   ] ; # line-style
 
 
@@ -51,6 +40,6 @@
 L_VARL  = [ r'$C_{D}$'  , r'$C_{E}$'  , r'$Q_{lat}$', r'$Q_{sens}$' , r'$Q_{net}$' , r'$Q_{lw}$' , r'$|\tau|$' , r'$\Delta T_{skin}$' ] ; # name of variable in latex mode
 L_VUNT  = [     ''      ,     ''      , r'$W/m^2$'  , r'$W/m^2$'    , r'$W/m^2$'   , r'$W/m^2$'  , r'$N/m^2$'  ,      'K'             ]
-L_VMAX  = [    0.0075   ,    0.005    ,     75.     ,     75.       ,    800.      ,     25.     ,    1.2      ,       0.7            ]
-L_VMIN  = [    0.0005   ,    0.0005   ,   -250.     ,   -125.       ,   -400.      ,   -150.     ,    0.       ,      -0.7            ]
+L_BASE  = [    0.005    ,    0.005    ,      5.     ,      5.       ,       5      ,      5.     ,    0.05      ,       0.05           ]
+L_PREC  = [      3      ,      3      ,      0      ,      0        ,       0      ,      0      ,     2       ,        3             ]
 L_ANOM  = [   False     ,   False     ,   True      ,    True       ,    True      ,    True     ,   True      ,      False           ]
 
@@ -58,9 +47,38 @@
 nb_algos = len(L_ALGOS) ; print(nb_algos)
 
-# Getting arguments:
-narg = len(sys.argv)
-if narg != 2:
-    print('Usage: '+sys.argv[0]+' <DIR_OUT_SASF>'); sys.exit(0)
-cdir_data = sys.argv[1]
+
+
+
+################## ARGUMENT PARSING / USAGE ################################################################################################
+parser = ap.ArgumentParser(description='Generate pixel maps of a given scalar.')
+#
+requiredNamed = parser.add_argument_group('required arguments')
+requiredNamed.add_argument('-d', '--dirout' , required=True,                 help='Path to (production) directory where STATION_ASF was run')
+requiredNamed.add_argument('-f', '--forcing', required=True, default="PAPA", help='Name of forcing (ex: PAPA, ERA5_arctic')
+#
+parser.add_argument('-C', '--conf',   default="STATION_ASF",  help='specify NEMO config (ex: STATION_ASF)')
+parser.add_argument('-s', '--ystart', default="2018",         help='specify first year of experiment (ex: 2018)')
+parser.add_argument('-e', '--yend',   default="2018",         help='specify last  year of experiment (ex: 2018)')
+#
+parser.add_argument('-t', '--itype',   default="png",         help='specify the type of image you want to create (ex: png, svg, etc.)')
+#parser.add_argument('-l', '--lev' , type=int, default=0,    help='specify the level to use if 3D field (default: 0 => 2D)')
+#parser.add_argument('-I', '--ice' , action='store_true',    help='draw sea-ice concentration layer onto the field')
+#
+args = parser.parse_args()
+#
+cdir_data = args.dirout
+cforcing  = args.forcing
+#
+CONF      = args.conf
+cy1       = args.ystart
+cy2       = args.yend
+#
+fig_ext   = args.itype
+#jk    = args.lev
+#lshow_ice = args.ice
+#
+#print(''); print(' *** cdir_data = ', cdir_data); print(' *** cforcing  = ', cforcing)
+#print(' *** CONF = ', CONF); print(' *** cy1 = ', cy1); print(' *** cy2 = ', cy2)
+###############################################################################################################################################
 
 
@@ -76,5 +94,5 @@
 cf_in = []
 for ja in range(nb_algos):
-    cfi = cdir_data+'/output/'+'STATION_ASF-'+L_ALGOS[ja]+'_'+cforcing+'_1h_'+cy1+'0101_'+cy2+'1231_gridT.nc'
+    cfi = cdir_data+'/output/'+CONF+'-'+L_ALGOS[ja]+'_'+cforcing+'_1h_'+cy1+'0101_'+cy2+'1231_gridT.nc'
     chck4f(cfi)
     cf_in.append(cfi)
@@ -84,7 +102,14 @@
 
 
+def round_bounds( x1, x2,  base=5, prec=3 ):
+    rmin =  base * round( floor(float(x1)/base), prec )
+    rmax =  base * round(  ceil(float(x2)/base), prec )
+    return rmin, rmax
+
+
+
 # Getting time array from the first file:
 id_in = Dataset(cf_in[0])
-vt = id_in.variables['time_counter'][jt0:]
+vt = id_in.variables['time_counter'][:]
 cunit_t = id_in.variables['time_counter'].units ; print(' "time_counter" is in "'+cunit_t+'"')
 id_in.close()
@@ -133,5 +158,5 @@
     id_in = Dataset(cf_in[ja])
     for jv in range(ntemp):
-        xxx[:,jv] = id_in.variables[vtemp_in[jv]][jt0:,1,1] # only the center point of the 3x3 spatial domain!
+        xxx[:,jv] = id_in.variables[vtemp_in[jv]][:,1,1] # only the center point of the 3x3 spatial domain!
     id_in.close()
 
@@ -145,5 +170,7 @@
         plt.plot(vtime, xxx[:,jv], '-', color=vtemp_cl[jv], linestyle=vtemp_ls[jv], linewidth=vtemp_lw[jv], label=vtemp_lb[jv], zorder=10)
 
-    ax1.set_ylim(0., 17.) ; ax1.set_xlim(vtime[0],vtime[nbr-1])
+    idx_okay = nmp.where( nmp.abs(xxx) < 1.e+10 )
+    fmin, fmax = round_bounds( nmp.min(xxx[idx_okay]) , nmp.max(xxx[idx_okay]), base=5, prec=0 )
+    ax1.set_ylim(fmin, fmax) ; ax1.set_xlim(vtime[0],vtime[nbr-1])
     plt.ylabel(r'Temperature [$^{\circ}$C]')
 
@@ -151,5 +178,5 @@
     plt.legend(loc='best', ncol=1, shadow=True, fancybox=True)
     ax1.annotate('Algo: '+L_ALGOS[ja]+', station: '+cforcing, xy=(0.4, 1.), xycoords='axes fraction',  bbox={'facecolor':'w', 'alpha':1., 'pad':10}, zorder=50, **font_inf)
-    plt.savefig('01_temperatures_'+L_ALGOS[ja]+'.'+fig_ext, dpi=int(rDPI), transparent=False)
+    plt.savefig('01_temperatures_'+L_ALGOS[ja]+'_'+cforcing+'.'+fig_ext, dpi=int(rDPI), transparent=False)
     plt.close(1)
 
@@ -173,8 +200,10 @@
         #
         id_in = Dataset(cf_in[ja])
-        xF[:,ja] = id_in.variables[L_VNEM[jv]][jt0:,1,1] # only the center point of the 3x3 spatial domain!
+        xF[:,ja] = id_in.variables[L_VNEM[jv]][:,1,1] # only the center point of the 3x3 spatial domain!
         if ja == 0: cvar_lnm = id_in.variables[L_VNEM[jv]].long_name
         id_in.close()
 
+    idx_okay = nmp.where( nmp.abs(xF) < 1.e+10 )
+        
     fig = plt.figure(num = jv, figsize=size_fig, facecolor='w', edgecolor='k')
     ax1 = plt.axes([0.08, 0.25, 0.9, 0.7])
@@ -185,12 +214,16 @@
     for ja in range(nb_algos):
         plt.plot(vtime, xF[:,ja], '-', color=l_color[ja], linestyle=l_style[ja], linewidth=l_width[ja], label=L_ALGOS[ja], zorder=10+ja)
-
-    ax1.set_ylim(L_VMIN[jv], L_VMAX[jv]) ; ax1.set_xlim(vtime[0],vtime[nbr-1])
+        
+    fmin, fmax = round_bounds( nmp.min(xF[idx_okay]) , nmp.max(xF[idx_okay]), base=L_BASE[jv], prec=L_PREC[jv])
+    #print("LOLO: fmin, fmax =",nmp.min(xF[idx_okay]), nmp.max(xF[idx_okay]) ); print("LOLO: fmin, fmax =",fmin, fmax) ; #sys.exit(0)
+    
+    ax1.set_ylim(fmin, fmax) ; ax1.set_xlim(vtime[0],vtime[nbr-1])
     plt.ylabel(L_VARL[jv]+' ['+L_VUNT[jv]+']')
 
     ax1.grid(color='k', linestyle='-', linewidth=0.3)
     plt.legend(loc='best', ncol=1, shadow=True, fancybox=True)
-    ax1.annotate(cvar_lnm+', station: '+cforcing, xy=(0.3, 1.), xycoords='axes fraction',  bbox={'facecolor':'w', 'alpha':1., 'pad':10}, zorder=50, **font_inf)
-    plt.savefig(L_VARO[jv]+'.'+fig_ext, dpi=int(rDPI), transparent=False)
+    ax1.annotate(cvar_lnm+', station: '+cforcing, xy=(0.3, 1.), xycoords='axes fraction',  bbox={'facecolor':'w', 'alpha':1., 'pad':10}, \
+                 zorder=50, **font_inf)
+    plt.savefig(L_VARO[jv]+'_'+cforcing+'.'+fig_ext, dpi=int(rDPI), transparent=False)
     plt.close(jv)
 
@@ -208,7 +241,7 @@
             rmax = nmp.max(xFa) ; rmin = nmp.min(xFa)
             rmax = max( abs(rmax) , abs(rmin) )
-            romagn = math.floor(math.log(rmax, 10)) ; # order of magnitude of the anomaly  we're dealing with
+            romagn = floor(log(rmax, 10)) ; # order of magnitude of the anomaly  we're dealing with
             rmlt = 10.**(int(romagn)) / 2.
-            yrng = math.copysign( math.ceil(abs(rmax)/rmlt)*rmlt , rmax)
+            yrng = copysign( ceil(abs(rmax)/rmlt)*rmlt , rmax)
 
             fig = plt.figure(num = 10+jv, figsize=size_fig, facecolor='w', edgecolor='k')
@@ -226,5 +259,5 @@
             plt.legend(bbox_to_anchor=(0.45, 0.2), ncol=1, shadow=True, fancybox=True)
             ax1.annotate('Anomaly of '+cvar_lnm, xy=(0.3, 0.97), xycoords='axes fraction',  bbox={'facecolor':'w', 'alpha':1., 'pad':10}, zorder=50, **font_inf)
-            plt.savefig(L_VARO[jv]+'_anomaly.'+fig_ext, dpi=int(rDPI), transparent=False)
+            plt.savefig(L_VARO[jv]+'_'+cforcing+'.'+fig_ext, dpi=int(rDPI), transparent=False)
             plt.close(10+jv)
 
Index: NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/plot_station_asf_OI.py
===================================================================
--- NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/plot_station_asf_OI.py	(revision 13686)
+++ NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/plot_station_asf_OI.py	(revision 13690)
@@ -1,6 +1,10 @@
 #!/usr/bin/env python3
 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-
-# Post-diagnostic of STATION_ASF /  L. Brodeau, 2019
+#
+##########################################################################################
+# Post-diagnostic of STATION_ASF with sea-ice support (ex: run with forcing "ERA5_arctic")
+#
+#  L. Brodeau, 2020
+##########################################################################################
 
 import sys
@@ -15,6 +19,8 @@
 
 CONFIG='STATION_ASF'
-FORCING='ERA5_arctic'
-# (files are: output/3x3/'+CONFIG+'-'+algo+'_1h_'+year+'0101_'+year+'1231_gridT_'+FORCING+'.nc' )
+
+cforcing = 'PAPA' ; # name of forcing ('PAPA', 'ERA5_arctic', etc...)
+
+# (files are: output/3x3/'+CONFIG+'-'+algo+'_1h_'+year+'0101_'+year+'1231_gridT_'+cforcing+'.nc' )
 cstation = 'ERA5 81N, 36.75E'
 
@@ -77,5 +83,5 @@
 cf_in = []
 for ja in range(nb_algos):
-    cfi = cdir_data+'/output/3x3/'+CONFIG+'-'+L_ALGOS[ja]+'_1h_'+cy1+'0101_'+cy2+'1231_icemod_'+FORCING+'.nc'
+    cfi = cdir_data+'/output/3x3/'+CONFIG+'-'+L_ALGOS[ja]+'_1h_'+cy1+'0101_'+cy2+'1231_icemod_'+cforcing+'.nc'
     chck4f(cfi)
     cf_in.append(cfi)
Index: NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/sbcblk_sanity_check.sh
===================================================================
--- NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/sbcblk_sanity_check.sh	(revision 13686)
+++ NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/sbcblk_sanity_check.sh	(revision 13690)
@@ -24,4 +24,8 @@
 CONFIG_BLD="STATION_ASF2" ; # name of config as build in NEMO... (directory inside "tests" actually contains the compiled test-case?)
 
+# Atmo + SSX forcing to use and sea-ice support?
+NFORC="IDEALIZED" ; i_sea_ice=0 ; SFORC="input_output_VALIDATION_IDEALIZED.nc"
+
+
 # Root directory NEMOGCM reference depository where to fetch compiled STATION_ASF nemo.exe + default namelists:
 NEMO_REF_DIR="`dirname ${PWD} | sed -e 's|/tests/STATION_ASF||g'`" ; # that should normally do the trick!
@@ -38,8 +42,4 @@
 
 
-# Atmo + SSX forcing to use and wheter to compute fluxes over sea-ice as well (i_sea_ice=1)
-#############################################################################################
-i_sea_ice=0 ; # default does not compute fluxes over sea-ice
-NFORC="IDEALIZED" ; i_sea_ice=0 ; FORC="input_output_VALIDATION_IDEALIZED.nc" ; # for now the sanity test does not test ice-atmo bulk parameterizations
 
 
@@ -153,7 +153,7 @@
 # Copy forcing to work directory:
 echo ; echo "Forcing files to use:"
-\ls -l ${DATA_IN_DIR}/${FORC}
-echo
-rsync -avP ${DATA_IN_DIR}/${FORC} ${PROD_DIR}/
+\ls -l ${DATA_IN_DIR}/${SFORC}
+echo
+rsync -avP ${DATA_IN_DIR}/${SFORC} ${PROD_DIR}/
 echo; echo
 
@@ -205,5 +205,5 @@
 
 cd ${HERE}
-python3 ./analyze_output.py ${DATA_IN_DIR}/${FORC} ${PROD_DIR}/output ${cmore}
-
-
+python3 ./analyze_output.py ${DATA_IN_DIR}/${SFORC} ${PROD_DIR}/output ${cmore}
+
+
