def test_deprecation_warning_daily_2D(self): """Test if occur_prob.daily2D is deprecated""" with warnings.catch_warnings(record=True) as war: try: occur_prob.daily2D(None, [0, 24, 2], 'slt', [-60, 60, 3], 'latitude', ['slt'], [12.]) except TypeError: # Setting inst to None should produce a TypeError after # warning is generated pass assert len(war) >= 1 assert war[0].category == DeprecationWarning
def test_occur_prob_daily_2D_w_bins(self): """Runs a basic probability routine daily 2D w/ bins""" ans = occur_prob.daily2D(self.testInst, [0, 24, 2], 'slt', [-60, 60, 3], 'latitude', ['slt'], [12.], returnBins=True) assert abs(ans['slt']['prob'][:, 0] - 0.0).max() < 1.0e-6 assert abs(ans['slt']['prob'][:, 1] - 1.0).max() < 1.0e-6 assert (ans['slt']['prob']).shape == (3, 2) assert abs(ans['slt']['bin_x'] - [0, 12, 24]).max() < 1.0e-6 assert abs(ans['slt']['bin_y'] - [-60, -20, 20, 60]).max() < 1.0e-6
def test_occur_prob_daily_2D_w_mismatched_gate_and_data_label(self): """Catch a gate that does not match the data_label""" occur_prob.daily2D(self.testInst, [0, 360, 4], 'longitude', [-60, 60, 3], 'latitude', ['slt'], [12., 18.])
def test_occur_prob_daily_2D_w_bad_gate(self): """Catch a gate that is not list-like""" occur_prob.daily2D(self.testInst, [0, 360, 4], 'longitude', [-60, 60, 3], 'latitude', ['slt'], 12.)
def test_occur_prob_daily_2D_w_bad_data_label(self): """Catch a data_label that is not list-like""" occur_prob.daily2D(self.testInst, [0, 360, 4], 'longitude', [-60, 60, 3], 'latitude', 'slt', [12.])