Skip to content
Snippets Groups Projects
Commit 68a8045e authored by Nils-Arne Dreier's avatar Nils-Arne Dreier Committed by Siddhant Tibrewal
Browse files

feat: add extend_time format for hiopy-configure

parent f5a13b68
No related branches found
No related tags found
1 merge request!12feat: add extend_time format for hiopy-configure
Pipeline #90062 failed
......@@ -79,8 +79,14 @@ def add_variable(dataset, name, yac_source_comp, yac_source_grid,
v.attrs["hiopy::nnn"] = 4
# TODO
# def extent_time()
def extend_time(dataset, enddate):
for g in _collect_groups(dataset):
assert "seconds since " in g.time.attrs["units"], "Currently the time must be given in seconds"
refdate = np.datetime64(g.time.attrs["units"][len("seconds since "):])
dt = g.time[1]-g.time[0]
enddate_s = (enddate-refdate)//np.timedelta64(1, 's')
g.time.append(np.arange(g.time[-1]+dt, enddate_s+dt, dt))
print(g)
def consolidate(dataset):
......@@ -132,6 +138,10 @@ def main():
help="Name of the frac_mask array in the same group")
add_variable_parser.add_argument("--yac-name", type=str, help="name of the yac field")
extend_time_parser = subparsers.add_parser("extend-time")
extend_time_parser.set_defaults(func=extend_time)
extend_time_parser.add_argument("enddate", type=np.datetime64)
consolidate_parser = subparsers.add_parser("consolidate")
consolidate_parser.set_defaults(func=consolidate)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment