Skip to content

Commit

Permalink
Merge pull request #524 from bitterbark/refactor_pp
Browse files Browse the repository at this point in the history
Fixes for cesm catalog builder and MJO_suite settings file
  • Loading branch information
wrongkindofdoctor authored Apr 4, 2024
2 parents c413fd6 + ffc23f3 commit 110511b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
27 changes: 13 additions & 14 deletions diagnostics/MJO_suite/settings.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,30 @@
"runtime_requirements": {
"python3": [],
"ncl": ["contributed", "gsn_code", "gsn_csm", "shea_util", "diagnostics_cam"]
}
},
}
}, //setttings
"data": {
"frequency": "day"
},
}, //data
"dimensions": {
"dimensions": {
"lat": {
"standard_name": "latitude",
"units": "degrees_north",
"axis": "Y"
},
"standard_name": "latitude",
"units": "degrees_north",
"axis": "Y"
},
"lon": {
"standard_name": "longitude",
"units": "degrees_east",
"axis": "X"
},
"standard_name": "longitude",
"units": "degrees_east",
"axis": "X"
},
"lev": {
"standard_name": "air_pressure",
"units": "hPa",
"positive": "down",
"axis": "Z"
},
"time": {"standard_name": "time"}
},
}, //dimensions
"varlist": {
"rlut": {
"standard_name": "toa_outgoing_longwave_flux",
Expand Down Expand Up @@ -79,5 +78,5 @@
"dimensions": ["time", "lat", "lon"],
"scalar_coordinates": {"lev": 850}
}
}
} //dimensions
}
7 changes: 5 additions & 2 deletions src/pod_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def __init__(self, name: str, runtime_config: util.NameSpace):
self.pod_env_vars = os.environ.copy()
self.pod_env_vars['RGB'] = os.path.join(runtime_config.CODE_ROOT, 'shared', 'rgb')
self.pod_env_vars['CONDA_ROOT'] = os.path.expandvars(runtime_config.conda_root)
self.pod_env_vars['CONDA_ENV_ROOT'] = os.path.expandvars(runtime_config.conda_env_root)
if any(runtime_config.micromamba_exe):
self.pod_env_vars['MICROMAMBA_EXE'] = runtime_config.micromamba_exe
else:
Expand Down Expand Up @@ -144,14 +145,16 @@ def verify_runtime_reqs(runtime_reqs: dict):
if any(v):
pod_env = k
break

pod_pkgs = runtime_reqs[pod_env]

if "python" not in pod_env:
env_name = '_MDTF_' + pod_env.upper() + '_base'
else:
env_name = '_MDTF_' + pod_env.lower() + '_base'
conda_root = self.pod_env_vars['CONDA_ROOT']
e = os.path.join(conda_root, 'envs', env_name)

conda_env_root = self.pod_env_vars['CONDA_ENV_ROOT']
e = os.path.join(conda_env_root, env_name)

env_dir = util.resolve_path(e,
env_vars=self.pod_env_vars,
Expand Down
5 changes: 3 additions & 2 deletions tools/catalog_builder/catalog_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def call_build(self, file_parse_method=None):
file_parse_method = parse_cesm_timeseries
# see https://github.com/ncar-xdev/ecgtools/blob/main/ecgtools/parsers/cesm.py
# for more parsing methods
self.cb.build(file_parse_method)
self.cb = self.cb.build(parsing_func=file_parse_method)


def load_config(config):
Expand Down Expand Up @@ -315,7 +315,8 @@ def main(config: str):

print("Time to build catalog:", timedelta(seconds=end_time - start_time))
# save the catalog
print('Saving catalog to', conf['output_filename'] + ".csv")
print('Saving catalog to', conf['output_dir'],'/',conf['output_filename'] + ".csv")

cat_obj.call_save(output_dir=conf['output_dir'],
output_filename=conf['output_filename']
)
Expand Down

0 comments on commit 110511b

Please sign in to comment.