Skip to content

Commit

Permalink
Merge pull request #971 from PCMDI/ao_custom_obs_squashed
Browse files Browse the repository at this point in the history
Add custom obs JSON
  • Loading branch information
acordonez committed Aug 15, 2023
2 parents 9415e07 + 1c268e0 commit 2381f3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def create_mean_climate_parser():
dest="custom_observations",
help="Path to an alternative, custom observation file",
required=False,
default=""
)

parser.add_argument(
Expand Down
8 changes: 6 additions & 2 deletions pcmdi_metrics/mean_climate/mean_climate_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
reference_data_path = parameter.reference_data_path
metrics_output_path = parameter.metrics_output_path
diagnostics_output_path = parameter.diagnostics_output_path
custom_obs = parameter.custom_observations
debug = parameter.debug
cmec = parameter.cmec

Expand Down Expand Up @@ -122,8 +123,11 @@

# load obs catalogue json
egg_pth = resources.resource_path()
obs_file_name = "obs_info_dictionary.json"
obs_file_path = os.path.join(egg_pth, obs_file_name)
if len(custom_obs) > 0:
obs_file_path = custom_obs
else:
obs_file_name = "obs_info_dictionary.json"
obs_file_path = os.path.join(egg_pth, obs_file_name)
with open(obs_file_path) as fo:
obs_dict = json.loads(fo.read())
# if debug:
Expand Down

0 comments on commit 2381f3e

Please sign in to comment.