Skip to content
Snippets Groups Projects
Commit 9b3f8e9f authored by Nils Brüggemann's avatar Nils Brüggemann
Browse files

pyicon_params.py: Improved handling of params.

parent eae70d9c
No related branches found
No related tags found
No related merge requests found
Pipeline #100168 passed
{
"path_grid": "~/pyicon_data/grids/",
"path_example_data": "~/pyicon_data/pyicon_example_data_download/"
}
......@@ -8,6 +8,7 @@ fname = os.path.join(os.path.dirname(__file__), 'params_default.json')
#else:
# print(f'File {fname} does not exist.')
try:
print(f"Loading default parameters from {fname}.")
with open(fname, 'r') as f:
params_default = json.load(f)
except:
......@@ -15,11 +16,12 @@ except:
HOME = os.path.expanduser('~')
params_default = {
"path_grid": f"{HOME}/pyicon_data/grids/",
"path_example_data": f"{HOME}/pyicon_data/pyicon_example_data_download/"
"path_example_data": f"{HOME}/pyicon_data/icon_example_data_download/"
}
fname = os.path.join(os.path.dirname(__file__), 'params_user.json')
if os.path.isfile(fname):
print(f"Loading user parameters from {fname}.")
with open(fname, 'r') as f:
params_user = json.load(f)
else:
......@@ -30,3 +32,6 @@ try:
params = params_default | params_user
except:
params = params_default
for key in ['path_grid', 'path_example_data']:
params[key] = os.path.expanduser(params[key])
\ No newline at end of file
......@@ -24,3 +24,4 @@ cp path_data.txt ${path_data}/pyicon_output/
./06_quickplots.sh
echo "Output written to ${source_dir}/swift.dkrz.de/example_data_r2b4/pyicon_output/"
echo "All done!"
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