Skip to content
Snippets Groups Projects
Commit 5600c04e authored by Fraser William Goldsworth's avatar Fraser William Goldsworth
Browse files

updated default parameters

parent b86526fc
No related branches found
No related tags found
No related merge requests found
import json
import os
import os.path as osp
fname = os.path.join(os.path.dirname(__file__), "params_default.json")
# if os.path.isfile(fname):
# with open(fname, 'r') as f:
# params_default = json.load(f)
# else:
# print(f'File {fname} does not exist.')
# Load the default parameters from file
fname = osp.join(osp.dirname(__file__), "params_default.json")
try:
with open(fname, "r") as f:
params_default = json.load(f)
except:
# print(f'Could not find {fname}. Continuingwith backup solution.')
# If problems had, set them here
params_default = {
"path_grid": "/work/mh0033/m300602/icon/grids/",
"path_example_data": "/work/mh0033/m300602/pyicon_example_data_download/",
}
fname = os.path.join(os.path.dirname(__file__), "params_user.json")
if os.path.isfile(fname):
# If these paths don't exist put things elsewhere
if not osp.exists(params_default["path_grid"]):
params_default["path_grid"] = osp.abspath(
osp.join(osp.dirname(__file__), "../../icon/grids/")
)
if not osp.exists(params_default["path_example_data"]):
params_default["path_example_data"] = osp.join(
osp.dirname(__file__), "tests/test_data/"
)
# Load the user parameters from file
fname = osp.join(osp.dirname(__file__), "params_user.json")
if osp.isfile(fname):
with open(fname, "r") as f:
params_user = json.load(f)
else:
# print(f'File {fname} does not exist.')
pass
# Try to overload the default the parameters with the users
try:
params = params_default | params_user
except:
......
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