Skip to content
Snippets Groups Projects
Commit bbad7210 authored by Aaron Spring's avatar Aaron Spring
Browse files

outpath

parent de8265c9
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ expid = 'asp_esmControl_PMassim_3014_TSDICALK_over_3170'
exppath = '/work/bm1124/m300524/experiments'
year = 3171 # year to get output labels from
outpath = os.path.expanduser('~/pymistral/') # folder to save output_df to
outpath = '.'
def find_all_outdatatypes_in_exp(expid=expid, exppath=exppath, year=1990):
"""Find all outdatatypes (tracer,atm,data_2d,...) from experiment `expid`
......@@ -54,7 +54,7 @@ def find_all_outdatatypes_in_exp(expid=expid, exppath=exppath, year=1990):
def read_all_outdatatype_files_to_ds(
outdatatypes, expid=expid, exppath=exppath, year=year, outpath='~/.'
outdatatypes, expid=expid, exppath=exppath, year=year, outpath='~/.', table_path=None,
):
"""Read all outdatatypes from experiment `expid` from path `exppath` of a
given `year` and return xr.Dataset."""
......@@ -78,8 +78,10 @@ def read_all_outdatatype_files_to_ds(
):
options += ' -t echam6'
else:
if table_path is None:
table_path = f'{exppath}/{expid}/log'
table = (
f'{exppath}/{expid}/log/'
f'{table_path}/'
+ f'{expid}_{model}_{outdatatype[:2]}*.codes'
)
options += ' -t ' + table
......@@ -124,7 +126,7 @@ def create_dataframe_of_output_info(ds, outpath=outpath):
def generate_output_df(
expid=expid, exppath=exppath, year=year, outpath=outpath, recalc=False
expid=expid, exppath=exppath, year=year, outpath=outpath, recalc=False, table_path=None
):
"""Combine all functions above to generate output from `expid` or just load
if not `recalc`."""
......@@ -141,7 +143,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, outpath=outpath
outdatatypes, expid=expid, exppath=exppath, year=year, outpath=outpath, table_path=table_path
)
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