Commit ac373aa4 authored by Modellers Operational's avatar Modellers Operational

Suite changes for AMM15 forcing (from AMM7)

parent e0bc7ee9
......@@ -7,9 +7,9 @@ import sys
import PyFVCOM as pf
"""
cmems_data_dir = '/data/sthenno1/backup/mbe/Data/CMEMS'
start_date = dt.datetime(2018,9,26)
end_date = dt.datetime(2018,9,27)
cmems_data_dir = '/data/sthenno1/scratch/modop/Data/CMEMS'
start_date = dt.datetime(2019,4,30)
end_date = dt.datetime(2019,5,2)
grid = 'tamar_v2_grd.dat'
sigma_file = 'sigma_gen.dat'
native_coordinates = 'cartesian'
......@@ -41,9 +41,9 @@ aqua_prep.add_nests(4)
aqua_prep.add_nests_harmonics(fvcom_harmonics, harmonics_vars=['u', 'v', 'ua', 'va', 'zeta'], constituents=constituents, pool_size=20)
# Make the regular readers for the CMEMS data
fvcom_cmems_names = {'salinity':['SAL', 'vosaline'], 'temp':['TEM', 'votemper'],
'v':['CUR', 'vomecrty'], 'u':['CUR', 'vozocrtx'],
'zeta':['SSH', 'sossheig']}
fvcom_cmems_names = {'salinity':['SAL', 'so'], 'temp':['TEM', 'thetao'],
'v':['CUR', 'vo'], 'u':['CUR', 'uo'],
'zeta':['SSH', 'zos']}
dt_list = [start_date + dt.timedelta(days = int(i)) for i in np.arange(-1, (end_date - start_date).days + 2)]
datestr_list = [this_date.strftime('%Y%m%d') for this_date in dt_list]
......
......@@ -22,9 +22,9 @@ grid = 'tamar_v2'
cmems_time_res = 'hi'
fvcom_cmems_names = {'salinity':['SAL', 'vosaline'], 'temp':['TEM', 'votemper'],
'v':['CUR', 'vomecrty'], 'u':['CUR', 'vozocrtx'],
'zeta':['SSH', 'sossheig']}
fvcom_cmems_names = {'salinity':['SAL', 'so'], 'temp':['TEM', 'thetao'],
'v':['CUR', 'vo'], 'u':['CUR', 'uo'],
'zeta':['SSH', 'zos']}
# Modify a donor restart file.
......@@ -84,6 +84,9 @@ for this_fvcom, this_var in fvcom_cmems_names.items():
restart.replace_variable_with_regular(this_fvcom, this_var[1], this_data_reader, constrain_coordinates=True, mode=this_mode)
for this_var in fvcom_cmems_names.keys():
setattr(restart.data, this_var, getattr(restart.data,this_var)[np.newaxis,...])
# replace Times as need to be a 26 character array
restart.time.Times = np.asarray(list(restart.time.Times[0]))[np.newaxis,:]
restart.write_restart('{}_restart_0001.nc'.format(grid))
......
#!/bin/bash --login
set -eu
# Get today's forecast data from CMEMS for the NW Shelf domain. Delete yesterday's whilst we're at it.
# CMEMS FTP username and password are stored in ~/.netrc to make this more secure.
forecast_days=$1
cmems_dir=$2
cd ${cmems_dir}
today=${today:-$(date +%Y%m%d)}
for day in $(seq -2 $forecast_days); do
end=$(date +%Y%m%d -d "$today + $day days")
echo -n "Getting forecast $today-$end "
for var in CUR SAL SSH TEM; do
dir=MetO-NWS-PHYS-hi-${var}
if [ ! -d $dir ]; then
mkdir $dir
fi
file=metoffice_foam1_amm7_NWS_${var}_b${today}_hi${end}.nc
# Don't fail if we didn't get the file. This might just mean we're doing a hindcast download.
#wget -qc ftp://nrt.cmems-du.eu/Core/NORTHWESTSHELF_ANALYSIS_FORECAST_PHYS_004_001_b/$dir/$file -O$dir/$file || true
wget -c ftp://nrt.cmems-du.eu/Core/NORTHWESTSHELF_ANALYSIS_FORECAST_PHYS_004_001_b/$dir/$file -O$dir/$file || true
# If we're doing a hindcast download we might end up with an empty file, so nuke it here.
if [ ! -s $dir/$file ]; then
rm $dir/$file
fi
# If we've got a new forecast for day x then delete all other files for day x
if [ -f $dir/$file ]; then
echo "Clearing old forecast ${end}"
ls ${dir}/metoffice_foam1_amm7_NWS_${var}_b*_hi${end}.nc | grep -v metoffice_foam1_amm7_NWS_${var}_b${today}_hi${end}.nc | xargs rm || true
fi
done
echo "done."
done
# Create a residual of the currents and sea surface height for the files we've just downloaded.
#module load mpi/mpich-x86_64
#cd ~/Models/FVCOM/fvcom-projects/stemm-ccs/python/tides/
#for day in $(seq -1 $forecast_days); do
# day=$(date +%Y%m%d -d "$today + $day days")
# mpirun -n $(nproc) python3 nemo_tides.py ${day:0:4} ${day:4:2} ${day:6:2} SSH sossheig
# #mpirun -n $(nproc) python3 nemo_tides.py ${day:0:4} ${day:4:2} ${day:6:2} CUR vozocrtx
# #mpirun -n $(nproc) python3 nemo_tides.py ${day:0:4} ${day:4:2} ${day:6:2} CUR vomecrty
#done
##python3 make_residual.py ${today:0:4} ${today:4:2} SSH sossheig
##python3 make_residual.py ${today:0:4} ${today:4:2} CUR vozocrtx
##python3 make_residual.py ${today:0:4} ${today:4:2} CUR vozocrtx
[command]
default = bash get_nws_forecast.sh 5 ${CMEMS_DATA_DIR}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment