Skip to content

Commit

Permalink
if error occurs calculating a region/model, keep going (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
doutriaux1 committed Jul 16, 2019
1 parent 04ad61a commit 10aeda6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions pcmdi_metrics/pcmdi/mean_climate_metrics_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def run_diags(self):
self.obs_dict, sftlf=self.sftlf)

for region in self.regions_dict[self.var]:
logging.getLogger("pcmdi_metrics").info("REGION: {}".format(region))
self.region = self.create_region(region)
# Need to add the region to the output dict now b/c
# otherwise if done later, sometimes it's not added due to
Expand Down Expand Up @@ -150,6 +151,7 @@ def create_region(self, region):

def run_reference_and_test_comparison(self):
''' Does the (obs or model) vs (obs or model) comparison. '''

reference_data_set = self.parameter.reference_data_set
test_data_set = self.parameter.test_data_set

Expand Down Expand Up @@ -179,6 +181,7 @@ def run_reference_and_test_comparison(self):
continue

for test in test_data_set:
logging.getLogger("pcmdi_metrics").info("TEST DATA IS: {}".format(test))
try:
tst = self.determine_obs_or_model(test_data_set_is_obs,
test, self.parameter.test_data_path)
Expand All @@ -187,10 +190,16 @@ def run_reference_and_test_comparison(self):
# when a model doesn't have sftlf for a given region
except RuntimeError:
continue
except Exception as err:
logging.getLogger("pcmdi_metrics").info("Unexpected error:".format(err))
break

try:
self.output_metric.calculate_and_output_metrics(ref, tst)
except RuntimeError:
continue
except Exception as err:
logging.getLogger("pcmdi_metrics").info("Unexpected error in calculate output metrics:".format(err))
break

def is_data_set_obs(self, data_set):
Expand Down
4 changes: 2 additions & 2 deletions pcmdi_metrics/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = 'v1.2'
__git_tag_describe__ = 'v1.2-59-g85056c0'
__git_sha1__ = '85056c0355c3b396cd759aa7432482506698b891'
__git_tag_describe__ = 'v1.2-60-g04ad61a'
__git_sha1__ = '04ad61a8bdf52af8af61698c64a9dd553d05ed45'

0 comments on commit 10aeda6

Please sign in to comment.