Commit 72d057b3 authored by Modellers Operational's avatar Modellers Operational

Bug fixs in CMEMS start file

parent 1da69a0d
...@@ -2,6 +2,7 @@ import multiprocessing ...@@ -2,6 +2,7 @@ import multiprocessing
import numpy as np import numpy as np
import datetime as dt import datetime as dt
import glob as gb import glob as gb
import sys
from pathlib import Path from pathlib import Path
import PyFVCOM as pf import PyFVCOM as pf
...@@ -35,7 +36,12 @@ restart.time.datetime = np.asarray([start_date]) ...@@ -35,7 +36,12 @@ restart.time.datetime = np.asarray([start_date])
ref_date = dt.datetime(1858,11,17,0,0,0) ref_date = dt.datetime(1858,11,17,0,0,0)
restart.time.time = np.asarray([(start_date - ref_date).days]) restart.time.time = np.asarray([(start_date - ref_date).days])
restart.time.Itime = np.asarray([(start_date - ref_date).days]) restart.time.Itime = np.asarray([(start_date - ref_date).days])
restart.time.Times = np.asarray(['{}T00:00:00.0000000'.format(start_date.strftime('%Y-%m-%d'))]) restart.time.Times = np.asarray(['{}T00:00:00.000000'.format(start_date.strftime('%Y-%m-%d'))])
restart.replaced.append('time')
restart.replaced.append('Itime')
restart.replaced.append('Times')
# We need to bracket the restart data in time with CMEMS data to ensure it interpolates properly. # We need to bracket the restart data in time with CMEMS data to ensure it interpolates properly.
for this_fvcom, this_var in fvcom_cmems_names.items(): for this_fvcom, this_var in fvcom_cmems_names.items():
...@@ -78,5 +84,7 @@ for this_fvcom, this_var in fvcom_cmems_names.items(): ...@@ -78,5 +84,7 @@ 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) restart.replace_variable_with_regular(this_fvcom, this_var[1], this_data_reader, constrain_coordinates=True, mode=this_mode)
# 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)) restart.write_restart('{}_restart_0001.nc'.format(grid))
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