def test_get_pass(self): """Test get_knutson_criterion function.""" criterion = tc_cc.get_knutson_criterion() self.assertTrue(len(criterion), 20) for crit_val in criterion: self.assertTrue('year' in crit_val) self.assertTrue('change' in crit_val) self.assertTrue('criteria' in crit_val) self.assertTrue('variable' in crit_val) self.assertTrue('function' in crit_val) self.assertEqual(criterion[0]['change'], 1.045) self.assertEqual(criterion[-1]['change'], 1 - 0.583)
def test_get_pass(self): """Test get_knutson_criterion function.""" criterion = tc_cc.get_knutson_criterion() self.assertTrue(len(criterion), 20) for crit_val in criterion: self.assertTrue('year' in crit_val) self.assertTrue('change' in crit_val) self.assertTrue('variable' in crit_val) self.assertEqual(criterion[0]['variable'], "frequency") self.assertEqual(criterion[0]['change'], 1) self.assertEqual(criterion[4]['variable'], "intensity") self.assertEqual(criterion[4]['change'], 1.045) self.assertEqual(criterion[-10]['basin'], "SP") self.assertEqual(criterion[-10]['variable'], "frequency") self.assertEqual(criterion[-10]['change'], 1 - 0.583)
def set_climate_scenario_knu(self, ref_year=2050, rcp_scenario=45): """Compute future events for given RCP scenario and year. RCP 4.5 from Knutson et al 2015. Parameters: ref_year (int): year between 2000 ad 2100. Default: 2050 rcp_scenario (int): 26 for RCP 2.6, 45 for RCP 4.5 (default), 60 for RCP 6.0 and 85 for RCP 8.5. Returns: TropCyclone """ criterion = get_knutson_criterion() scale = calc_scale_knutson(ref_year, rcp_scenario) haz_cc = self._apply_criterion(criterion, scale) haz_cc.tag.description = 'climate change scenario for year %s and RCP %s '\ 'from Knutson et al 2015.' % (str(ref_year), str(rcp_scenario)) return haz_cc
def apply_climate_scenario_knu(self, ref_year=2050, rcp_scenario=45): """ From current TC hazard instance, return new hazard set with future events for a given RCP scenario and year based on the parametrized values derived from Table 3 in Knutson et al 2015. https://doi.org/10.1175/JCLI-D-15-0129.1 . The scaling for different years and RCP scenarios is obtained by linear interpolation. Note: The parametrized values are derived from the overall changes in statistical ensemble of tracks. Hence, this method should only be applied to sufficiently large tropical cyclone event sets that approximate the reference years 1981 - 2008 used in Knutson et. al. The frequency and intensity changes are applied independently from one another. The mean intensity factors can thus slightly deviate from the Knutson value (deviation was found to be less than 1% for default IBTrACS event sets 1980-2020 for each basin). Parameters ---------- ref_year : int year between 2000 ad 2100. Default: 2050 rcp_scenario : int 26 for RCP 2.6, 45 for RCP 4.5, 60 for RCP 6.0 and 85 for RCP 8.5. The default is 45. Returns ------- haz_cc : climada.hazard.TropCyclone Tropical cyclone with frequencies and intensity scaled according to the Knutson criterion for the given year and RCP. Returns a new instance of climada.hazard.TropCyclone, self is not modified. """ chg_int_freq = get_knutson_criterion() scale_rcp_year = calc_scale_knutson(ref_year, rcp_scenario) haz_cc = self._apply_knutson_criterion(chg_int_freq, scale_rcp_year) haz_cc.tag.description = 'climate change scenario for year %s and RCP %s '\ 'from Knutson et al 2015.' % (str(ref_year), str(rcp_scenario)) return haz_cc