コード例 #1
0
ファイル: test_ApplyEMOS.py プロジェクト: nivnac/improver
 def test_alternative_percentiles(self):
     """Test that the calibrated forecast is at a specified set of
     percentiles."""
     result = ApplyEMOS(percentiles=self.alternative_percentiles)(
         self.percentiles, self.coefficients, realizations_count=3)
     self.assertArrayEqual(
         result.coord("percentile").points, self.alternative_percentiles)
コード例 #2
0
ファイル: test_ApplyEMOS.py プロジェクト: nivnac/improver
 def test_alternative_string_percentiles(self):
     """Test that the calibrated forecast is at a specified set of
     percentiles where the input percentiles are strings."""
     str_percentiles = list(map(str, self.alternative_percentiles))
     result = ApplyEMOS(percentiles=str_percentiles)(self.percentiles,
                                                     self.coefficients,
                                                     realizations_count=3)
     self.assertArrayEqual(
         result.coord("percentile").points, self.alternative_percentiles)
コード例 #3
0
ファイル: test_ApplyEMOS.py プロジェクト: wilbertcs/improver
 def test_null_percentiles_frt_fp_mismatch(self):
     """Test effect of "neutral" emos coefficients in percentile space
     where the forecast is 15 minutes ahead of the coefficients in terms
     of the forecast reference time."""
     percentiles = self.percentiles.copy()
     mins_15_to_secs = 900
     percentiles.coord("forecast_reference_time").points = (
         percentiles.coord("forecast_reference_time").points + mins_15_to_secs
     )
     percentiles.coord("forecast_period").points = (
         percentiles.coord("forecast_period").points - mins_15_to_secs
     )
     expected_frt = percentiles.coord("forecast_reference_time").points
     expected_fp = percentiles.coord("forecast_period").points
     result = ApplyEMOS()(percentiles, self.coefficients, realizations_count=3)
     self.assertAlmostEqual(
         result.coord("forecast_reference_time").points, expected_frt
     )
     self.assertAlmostEqual(result.coord("forecast_period").points, expected_fp)
     self.assertArrayAlmostEqual(result.data, self.null_percentiles_expected)
     self.assertAlmostEqual(
         np.mean(result.data), self.null_percentiles_expected_mean
     )