Skip to content

Commit

Permalink
Fix plots
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Nov 29, 2023
1 parent d415836 commit 9be1af1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion isimip_qa/plots/dayofyear.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class DayOfYearPlot(FigurePlotMixin, GridPlotMixin, Plot):
def get_df(self, dataset):
extraction = self.extraction_class(dataset, self.region, self.period)
df = extraction.read()
return (df.groupby(lambda x: x.dayofyear).mean() - df.mean()) / df.std()
mean, std = df.mean().values, df.std().values
return (df.groupby(lambda x: x.dayofyear).mean() - mean) / (std if std > 0 else 1.0)

def get_attrs(self, dataset):
return AttrsExtraction(dataset, self.region, self.period).read()
Expand Down
3 changes: 2 additions & 1 deletion isimip_qa/plots/monthofyear.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class MonthOfYearPlot(FigurePlotMixin, GridPlotMixin, Plot):
def get_df(self, dataset):
extraction = self.extraction_class(dataset, self.region, self.period)
df = extraction.read()
return (df.groupby(lambda x: x.month).mean() - df.mean()) / df.std()
mean, std = df.mean().values, df.std().values
return (df.groupby(lambda x: x.month).mean() - mean) / (std if std > 0 else 1.0)

def get_attrs(self, dataset):
return AttrsExtraction(dataset, self.region, self.period).read()
Expand Down
2 changes: 1 addition & 1 deletion isimip_qa/tests/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def test_plot(settings, dataset_path, extraction_class, plot_class):

similarity = ssim(img, template_img, data_range=template_img.max() - template_img.min())

assert similarity == 1.0
assert similarity > 0.999999

0 comments on commit 9be1af1

Please sign in to comment.