Changeset 13690
- Timestamp:
- 2020-10-28T13:11:40+01:00 (3 years ago)
- Location:
- NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/launch_sasf.sh
r13682 r13690 14 14 CONFIG_BLD="STATION_ASF2" ; # name of config as build in NEMO... (directory inside "tests" actually contains the compiled test-case?) 15 15 16 # Atmo + SSX forcing to use and sea-ice support? 17 # => NFORC: name of forcing 18 # => i_sea_ice: whether to compute fluxes over sea-ice as well 19 # => SFORC: string sufficient to copy relevant files as in "*${SFORC}*.nc" 20 #NFORC="PAPA" ; i_sea_ice=0 ; SFORC="Station_PAPA_50N-145W" 21 #NFORC="ERA5_arctic" ; i_sea_ice=1 ; SFORC="ERA5_arctic_surface_81N_36p75E_1h" ; # "ERA5_arctic" WITH ice/air flux computation 22 NFORC="ERA5_arctic" ; i_sea_ice=0 ; SFORC="ERA5_arctic_surface_81N_36p75E_1h" ; # "ERA5_arctic" WITHOUT ice/air flux computation 23 24 16 25 # Root directory NEMOGCM reference depository where to fetch compiled STATION_ASF nemo.exe + default namelists: 17 26 NEMO_REF_DIR="`dirname ${PWD} | sed -e 's|/tests/STATION_ASF||g'`" ; # that should normally do the trick! … … 28 37 29 38 30 # Atmo + SSX forcing to use and wheter to compute fluxes over sea-ice as well (i_sea_ice=1)31 #############################################################################################32 i_sea_ice=0 ; # default does not compute fluxes over sea-ice33 #34 NFORC="ERA5_arctic" ; i_sea_ice=1 ; FORC="ERA5_arctic_surface_81N_36p75E_1h" ; # string sufficient to copy relevant files as in "*${FORC}*.nc"35 #NFORC="PAPA" ; FORC="Station_PAPA_50N-145W" ; # string sufficient to copy relevant files as in "*${FORC}*.nc"36 39 37 40 … … 154 157 # Copy forcing to work directory: 155 158 echo ; echo "Forcing files to use:" 156 \ls -l ${DATA_IN_DIR}/*${ FORC}*.nc157 echo 158 rsync -avP ${DATA_IN_DIR}/*${ FORC}*.nc ${PROD_DIR}/159 \ls -l ${DATA_IN_DIR}/*${SFORC}*.nc 160 echo 161 rsync -avP ${DATA_IN_DIR}/*${SFORC}*.nc ${PROD_DIR}/ 159 162 echo; echo 160 163 -
NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/plot_station_asf_OCE.py
r13676 r13690 1 1 #!/usr/bin/env python3 2 2 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 3 4 # Post-diagnostic of STATION_ASF / L. Brodeau, 2019 3 # 4 ########################################################################################## 5 # Post-diagnostic of STATION_ASF for ocean only (no sea-ice support) 6 # 7 # L. Brodeau, 2020 8 ########################################################################################## 5 9 6 10 import sys 7 11 from os import path as path 8 import math 12 import argparse as ap 13 from math import floor, ceil, copysign, log 9 14 import numpy as nmp 10 15 from netCDF4 import Dataset,num2date … … 14 19 import matplotlib.dates as mdates 15 20 16 17 cforcing = 'PAPA' ; # name of forcing ('PAPA', 'ERA5_arctic', etc...)18 19 cy1 = '2018' ; # First year20 cy2 = '2018' ; # Last year21 22 jt0 = 023 24 21 dir_figs='.' 25 22 size_fig=(13,8) 26 23 size_fig0=(12,10) 27 fig_ext='svg'28 24 29 25 clr_red = '#AD0000' 30 clr_sat = '#ffed00'31 26 clr_mod = '#008ab8' 32 27 33 28 rDPI=100. 34 29 35 L_ALGOS = [ 'COARE3p6' , 'ECMWF' , 'NCAR' , 'ANDREAS' ] 36 l_color = [ '#ffed00' , '#008ab8' , '0.4' , '0.8' ] ; # colors to differentiate algos on the plot 37 l_width = [ 3 , 2 , 1 , 3 ] ; # line-width to differentiate algos on the plot 38 l_style = [ '-' , '-' , '--' , '-' ] ; # line-style 39 40 41 # Variables to compare for A GIVEN algorithm 42 ############################################### 43 #L_VNEM0 = [ 44 30 L_ALGOS = [ 'ANDREAS' , 'COARE3p6' , 'ECMWF' , 'NCAR' ] 31 l_color = [ '0.85' , '#ffed00' , '#008ab8' , '0.4' ] ; # colors to differentiate algos on the plot 32 l_width = [ 4 , 3 , 2 , 1 ] ; # line-width to differentiate algos on the plot 33 l_style = [ '-' , '-' , '-' , '--' ] ; # line-style 45 34 46 35 … … 51 40 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 52 41 L_VUNT = [ '' , '' , r'$W/m^2$' , r'$W/m^2$' , r'$W/m^2$' , r'$W/m^2$' , r'$N/m^2$' , 'K' ] 53 L_ VMAX = [ 0.0075 , 0.005 , 75. , 75. , 800. , 25. , 1.2 , 0.7]54 L_ VMIN = [ 0.0005 , 0.0005 , -250. , -125. , -400. , -150. , 0. , -0.7]42 L_BASE = [ 0.005 , 0.005 , 5. , 5. , 5 , 5. , 0.05 , 0.05 ] 43 L_PREC = [ 3 , 3 , 0 , 0 , 0 , 0 , 2 , 3 ] 55 44 L_ANOM = [ False , False , True , True , True , True , True , False ] 56 45 … … 58 47 nb_algos = len(L_ALGOS) ; print(nb_algos) 59 48 60 # Getting arguments: 61 narg = len(sys.argv) 62 if narg != 2: 63 print('Usage: '+sys.argv[0]+' <DIR_OUT_SASF>'); sys.exit(0) 64 cdir_data = sys.argv[1] 49 50 51 52 ################## ARGUMENT PARSING / USAGE ################################################################################################ 53 parser = ap.ArgumentParser(description='Generate pixel maps of a given scalar.') 54 # 55 requiredNamed = parser.add_argument_group('required arguments') 56 requiredNamed.add_argument('-d', '--dirout' , required=True, help='Path to (production) directory where STATION_ASF was run') 57 requiredNamed.add_argument('-f', '--forcing', required=True, default="PAPA", help='Name of forcing (ex: PAPA, ERA5_arctic') 58 # 59 parser.add_argument('-C', '--conf', default="STATION_ASF", help='specify NEMO config (ex: STATION_ASF)') 60 parser.add_argument('-s', '--ystart', default="2018", help='specify first year of experiment (ex: 2018)') 61 parser.add_argument('-e', '--yend', default="2018", help='specify last year of experiment (ex: 2018)') 62 # 63 parser.add_argument('-t', '--itype', default="png", help='specify the type of image you want to create (ex: png, svg, etc.)') 64 #parser.add_argument('-l', '--lev' , type=int, default=0, help='specify the level to use if 3D field (default: 0 => 2D)') 65 #parser.add_argument('-I', '--ice' , action='store_true', help='draw sea-ice concentration layer onto the field') 66 # 67 args = parser.parse_args() 68 # 69 cdir_data = args.dirout 70 cforcing = args.forcing 71 # 72 CONF = args.conf 73 cy1 = args.ystart 74 cy2 = args.yend 75 # 76 fig_ext = args.itype 77 #jk = args.lev 78 #lshow_ice = args.ice 79 # 80 #print(''); print(' *** cdir_data = ', cdir_data); print(' *** cforcing = ', cforcing) 81 #print(' *** CONF = ', CONF); print(' *** cy1 = ', cy1); print(' *** cy2 = ', cy2) 82 ############################################################################################################################################### 65 83 66 84 … … 76 94 cf_in = [] 77 95 for ja in range(nb_algos): 78 cfi = cdir_data+'/output/'+ 'STATION_ASF-'+L_ALGOS[ja]+'_'+cforcing+'_1h_'+cy1+'0101_'+cy2+'1231_gridT.nc'96 cfi = cdir_data+'/output/'+CONF+'-'+L_ALGOS[ja]+'_'+cforcing+'_1h_'+cy1+'0101_'+cy2+'1231_gridT.nc' 79 97 chck4f(cfi) 80 98 cf_in.append(cfi) … … 84 102 85 103 104 def round_bounds( x1, x2, base=5, prec=3 ): 105 rmin = base * round( floor(float(x1)/base), prec ) 106 rmax = base * round( ceil(float(x2)/base), prec ) 107 return rmin, rmax 108 109 110 86 111 # Getting time array from the first file: 87 112 id_in = Dataset(cf_in[0]) 88 vt = id_in.variables['time_counter'][ jt0:]113 vt = id_in.variables['time_counter'][:] 89 114 cunit_t = id_in.variables['time_counter'].units ; print(' "time_counter" is in "'+cunit_t+'"') 90 115 id_in.close() … … 133 158 id_in = Dataset(cf_in[ja]) 134 159 for jv in range(ntemp): 135 xxx[:,jv] = id_in.variables[vtemp_in[jv]][ jt0:,1,1] # only the center point of the 3x3 spatial domain!160 xxx[:,jv] = id_in.variables[vtemp_in[jv]][:,1,1] # only the center point of the 3x3 spatial domain! 136 161 id_in.close() 137 162 … … 145 170 plt.plot(vtime, xxx[:,jv], '-', color=vtemp_cl[jv], linestyle=vtemp_ls[jv], linewidth=vtemp_lw[jv], label=vtemp_lb[jv], zorder=10) 146 171 147 ax1.set_ylim(0., 17.) ; ax1.set_xlim(vtime[0],vtime[nbr-1]) 172 idx_okay = nmp.where( nmp.abs(xxx) < 1.e+10 ) 173 fmin, fmax = round_bounds( nmp.min(xxx[idx_okay]) , nmp.max(xxx[idx_okay]), base=5, prec=0 ) 174 ax1.set_ylim(fmin, fmax) ; ax1.set_xlim(vtime[0],vtime[nbr-1]) 148 175 plt.ylabel(r'Temperature [$^{\circ}$C]') 149 176 … … 151 178 plt.legend(loc='best', ncol=1, shadow=True, fancybox=True) 152 179 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) 153 plt.savefig('01_temperatures_'+L_ALGOS[ja]+' .'+fig_ext, dpi=int(rDPI), transparent=False)180 plt.savefig('01_temperatures_'+L_ALGOS[ja]+'_'+cforcing+'.'+fig_ext, dpi=int(rDPI), transparent=False) 154 181 plt.close(1) 155 182 … … 173 200 # 174 201 id_in = Dataset(cf_in[ja]) 175 xF[:,ja] = id_in.variables[L_VNEM[jv]][ jt0:,1,1] # only the center point of the 3x3 spatial domain!202 xF[:,ja] = id_in.variables[L_VNEM[jv]][:,1,1] # only the center point of the 3x3 spatial domain! 176 203 if ja == 0: cvar_lnm = id_in.variables[L_VNEM[jv]].long_name 177 204 id_in.close() 178 205 206 idx_okay = nmp.where( nmp.abs(xF) < 1.e+10 ) 207 179 208 fig = plt.figure(num = jv, figsize=size_fig, facecolor='w', edgecolor='k') 180 209 ax1 = plt.axes([0.08, 0.25, 0.9, 0.7]) … … 185 214 for ja in range(nb_algos): 186 215 plt.plot(vtime, xF[:,ja], '-', color=l_color[ja], linestyle=l_style[ja], linewidth=l_width[ja], label=L_ALGOS[ja], zorder=10+ja) 187 188 ax1.set_ylim(L_VMIN[jv], L_VMAX[jv]) ; ax1.set_xlim(vtime[0],vtime[nbr-1]) 216 217 fmin, fmax = round_bounds( nmp.min(xF[idx_okay]) , nmp.max(xF[idx_okay]), base=L_BASE[jv], prec=L_PREC[jv]) 218 #print("LOLO: fmin, fmax =",nmp.min(xF[idx_okay]), nmp.max(xF[idx_okay]) ); print("LOLO: fmin, fmax =",fmin, fmax) ; #sys.exit(0) 219 220 ax1.set_ylim(fmin, fmax) ; ax1.set_xlim(vtime[0],vtime[nbr-1]) 189 221 plt.ylabel(L_VARL[jv]+' ['+L_VUNT[jv]+']') 190 222 191 223 ax1.grid(color='k', linestyle='-', linewidth=0.3) 192 224 plt.legend(loc='best', ncol=1, shadow=True, fancybox=True) 193 ax1.annotate(cvar_lnm+', station: '+cforcing, xy=(0.3, 1.), xycoords='axes fraction', bbox={'facecolor':'w', 'alpha':1., 'pad':10}, zorder=50, **font_inf) 194 plt.savefig(L_VARO[jv]+'.'+fig_ext, dpi=int(rDPI), transparent=False) 225 ax1.annotate(cvar_lnm+', station: '+cforcing, xy=(0.3, 1.), xycoords='axes fraction', bbox={'facecolor':'w', 'alpha':1., 'pad':10}, \ 226 zorder=50, **font_inf) 227 plt.savefig(L_VARO[jv]+'_'+cforcing+'.'+fig_ext, dpi=int(rDPI), transparent=False) 195 228 plt.close(jv) 196 229 … … 208 241 rmax = nmp.max(xFa) ; rmin = nmp.min(xFa) 209 242 rmax = max( abs(rmax) , abs(rmin) ) 210 romagn = math.floor(math.log(rmax, 10)) ; # order of magnitude of the anomaly we're dealing with243 romagn = floor(log(rmax, 10)) ; # order of magnitude of the anomaly we're dealing with 211 244 rmlt = 10.**(int(romagn)) / 2. 212 yrng = math.copysign( math.ceil(abs(rmax)/rmlt)*rmlt , rmax)245 yrng = copysign( ceil(abs(rmax)/rmlt)*rmlt , rmax) 213 246 214 247 fig = plt.figure(num = 10+jv, figsize=size_fig, facecolor='w', edgecolor='k') … … 226 259 plt.legend(bbox_to_anchor=(0.45, 0.2), ncol=1, shadow=True, fancybox=True) 227 260 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) 228 plt.savefig(L_VARO[jv]+'_ anomaly.'+fig_ext, dpi=int(rDPI), transparent=False)261 plt.savefig(L_VARO[jv]+'_'+cforcing+'.'+fig_ext, dpi=int(rDPI), transparent=False) 229 262 plt.close(10+jv) 230 263 -
NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/plot_station_asf_OI.py
r13675 r13690 1 1 #!/usr/bin/env python3 2 2 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 3 4 # Post-diagnostic of STATION_ASF / L. Brodeau, 2019 3 # 4 ########################################################################################## 5 # Post-diagnostic of STATION_ASF with sea-ice support (ex: run with forcing "ERA5_arctic") 6 # 7 # L. Brodeau, 2020 8 ########################################################################################## 5 9 6 10 import sys … … 15 19 16 20 CONFIG='STATION_ASF' 17 FORCING='ERA5_arctic' 18 # (files are: output/3x3/'+CONFIG+'-'+algo+'_1h_'+year+'0101_'+year+'1231_gridT_'+FORCING+'.nc' ) 21 22 cforcing = 'PAPA' ; # name of forcing ('PAPA', 'ERA5_arctic', etc...) 23 24 # (files are: output/3x3/'+CONFIG+'-'+algo+'_1h_'+year+'0101_'+year+'1231_gridT_'+cforcing+'.nc' ) 19 25 cstation = 'ERA5 81N, 36.75E' 20 26 … … 77 83 cf_in = [] 78 84 for ja in range(nb_algos): 79 cfi = cdir_data+'/output/3x3/'+CONFIG+'-'+L_ALGOS[ja]+'_1h_'+cy1+'0101_'+cy2+'1231_icemod_'+ FORCING+'.nc'85 cfi = cdir_data+'/output/3x3/'+CONFIG+'-'+L_ALGOS[ja]+'_1h_'+cy1+'0101_'+cy2+'1231_icemod_'+cforcing+'.nc' 80 86 chck4f(cfi) 81 87 cf_in.append(cfi) -
NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/sbcblk_sanity_check.sh
r13686 r13690 24 24 CONFIG_BLD="STATION_ASF2" ; # name of config as build in NEMO... (directory inside "tests" actually contains the compiled test-case?) 25 25 26 # Atmo + SSX forcing to use and sea-ice support? 27 NFORC="IDEALIZED" ; i_sea_ice=0 ; SFORC="input_output_VALIDATION_IDEALIZED.nc" 28 29 26 30 # Root directory NEMOGCM reference depository where to fetch compiled STATION_ASF nemo.exe + default namelists: 27 31 NEMO_REF_DIR="`dirname ${PWD} | sed -e 's|/tests/STATION_ASF||g'`" ; # that should normally do the trick! … … 38 42 39 43 40 # Atmo + SSX forcing to use and wheter to compute fluxes over sea-ice as well (i_sea_ice=1)41 #############################################################################################42 i_sea_ice=0 ; # default does not compute fluxes over sea-ice43 NFORC="IDEALIZED" ; i_sea_ice=0 ; FORC="input_output_VALIDATION_IDEALIZED.nc" ; # for now the sanity test does not test ice-atmo bulk parameterizations44 44 45 45 … … 153 153 # Copy forcing to work directory: 154 154 echo ; echo "Forcing files to use:" 155 \ls -l ${DATA_IN_DIR}/${ FORC}156 echo 157 rsync -avP ${DATA_IN_DIR}/${ FORC} ${PROD_DIR}/155 \ls -l ${DATA_IN_DIR}/${SFORC} 156 echo 157 rsync -avP ${DATA_IN_DIR}/${SFORC} ${PROD_DIR}/ 158 158 echo; echo 159 159 … … 205 205 206 206 cd ${HERE} 207 python3 ./analyze_output.py ${DATA_IN_DIR}/${ FORC} ${PROD_DIR}/output ${cmore}208 209 207 python3 ./analyze_output.py ${DATA_IN_DIR}/${SFORC} ${PROD_DIR}/output ${cmore} 208 209
Note: See TracChangeset
for help on using the changeset viewer.