Commit b28f8cc5 authored by Mike Bedington's avatar Mike Bedington

Update CMEMS retrieval

parent 3b177f2c
......@@ -6,19 +6,18 @@ import sys
import PyFVCOM as pf
#"""
"""
cmems_data_dir = '/data/sthenno1/backup/mbe/Data/CMEMS'
start_date = dt.datetime(2018,9,19)
end_date = dt.datetime(2018,9,20)
start_date = dt.datetime(2018,9,26)
end_date = dt.datetime(2018,9,27)
grid = 'tamar_v2_grd.dat'
sigma_file = 'sigma_gen.dat'
native_coordinates = 'cartesian'
fvcom_harmonics = '/data/sthenno1/backup/mbe/Data/harmonics_files/tamar_2006_harmonics.nc'
interval = 1/24
#"""
"""
cmems_data_dir = sys.argv[1]
start_date = dt.datetime.strptime(sys.argv[2], '%Y-%m-%d')
end_date = dt.datetime.strptime(sys.argv[3], '%Y-%m-%d')
......@@ -27,14 +26,11 @@ sigma_file = sys.argv[5]
native_coordinates = sys.argv[6]
fvcom_harmonics = sys.argv[7]
interval = 1/float(sys.argv[8])
"""
constituents = ['M2', 'S2']
output_file = 'boundary_nest.nc'.format(grid)
cmems_time_res = 'hi'
##############################################################################################
# Setup preproc Model object
aqua_prep = pf.preproc.Model(start_date, end_date, grid, native_coordinates, zone='30N', sampling=interval)
......
[command]
default = python3 make_nest_bound.py ${CMEMS_DATA_DIR} ${START_DAY} ${END_DAY} ${ROSE_DATAC}/${GRID_NAME}_grd.dat ${ROSE_DATAC}/sigma_gen.dat ${COORDINATES} ${HARMONICS_FILE_PATH} ${NEST_INTERVAL}; cp boundary_nest.nc ${ROSE_DATAC}/${GRID_NAME}_nest_0001.nc
default = python3 make_nest_bound.py ${CMEMS_DATA_DIR} ${START_DAY} ${END_DAY} ${ROSE_DATAC}/${GRID_NAME}_grd.dat ${ROSE_DATAC}/sigma_gen.dat ${COORDINATES} ${HARMONICS_FILE_PATH} ${NEST_INTERVAL}; cp boundary_nest.nc /${REMOTE_TRANSFER_DIR}/
......@@ -6,6 +6,10 @@ set -eu
# 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")
......@@ -18,30 +22,24 @@ for day in $(seq -2 $forecast_days); do
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
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
done
echo "done."
done
# Clear out the old forecast data.
yesterday=$(date +%Y%m%d -d "$today - 1 day")
for day in $(seq -1 $forecast_days); do
end=$(date +%Y%m%d -d "$yesterday + $day days")
echo -n "Clearing old forecast $yesterday-$end "
for var in CUR SAL SSH TEM; do
dir=MetO-NWS-PHYS-hi-${var}
file=metoffice_foam1_amm7_NWS_${var}_b${yesterday}_hi${end}.nc
if [ -f $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/
......
[command]
default = cd ${CMEMS_DATA_DIR}; bash get_nws_forecast.sh 5
default = bash get_nws_forecast.sh 5 ${CMEMS_DATA_DIR}
......@@ -12,9 +12,9 @@ COMMON_FILES_PATH='/data/sthenno1/backup/mbe/Code/fvcom-projects/mycoast/run/tam
## Atmospheric setup
WIND_ON='T'
HEATING_ON='F'
PRECIPITATION_ON='F'
AIR_PRESSURE_ON='F'
HEATING_ON='T'
PRECIPITATION_ON='T'
AIR_PRESSURE_ON='T'
## WRF suite settings if any of the above are on
WRF_RUN_SUITE='rose-wrf'
WRF_FORECAST_FILE_DIR='/gpfs1/users/modellers/mbe/rose_run_wrf_temp'
......@@ -29,9 +29,9 @@ REMOTE_TRANSFER_DIR='data/sthenno1/backup/mbe/rose_transfer_dir'
## Boundary forcing
## Between 'TIDAL', 'CMEMS', and 'NEST_FILE'
BOUNDARY_FORCING='TIDAL'
BOUNDARY_FORCING='CMEMS'
# Required for TIDAL and CMEMS
HARMONICS_FILE_PATH='/pmldata/sthenno1/backup/mbe/Data/harmonics_files/tamar_2006_harmonics.nc'
HARMONICS_FILE_PATH='/data/sthenno1/backup/mbe/Data/harmonics_files/tamar_2006_harmonics.nc'
## Required for CMEMS
CMEMS_DATA_DIR='/data/sthenno1/backup/mbe/Data/CMEMS'
## Required for NEST_FILE
......
......@@ -4,8 +4,8 @@
abort if any task fails = False
[scheduling]
initial cycle point = 2018-09-20T00:00:00Z
final cycle point = +P5D
initial cycle point = 2018-10-03T00:00:00Z
final cycle point = +P4D
[[special tasks]]
clock-trigger = start_cycle(PT0M)
[[dependencies]]
......@@ -19,19 +19,19 @@
run_fvcom[-P1D] => start_cycle => softlink_forcing & softlink_forcing_remote => write_run_namelist
{% if FORECAST and (WIND_ON == 'T' or HEATING_ON == 'T' or PRECIPITATION_ON == 'T' or AIR_PRESSURE_ON == 'T') %}
start_cycle => wrf_suite_trigger <rose_wrf::transfer_for_fvcom> => get_wrf_file => write_run_namelist
start_cycle => wrf_suite_trigger <wrf::transfer_for_fvcom> => get_wrf_file => write_run_namelist
{% endif %}
{% if BOUNDARY_FORCING == 'TIDAL' %}
start_cycle => generate_tide_forcing => write_run_namelist
{% elif BOUNDARY_FORCING == 'CMEMS' %}
start_cycle => get_CMEMS_data => generate_CMEMS_nest => write_run_namelist
start_cycle => get_CMEMS_data => generate_CMEMS_nest => copy_CMEMS_nest_to_remote => write_run_namelist
{% elif BOUNDARY_FORCING == 'NEST_FILE' %}
start_cycle => nest_suite_trigger<{{NEST_RUN_SUITE}}::transfer_data> => get_nest_file => write_run_namelist
{% endif %}
{% if RIVER_MODEL == 'NEURAL_NET' %}
start_cycle => wrf_archive_trigger <rose_wrf::cycle_finished> & update_river_model & softlink_forcing => generate_rivers
start_cycle => wrf_archive_trigger <wrf::cycle_finished> & update_river_model & softlink_forcing => generate_rivers
generate_rivers => mv_river_files => write_river_number
write_run_namelist => write_river_number => run_fvcom
{% elif RIVER_MODEL == 'CLIMATOLOGY' %}
......@@ -152,9 +152,11 @@
[[generate_tide_forcing]]
inherit = slurm_job_1
[[get_CMEMS_data]]
inherit = slurm_job_1
[[generate_CMEMS_nest]]
inherit = slurm_job_1
[[copy_CMEMS_nest_to_remote]]
inherit = remote_job
script = "cp /pml${REMOTE_TRANSFER_DIR}/boundary_nest.nc ${ROSE_DATAC}/${GRID_NAME}_nest_0001.nc"
[[nest_suite_trigger]]
script =""
[[[suite state polling]]]
......
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