def test_berger_insolation_with_bad_solar_constant(): berger = BergerSolarInsolation() nx = 5 ny = 10 input_state = { 'time': datetime(2016, 12, 20, 6), 'longitude': DataArray(np.linspace(-90, 90, nx, endpoint=False), dims=['longitude'], attrs={'units': 'degree_E'}), 'latitude': DataArray(np.linspace(-180., 180., num=ny), dims=['latitude'], attrs={'units': 'degrees_north'}), 'solar_constant': DataArray(1364. * np.ones((2)), dims=['latitude'], attrs={'units': 'W m^-2'}), } with pytest.raises(ValueError) as excinfo: berger(input_state) assert 'Solar constant should' in str(excinfo.value)
def get_component_instance(self, state_modification_func=lambda x: x): return BergerSolarInsolation()
def get_component_instance(self): return BergerSolarInsolation()