Skip to content
Snippets Groups Projects
Unverified Commit 0ca6c835 authored by Aaron Spring's avatar Aaron Spring Committed by GitHub
Browse files

Update cdo_post.py

parent 1bf5f795
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,7 @@ def find_all_outdatatypes_in_exp(expid=expid, exppath=exppath, year=year):
def read_all_outdatatype_files_to_ds(
outdatatypes, expid=expid, exppath=exppath, year=year, new_sample_file_path='~/.'
outdatatypes, expid=expid, exppath=exppath, year=year, outpath='~/.'
):
"""Read all outdatatypes from experiment `expid` from path `exppath` of a
given `year` and return xr.Dataset."""
......@@ -91,7 +91,7 @@ def read_all_outdatatype_files_to_ds(
ds = cdo.copy(input=path, options=options, returnXDataset=True)
if 'time' not in ds.dims:
ds = ds.expand_dims('time')
ds.to_netcdf(f'{new_sample_file_path}/sample_files/{model}_{outdatatype}.nc')
ds.to_netcdf(f'{outpath}/sample_files/{model}_{outdatatype}.nc')
# add outdatatype
for v in ds.data_vars:
ds[v].attrs['outdatatype'] = outdatatype
......@@ -142,7 +142,7 @@ def generate_output_df(
expid=expid, exppath=exppath, year=year
)
ds = read_all_outdatatype_files_to_ds(
outdatatypes, expid=expid, exppath=exppath, year=year
outdatatypes, expid=expid, exppath=exppath, year=year, outpath=outpath
)
output_df = create_dataframe_of_output_info(ds, outpath=outpath)
return output_df
......
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