Commit 342a4c83 authored by Modellers Operational's avatar Modellers Operational

Change to AMM15 rather than AMM7

parent e9767212
#!/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}
......@@ -10,29 +10,41 @@ cmems_dir=$2
cd ${cmems_dir}
rm out.nc || true
today=${today:-$(date +%Y%m%d)}
today=$(date +%Y%m%d -d "$today -1 days")
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}
dir=MetO-NWS-PHY-hi-${var}
if [ ! -d $dir ]; then
mkdir $dir
fi
file=metoffice_foam1_amm7_NWS_${var}_b${today}_hi${end}.nc
file=metoffice_foam1_amm15_NWS_${var}_b${today}_hi${end}.nc
year=$(date +%Y -d $end)
month=$(date +%m -d $end)
# 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
wget -c ftp://nrt.cmems-du.eu/Core/NORTHWESTSHELF_ANALYSIS_FORECAST_PHY_004_013/$dir/$year/$month/$file -O out.nc || 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
if [ ! -s "out.nc" ]; then
rm out.nc
fi
# If we've got a new forecast for day x then delete all other files for day x
if [ -f $dir/$file ]; then
if [ -f "out.nc" ]; then
ncks -O -d lon,-11.0,6.0 -d lat,47.5,59.5 out.nc $dir/$file
rm out.nc
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
ls ${dir}/metoffice_foam1_amm15_NWS_${var}_b*_hi${end}.nc | grep -v ${file} | xargs rm || true
fi
done
......@@ -40,7 +52,7 @@ for day in $(seq -2 $forecast_days); do
done
# Create a residual of the currents and sea surface height for the files we've just downloaded.
# Create a residual of the currents and sea surface height for the files we've just downloaded. - No longer needed with hourly data
#module load mpi/mpich-x86_64
#cd ~/Models/FVCOM/fvcom-projects/stemm-ccs/python/tides/
#for day in $(seq -1 $forecast_days); do
......
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