Commit e4c13505 authored by Modellers Operational's avatar Modellers Operational

Add archiving on CETO

parent 3425a26b
import numpy as np
import datetime as dt
import sys
import PyFVCOM as pf
fvcom_output_path = sys.argv[1]
fvcom_grid_name = sys.argv[2]
start_date = dt.datetime.strptime(sys.argv[3], '%Y-%m-%d')
end_date = dt.datetime.strptime(sys.argv[4], '%Y-%m-%d')
date_list = pf.utilities.time.date_range(start_date, end_date)
with open('make_daily_nc.sh', 'w') as f:
f.write('#!/bin/bash \n')
this_filestr = '{}/{}_0001.nc'.format(fvcom_output_path,fvcom_grid_name)
this_fr = pf.read.FileReader(this_filestr)
for i, this_date in enumerate(date_list):
time_ind = [np.argwhere(this_fr.time.datetime == this_date), np.argwhere(this_fr.time.datetime == this_date + dt.timedelta(hours=23))]
this_out_filestr = '{}_{}.nc'.format(fvcom_grid_name, this_date.strftime('%Y-%m-%d'))
with open('make_daily_nc.sh', 'a') as f:
f.write('ncks -d time,{},{} {} {} \n'.format(np.squeeze(time_ind[0]), np.squeeze(time_ind[1]), this_filestr, this_out_filestr))
[command]
default = module purge; module load ipd;
python3 make_ncks_script.py ${ROSE_DATAC}/output ${GRID_NAME} ${START_DAY} ${END_DAY};
bash ./make_daily_nc.sh;
mv *.nc ${REMOTE_ARCHIVE_DIR}/
...@@ -70,12 +70,11 @@ ...@@ -70,12 +70,11 @@
{% endif %} {% endif %}
{% if FORECAST %} {% if FORECAST %}
write_run_namelist => run_fvcom => transfer_data => transfer_data_today write_run_namelist => run_fvcom => transfer_data => transfer_data_today => remote_archive => clean_output
{% else %} {% else %}
write_run_namelist => run_fvcom => transfer_data write_run_namelist => run_fvcom => transfer_data => clean_output
{% endif %} {% endif %}
run_fvcom => nan_check run_fvcom => nan_check
transfer_data => plot_surf_vars
""" """
...@@ -317,4 +316,10 @@ ...@@ -317,4 +316,10 @@
""" """
[[nan_check]] [[nan_check]]
inherit = remote_job inherit = remote_job
[[plot_surf_vars]] [[remote_archive]]
inherit = remote_job
[[clean_output]]
inherit = remote_job
script = """
rm ${ROSE_DATAC}/output/${GRID_NAME}_0001.nc
"""
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