diff --git a/bris/outputs/verif.py b/bris/outputs/verif.py index 367afe5..bc42eec 100644 --- a/bris/outputs/verif.py +++ b/bris/outputs/verif.py @@ -114,10 +114,10 @@ def _add_forecast(self, times: list, ensemble_member: int, pred: np.array): if self.elev_gradient is not None: interpolated_altitudes = gridpp.bilinear( - self.igrid, self.opoints, self.igrid.get_altitudes() + self.igrid, self.opoints, self.igrid.get_elevs() ) daltitude = self.opoints.get_elevs() - interpolated_altitudes - interpolated_pred += self.elev_gradient * delev + interpolated_pred += self.elev_gradient * daltitude interpolated_pred = interpolated_pred[ :, :, None ] # Add in variable dimension diff --git a/tests/test_outputs_verif.py b/tests/test_outputs_verif.py index 82f18cc..eb9ccfc 100644 --- a/tests/test_outputs_verif.py +++ b/tests/test_outputs_verif.py @@ -35,24 +35,26 @@ def test_1(): pm = PredictMetadata(variables, lats, lons, altitudes, leadtimes, num_members, field_shape) ofilename = "otest.nc" workdir = "verif_workdir" - output = Verif( - pm, - workdir, - ofilename, - "2t", - sources, - "K", - thresholds=thresholds, - quantile_levels=quantile_levels, - ) - frt = 1672552800 - times = frt + leadtimes - for member in range(num_members): - pred = np.random.rand(*pm.shape) - output.add_forecast(times, member, pred) - - output.finalize() + for elev_gradient in [None, 0]: + output = Verif( + pm, + workdir, + ofilename, + "2t", + sources, + "K", + thresholds=thresholds, + quantile_levels=quantile_levels, + elev_gradient=elev_gradient, + ) + + times = frt + leadtimes + for member in range(num_members): + pred = np.random.rand(*pm.shape) + output.add_forecast(times, member, pred) + + output.finalize() if __name__ == "__main__":