...
 
Commits (6)
......@@ -4,4 +4,4 @@ vars_list=$(echo $vars_str | tr "," "\n")
for v in $vars_list; do
ncatted -a _FillValue,$v,o,f,"-32768" output.nc
done
ncatted -a _FillValue,h,o,f,"-32768" output.nc
......@@ -15,7 +15,7 @@ if rank == 0:
grid_res = float(sys.argv[4])
depth_layers = np.asarray(sys.argv[5].split(','), dtype=float)
var_list_raw = sys.argv[6].split(',')
varmatch = {'temp':'nodes', 'salinity':'nodes', 'u':'elements', 'v':'elements', 'zeta':'surface'}
varmatch = {'temp':'nodes', 'salinity':'nodes', 'u':'elements', 'v':'elements', 'zeta':'surface', 'ww':'elements'}
varlist = {}
for this_var in var_list_raw:
varlist[this_var] = varmatch[this_var]
......@@ -67,17 +67,16 @@ if rank == 0:
worker.fvcom_grid.select_ll = worker.fvcom_grid.ll
h = worker._Interpolater(worker.fvcom_grid.h)
grid_in_domain = pf.read.FileReader(worker.fvcom_file).in_domain(worker.regular_grid.mesh_lons, worker.regular_grid.mesh_lats)
grid_in_domain = np.reshape(pf.read.FileReader(worker.fvcom_file).in_domain(worker.regular_grid.mesh_lons.ravel(), worker.regular_grid.mesh_lats.ravel()), worker.regular_grid.mesh_lats.shape)
h[~grid_in_domain] = np.nan
h = h.T
land_mask = np.zeros([h.shape[0], h.shape[1], len(depth_layers)])
land_mask = np.zeros([len(depth_layers), h.shape[0], h.shape[1]])
for i, this_depth in enumerate(depth_layers):
if this_depth == 0:
land_mask[~np.isnan(h)] = 1
land_mask[i,~np.isnan(h)] = 1
else:
land_mask[:,:,i][h > this_depth] = 1
land_mask[i,:,:][h > this_depth] = 1
# write to cmems format
fvcom = pf.read.FileReader(fvcom_file)
......@@ -90,10 +89,11 @@ if rank == 0:
all_attributes = {'lon':{'standard_name':'longitude', 'units':'degrees_east', 'long_name':'longitude'},
'lat':{'standard_name':'latitude', 'units':'degrees_north', 'long_name':'latitude'},
'depth':{'standard_name':'depth', 'units':'m', 'long_name':'depth, measured downwards from free surface', 'axis':'Z', 'positive':'down'},
'h':{'standard_name':'h', 'units':'m', 'long_name':'model bathymetry depth, measured downwards from geoid', 'axis':'Z', 'positive':'down'},
'h':{'standard_name':'h', 'units':'m', 'long_name':'model bathymetry depth, measured downwards from geoid', 'axis':'Z', 'positive':'down', 'missing_value':-32768},
'temp':{'standard_name':'sea_water_potential_temperature','units':'C','missing_value':-32768, 'long_name':'Sea Water Potential Temperature'} ,
'salinity':{'standard_name':'sea_water_salinity','units':'psu', 'missing_value':-32768, 'long_name':'Sea Water Salinity'},
'u':{'standard_name':'eastward_sea_water_velocity','units':'m s-1', 'missing_value':-32768, 'long_name':'Eastward Current Velocity'},
'ww':{'standard_name':'upward_sea_water_velocity','units':'m s-1', 'missing_value':-32768, 'long_name':'Upward Current Velocity'},
'v':{'standard_name':'northward_sea_water_velocity','units':'m s-1', 'missing_value':-32768, 'long_name':'Northward Current Velocity'},
'zeta':{'standard_name':'sea_surface_height_above_geoid','units':'m', 'missing_value':-32768,'long_name':'Sea surface height above geoid'},
'mask':{'standard_name':'sea_binary_mask','units':'1', 'long_name':'Land-sea mask: sea = 1 ; land = 0'}}
......@@ -107,7 +107,10 @@ if rank == 0:
for this_val in collected_interp_data.values():
np.ma.set_fill_value(this_val, -32768)
ncopts = {}
ncopts = {'zlib':True, 'complevel':7, 'least_significant_digit':4}
h = np.ma.masked_invalid(h)
np.ma.set_fill_value(h, -32768)
#for this_var, this_mode in varlist.items():
# this_output_file_name = 'output_{}.nc'.format(this_var)
......@@ -118,15 +121,15 @@ if rank == 0:
outfile.add_variable('lon', worker.regular_grid.lons, ['lon'], attributes=all_attributes['lon'])
outfile.add_variable('lat', worker.regular_grid.lats, ['lat'], attributes=all_attributes['lat'])
outfile.add_variable('depth', worker.regular_grid.dep_lays, ['depth'], attributes=all_attributes['depth'])
outfile.add_variable('mask', land_mask, ['lon', 'lat', 'depth'], attributes=all_attributes['mask'])
outfile.add_variable('h', h, ['lon', 'lat'], attributes=all_attributes['h'])
outfile.add_variable('mask', land_mask, ['depth', 'lat', 'lon'], attributes=all_attributes['mask'])
outfile.add_variable('h', h, ['lat', 'lon'], attributes=all_attributes['h'])
for this_var, this_mode in varlist.items():
if this_mode == 'surface':
outfile.add_variable(this_var, collected_interp_data[this_var], ['time', 'lon', 'lat'],
outfile.add_variable(this_var, np.swapaxes(collected_interp_data[this_var],1,2), ['time', 'lon', 'lat'],
attributes=all_attributes[this_var], ncopts=ncopts)
else:
outfile.add_variable(this_var, collected_interp_data[this_var], ['time', 'lon', 'lat', 'depth'],
outfile.add_variable(this_var, np.swapaxes(collected_interp_data[this_var],1,3), ['time', 'lon', 'lat', 'depth'],
attributes=all_attributes[this_var], ncopts=ncopts)
else:
......
......@@ -21,7 +21,8 @@ all_attributes = {'lon':{'var_name':'longitude','standard_name':'longitude', 'un
'v':{'var_name':'vo','standard_name':'northward_sea_water_velocity','units':'m s-1', 'missing_value':-32768, 'long_name':'Northward Current Velocity', 'shape':'time depth latitude longitude'},
'zeta':{'var_name':'zos','standard_name':'sea_surface_height_above_geoid','units':'m', 'missing_value':-32768,'long_name':'Sea surface height above geoid', 'shape':'time latitude longitude'},
'mask':{'standard_name':'sea_binary_mask','units':'1', 'long_name':'Land-sea mask: sea = 1 ; land = 0', 'shape':'depth latitude longitude'},
'h':{'standard_name':'h', 'units':'m', 'long_name':'model bathymetry depth, measured downwards from geoid', 'axis':'Z', 'positive':'down', 'shape':'depth latitude longitude' }
'h':{'standard_name':'h', 'units':'m', 'long_name':'model bathymetry depth, measured downwards from geoid', 'axis':'Z', 'positive':'down', 'shape':'latitude longitude' },
'ww':{'var_name':'wo', 'standard_name':'upward_sea_water_velocity','units':'m s-1', 'missing_value':-32768, 'long_name':'Upward Current Velocity', 'shape':'time depth latitude longitude'}
}
all_type = {'add_offset':'float', 'scale_factor':'float', '_FillValue':'double'}
......
[command]
default =
base_file=/${PORTAL_BASEDIR}/${FORECAST_YEAR}/${FORECAST_MONTH}/${OUTPUT_FILENAME}_hrly_${FORECAST_DAY}.nc
mkdir -p /${PORTAL_NCML_BASEDIR}/${FORECAST_YEAR}/${FORECAST_MONTH}/
dst_file=/${PORTAL_NCML_BASEDIR}/${FORECAST_YEAR}/${FORECAST_MONTH}/${OUTPUT_FILENAME}_hrly_${FORECAST_DAY}.ncml
dst_file=/${PORTAL_NCML_BASEDIR}/${NCML_FILE_PRE}${NCML_DATE}${NCML_FILE_POST}.ncml
rm ${dst_file} || true
python3 write_ncml_file.py ${base_file} ${dst_file} ${VARS}
[jinja2:suite.rc]
## Run properties
INITIAL_START_DATE='2020-01-01T00:00:00Z'
INITIAL_START_DATE='2020-03-27T00:00:00Z'
FINAL_CYCLE_POINT='NONE'
MAIL_TO='mbe@pml.ac.uk'
NPROCS=12
NPROCS=20
USE_CETO=True
REMOTE_USER='modop'
NODES=3
......@@ -16,11 +16,14 @@ FVCOM_OUTPUT_DIR='data/sthenno1/scratch/modop/Model/FVCOM_tamar/output'
GRID_LOWER_LEFT='-4.3,50.24'
GRID_UPPER_RIGHT='-4.05,50.55'
HORIZ_RES=0.001
DEPTH_LAYERS='0,3,5,10,15,20,25,30,40'
VARS='temp,salinity,u,v,zeta'
DEPTH_LAYERS='0,3,5,10,15,20,25,30,45'
VARS='temp,salinity,u,v,ww,zeta'
OUTPUT_DIR='data/sthenno1/scratch/modop/Model/FVCOM_tamar/estuary_output'
OUTPUT_FILENAME='tamar_estuary_001'
PORTAL_BASEDIR='data/sthenno1/scratch/modop/Portal/Model/TAMAR_ESTUARY_FORECAST_PHY_001/tamar_estuary_forecast_phy_001_hourly_t_s_u_v_ssh'
PORTAL_NCML_BASEDIR='data/sthenno1/scratch/modop/Portal/Model/test_ncml/tamar_estuary_forecast_phy_001_hourly_t_s_u_v_ssh'
PORTAL_NCML_BASEDIR='data/sthenno1/scratch/modop/Portal/Model/FVCOM/tamar'
NCML_FILE_PRE='MyCOAST_V0_PML_FVCOM_tamar_01hr_'
NCML_FILE_DATEFMT='%Y%m%d%H'
NCML_FILE_POST='_ANPR'
......@@ -27,7 +27,7 @@
env-script = eval $(rose task-env --cycle-offset=P1D)
script = rose task-run --verbose
[[[job]]]
execution time limit = PT3H
execution time limit = PT6H
[[[events]]]
mail events = submission timeout, execution timeout, failed
mail to = {{MAIL_TO}}
......@@ -42,13 +42,17 @@
VARS={{VARS}}
OUTPUT_DIR={{OUTPUT_DIR}}
OUTPUT_FILENAME={{OUTPUT_FILENAME}}
NCML_FILE_DATEFMT={{NCML_FILE_DATEFMT}}
FORECAST_DAY=$(rose date --print-format='%Y-%m-%d' $CYLC_TASK_CYCLE_POINT)
FORECAST_YEAR=$(rose date --print-format='%Y' $CYLC_TASK_CYCLE_POINT)
FORECAST_MONTH=$(rose date --print-format='%m' $CYLC_TASK_CYCLE_POINT)
NCML_DATE=$(rose date --print-format=${NCML_FILE_DATEFMT} $CYLC_TASK_CYCLE_POINT)
FVCOM_FILE={{FVCOM_OUTPUT_DIR}}/${FORECAST_DAY}/${FVCOM_GRID_NAME}_0001.nc
PORTAL_BASEDIR={{PORTAL_BASEDIR}}
PORTAL_NCML_BASEDIR={{PORTAL_NCML_BASEDIR}}
NCML_FILE_PRE={{NCML_FILE_PRE}}
NCML_FILE_POST={{NCML_FILE_POST}}
[[start_cycle]]
script = """
......