Skip to content
Snippets Groups Projects
Commit 43127055 authored by v.gramlich1's avatar v.gramlich1
Browse files

For debugging on HPC

parent f7b7f37a
No related branches found
No related tags found
1 merge request!302Draft: Resolve "Class-based Oversampling technique"
Pipeline #75761 passed
......@@ -355,10 +355,7 @@ class SkillScores:
:return: all CASES as well as all terms
"""
if self.external_data is None:
ahead_names = []
else:
ahead_names = list(self.external_data[self.ahead_dim].data)
ahead_names = list(internal_data[self.ahead_dim].data)
all_terms = ['AI', 'AII', 'AIII', 'AIV', 'BI', 'BII', 'BIV', 'CI', 'CIV', 'CASE I', 'CASE II', 'CASE III',
'CASE IV']
......
......@@ -121,7 +121,9 @@ class PlotOversamplingContingency(AbstractPlotClass):
def _min_max_threshold(self):
min_threshold = 0
max_threshold = 0
logging.info("min_max thresholds")
for station in self._stations:
logging.info(f"{station}")
file = os.path.join(self._file_path, self._file_name % station)
forecast_file = xr.open_dataarray(file)
obs = forecast_file.sel(type=self._obs_name)
......@@ -139,17 +141,23 @@ class PlotOversamplingContingency(AbstractPlotClass):
for station in self._stations:
file = os.path.join(self._file_path, self._file_name % station)
forecast_file = xr.open_dataarray(file)
logging.info(f"{station}: load obs")
obs = forecast_file.sel(type=self._obs_name)
logging.info(f"{station}: load pred")
predictions = [forecast_file.sel(type=self._model_name)]
logging.info(f"{station}: load comp")
competitors = [self._load_competitors(station, [comp]).sel(type=comp) for comp in self._comp_names]
predictions.extend(competitors)
logging.info(f"itearate over thresholds")
for threshold in range(self._min_threshold, self._max_threshold):
for pred in predictions:
for i, pred in enumerate(predictions):
logging.info(i)
ta, fa, fb, tb = self._single_contingency(obs, pred, threshold)
contingency_array.loc[dict(thresholds=threshold, contingency_cell="ta", type=pred.type.values)] = ta
contingency_array.loc[dict(thresholds=threshold, contingency_cell="fa", type=pred.type.values)] = fa
contingency_array.loc[dict(thresholds=threshold, contingency_cell="fb", type=pred.type.values)] = fb
contingency_array.loc[dict(thresholds=threshold, contingency_cell="tb", type=pred.type.values)] = tb
logging.info(f"{station}: finished")
return contingency_array
def _single_contingency(self, obs, pred, threshold):
......
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