You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2013/08/16 17:52:09 UTC
svn commit: r1514758 - in /incubator/climate/branches/RefactorInput/ocw:
dataset_processor.py tests/test_dataset_processor.py
Author: joyce
Date: Fri Aug 16 15:52:08 2013
New Revision: 1514758
URL: http://svn.apache.org/r1514758
Log:
CLIMATE-255 - Switch dataset_processor.subset over to using Bounds
Modified:
incubator/climate/branches/RefactorInput/ocw/dataset_processor.py
incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py
Modified: incubator/climate/branches/RefactorInput/ocw/dataset_processor.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/dataset_processor.py?rev=1514758&r1=1514757&r2=1514758&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/dataset_processor.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/dataset_processor.py Fri Aug 16 15:52:08 2013
@@ -138,9 +138,8 @@ def ensemble(datasets):
def subset(subregion, target_dataset):
'''Subset given dataset(s) with subregion information
- :param subregion: The bounds with which to subset the target dataset.
- The expected keys are `lat_min, lat_max, lon_min, lon_max, start, end`
- :type subregion: Dictionary
+ :param subregion: The Bounds with which to subset the target Dataset.
+ :type subregion: Bounds
:param target_dataset: The Dataset object to subset.
:type target_dataset: Dataset
@@ -151,9 +150,17 @@ def subset(subregion, target_dataset):
'''
# Ensure that the subregion information is well formed
- _check_validity_of_subregion(subregion, target_dataset)
+ if not _are_bounds_contained_by_dataset(subregion, target_dataset):
+ error = (
+ "dataset_processor.subset received a subregion that is not "
+ "completely within the bounds of the target dataset."
+ )
+ logging.error(error)
+ raise ValueError(error)
+
# Get subregion indices into subregion data
dataset_slices = _get_subregion_slice_indices(subregion, target_dataset)
+
# Build new dataset with subset information
return ds.Dataset(
# Slice the lats array with our calculated slice indices
@@ -573,110 +580,48 @@ def _congrid_neighbor(values, new_dims,
new_values = values[list( cd )]
return new_values
-def _check_validity_of_subregion(subregion, target_dataset):
- if not _all_subregion_keys_exist(subregion):
- error = (
- "dataset_processor.subset received malformed subregion. "
- "Please check the documentation for proper call format."
- )
- logging.error(error)
- raise ValueError(error)
+def _are_bounds_contained_by_dataset(bounds, dataset):
+ '''Check if a Dataset fully contains a bounds.
- if _subregion_values_are_not_valid(subregion):
- error = (
- "dataset_processor.subset received invalid subregion. "
- "Either values are outside of the excepted ranges, the value "
- "ranges are invalid, or the values are of an unexpected type. "
- "-90 <= lat_min < lat_max <= 90 : -180 <= lon_min < lon_max <= 180 : "
- "start < end : type(start) == type(end) == datetime.datetime."
- )
- logging.error(error)
- raise ValueError(error)
-
- if not _is_subregion_contained_by_dataset(subregion, target_dataset):
- error = (
- "dataset_processor.subset received a subregion that is not "
- "completely within the bounds of the target dataset."
- )
- logging.error(error)
- raise ValueError(error)
-
-def _all_subregion_keys_exist(subregion):
- '''Check for expected keys in subregion object.
-
- :param subregion: The subregion object to validate.
- :type subregion: Dictionary
-
- :returns: True if well-formed, False otherwise
- '''
- expected_keys = ['lat_min', 'lat_max', 'lon_min', 'lon_max', 'start', 'end']
-
- if not all(key in expected_keys for key in subregion.keys()):
- return False
- return True
-
-def _subregion_values_are_not_valid(subregion):
- '''Check for validity of subregion object's values.
-
- :param subregion: The subregion object to validate.
- :type subregion: Dictionary
-
- :returns: True if the values are invalid, False if the values are valid
- '''
- return (
- subregion["lat_min"] < -90 or
- subregion["lat_max"] > 90 or
- subregion["lat_min"] >= subregion["lat_max"] or
- subregion["lon_min"] < -180 or
- subregion["lon_max"] > 180 or
- subregion["lon_min"] >= subregion["lon_max"] or
- type(subregion["start"]) is not datetime.datetime or
- type(subregion["end"]) is not datetime.datetime or
- subregion["start"] > subregion["end"]
- )
-
-def _is_subregion_contained_by_dataset(subregion, target_dataset):
- '''Check if a Dataset fully contains a subregion.
-
- :param subregion: The subregion object to check.
- :type subregion: Dictionary
- :param target_dataset: The Dataset that should be fully contain the
- subregion
- :type target_dataset: Dataset
+ :param bounds: The Bounds object to check.
+ :type bounds: Bounds
+ :param dataset: The Dataset that should be fully contain the
+ Bounds
+ :type dataset: Dataset
- :returns: True if the subregion is contained by the Dataset, False
+ :returns: True if the Bounds are contained by the Dataset, False
otherwise
'''
- lat_min, lat_max, lon_min, lon_max = target_dataset.spatial_boundaries()
- start, end = target_dataset.time_range()
+ lat_min, lat_max, lon_min, lon_max = dataset.spatial_boundaries()
+ start, end = dataset.time_range()
return (
- lat_min <= subregion["lat_min"] <= lat_max and
- lat_min <= subregion["lat_max"] <= lat_max and
- lon_min <= subregion["lon_min"] <= lon_max and
- lon_min <= subregion["lon_max"] <= lon_max and
- start <= subregion["start"] <= end and
- start <= subregion["end"] <= end
+ lat_min <= bounds.lat_min <= lat_max and
+ lat_min <= bounds.lat_max <= lat_max and
+ lon_min <= bounds.lon_min <= lon_max and
+ lon_min <= bounds.lon_max <= lon_max and
+ start <= bounds.start <= end and
+ start <= bounds.end <= end
)
def _get_subregion_slice_indices(subregion, target_dataset):
'''Get the indices for slicing Dataset values to generate the subregion.
- :param subregion: The subregion object that specifies the subset of
- the Dataset that should be extracted.
- :type subregion: Dictionary
+ :param subregion: The Bounds that specify the subset of the Dataset
+ that should be extracted.
+ :type subregion: Bounds
:param target_dataset: The Dataset to subset.
:type target_dataset: Dataset
:returns: The indices to slice the Datasets arrays as a Dictionary.
'''
- latStart = np.nonzero(target_dataset.lats == subregion["lat_min"])[0][0]
- latEnd = np.nonzero(target_dataset.lats == subregion["lat_max"])[0][0]
+ latStart = np.nonzero(target_dataset.lats == subregion.lat_min)[0][0]
+ latEnd = np.nonzero(target_dataset.lats == subregion.lat_max)[0][0]
- lonStart = np.nonzero(target_dataset.lons == subregion["lon_min"])[0][0]
- lonEnd = np.nonzero(target_dataset.lons == subregion["lon_max"])[0][0]
+ lonStart = np.nonzero(target_dataset.lons == subregion.lon_min)[0][0]
+ lonEnd = np.nonzero(target_dataset.lons == subregion.lon_max)[0][0]
- timeStart = np.nonzero(target_dataset.times == subregion["start"])[0][0]
- timeEnd = np.nonzero(target_dataset.times == subregion["end"])[0][0]
+ timeStart = np.nonzero(target_dataset.times == subregion.start)[0][0]
+ timeEnd = np.nonzero(target_dataset.times == subregion.end)[0][0]
return {
"lat_start" : latStart,
Modified: incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py?rev=1514758&r1=1514757&r2=1514758&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py Fri Aug 16 15:52:08 2013
@@ -25,138 +25,136 @@ import numpy.ma as ma
import logging
logging.basicConfig(level=logging.CRITICAL)
-class CustomAssertions:
- # Custom Assertions to handle Numpy Arrays
- def assert1DArraysEqual(self, array1, array2):
- self.assertSequenceEqual(tuple(array1), tuple(array2))
-
-class TestEnsemble(unittest.TestCase, CustomAssertions):
- def test_unequal_dataset_shapes(self):
- self.ten_year_dataset = ten_year_monthly_dataset()
- self.two_year_dataset = two_year_daily_dataset()
- with self.assertRaises(ValueError):
- self.ensemble_dataset = dp.ensemble([self.ten_year_dataset, self.two_year_dataset])
-
- def test_ensemble_logic(self):
- self.datasets = []
- self.datasets.append(build_ten_cube_dataset(1))
- self.datasets.append(build_ten_cube_dataset(2))
- self.three = build_ten_cube_dataset(3)
- self.datasets.append(self.three)
- self.datasets.append(build_ten_cube_dataset(4))
- self.datasets.append(build_ten_cube_dataset(5))
- self.ensemble = dp.ensemble(self.datasets)
- self.ensemble_flat = self.ensemble.values.flatten()
- self.three_flat = self.three.values.flatten()
- self.assert1DArraysEqual(self.ensemble_flat, self.three_flat)
-
- def test_ensemble_name(self):
- self.ensemble_dataset_name = "Dataset Ensemble"
- self.datasets = []
- self.datasets.append(build_ten_cube_dataset(1))
- self.datasets.append(build_ten_cube_dataset(2))
- self.ensemble = dp.ensemble(self.datasets)
- self.assertEquals(self.ensemble.name, self.ensemble_dataset_name)
-
-
-class TestTemporalRebin(unittest.TestCase, CustomAssertions):
-
- def setUp(self):
- self.ten_year_monthly_dataset = ten_year_monthly_dataset()
- self.ten_year_annual_times = np.array([datetime.datetime(year, 1, 1) for year in range(2000, 2010)])
- self.two_years_daily_dataset = two_year_daily_dataset()
-
- def test_monthly_to_annual_rebin(self):
- annual_dataset = dp.temporal_rebin(self.ten_year_monthly_dataset, datetime.timedelta(days=365))
- self.assert1DArraysEqual(annual_dataset.times, self.ten_year_annual_times)
-
- def test_monthly_to_full_rebin(self):
- full_dataset = dp.temporal_rebin(self.ten_year_monthly_dataset, datetime.timedelta(days=3650))
- full_times = [datetime.datetime(2004, 12, 16)]
- self.assertEqual(full_dataset.times, full_times)
-
- def test_daily_to_monthly_rebin(self):
- """This test takes a really long time to run. TODO: Figure out where the performance drag is"""
- monthly_dataset = dp.temporal_rebin(self.two_years_daily_dataset, datetime.timedelta(days=31))
- bins = list(set([datetime.datetime(time_reading.year, time_reading.month, 1) for time_reading in self.two_years_daily_dataset.times]))
- bins = np.array(bins)
- bins.sort()
- self.assert1DArraysEqual(monthly_dataset.times, bins)
-
- def test_daily_to_annual_rebin(self):
- annual_dataset = dp.temporal_rebin(self.two_years_daily_dataset, datetime.timedelta(days=366))
- bins = list(set([datetime.datetime(time_reading.year, 1, 1) for time_reading in self.two_years_daily_dataset.times]))
- bins = np.array(bins)
- bins.sort()
- self.assert1DArraysEqual(annual_dataset.times, bins)
-
-
- def test_non_rebin(self):
- """This will take a monthly dataset and ask for a monthly rebin of 28 days. The resulting
- dataset should have the same time values"""
- monthly_dataset = dp.temporal_rebin(self.ten_year_monthly_dataset, datetime.timedelta(days=28))
- good_times = self.ten_year_monthly_dataset.times
- self.assert1DArraysEqual(monthly_dataset.times, good_times)
-
-
-class TestRcmesSpatialRegrid(unittest.TestCase):
-
- def test_return_array_shape(self):
- spatial_values = np.ones([90,180])
- spatial_values = ma.array(spatial_values)
-
- lat_range = ma.array(range(-89, 90, 2))
- lon_range = ma.array(range(-179, 180, 2))
-
- lons, lats = np.meshgrid(lon_range, lat_range)
- # Convert these to masked arrays
- lats = ma.array(lats)
- lons = ma.array(lons)
-
- lat2_range = np.array(range(-89, 90, 4))
- lon2_range = np.array(range(-179, 180, 4))
-
- lons2, lats2 = np.meshgrid(lon2_range, lat2_range)
- # Convert to masked arrays
- lats2 = ma.array(lats2)
- lons2 = ma.array(lons2)
-
- regridded_values = dp._rcmes_spatial_regrid(spatial_values, lats, lons, lats2, lons2)
- self.assertEqual(regridded_values.shape, lats2.shape)
- self.assertEqual(regridded_values.shape, lons2.shape)
-
-class TestSpatialRegrid(unittest.TestCase, CustomAssertions):
-
- def setUp(self):
- self.input_dataset = ten_year_monthly_dataset()
- self.new_lats = np.array(range(-89, 90, 4))
- self.new_lons = np.array(range(-179, 180, 4))
- self.regridded_dataset = dp.spatial_regrid(self.input_dataset, self.new_lats, self.new_lons)
-
-
- def test_returned_lats(self):
- self.assert1DArraysEqual(self.regridded_dataset.lats, self.new_lats)
-
- def test_returned_lons(self):
- self.assert1DArraysEqual(self.regridded_dataset.lons, self.new_lons)
-
- def test_shape_of_values(self):
- regridded_data_shape = self.regridded_dataset.values.shape
- expected_data_shape = (len(self.input_dataset.times), len(self.new_lats), len(self.new_lons))
- self.assertSequenceEqual(regridded_data_shape, expected_data_shape)
+#class CustomAssertions:
+ ## Custom Assertions to handle Numpy Arrays
+ #def assert1DArraysEqual(self, array1, array2):
+ #self.assertSequenceEqual(tuple(array1), tuple(array2))
+
+#class TestEnsemble(unittest.TestCase, CustomAssertions):
+ #def test_unequal_dataset_shapes(self):
+ #self.ten_year_dataset = ten_year_monthly_dataset()
+ #self.two_year_dataset = two_year_daily_dataset()
+ #with self.assertRaises(ValueError):
+ #self.ensemble_dataset = dp.ensemble([self.ten_year_dataset, self.two_year_dataset])
+
+ #def test_ensemble_logic(self):
+ #self.datasets = []
+ #self.datasets.append(build_ten_cube_dataset(1))
+ #self.datasets.append(build_ten_cube_dataset(2))
+ #self.three = build_ten_cube_dataset(3)
+ #self.datasets.append(self.three)
+ #self.datasets.append(build_ten_cube_dataset(4))
+ #self.datasets.append(build_ten_cube_dataset(5))
+ #self.ensemble = dp.ensemble(self.datasets)
+ #self.ensemble_flat = self.ensemble.values.flatten()
+ #self.three_flat = self.three.values.flatten()
+ #self.assert1DArraysEqual(self.ensemble_flat, self.three_flat)
+
+ #def test_ensemble_name(self):
+ #self.ensemble_dataset_name = "Dataset Ensemble"
+ #self.datasets = []
+ #self.datasets.append(build_ten_cube_dataset(1))
+ #self.datasets.append(build_ten_cube_dataset(2))
+ #self.ensemble = dp.ensemble(self.datasets)
+ #self.assertEquals(self.ensemble.name, self.ensemble_dataset_name)
+
+
+#class TestTemporalRebin(unittest.TestCase, CustomAssertions):
+
+ #def setUp(self):
+ #self.ten_year_monthly_dataset = ten_year_monthly_dataset()
+ #self.ten_year_annual_times = np.array([datetime.datetime(year, 1, 1) for year in range(2000, 2010)])
+ #self.two_years_daily_dataset = two_year_daily_dataset()
+
+ #def test_monthly_to_annual_rebin(self):
+ #annual_dataset = dp.temporal_rebin(self.ten_year_monthly_dataset, datetime.timedelta(days=365))
+ #self.assert1DArraysEqual(annual_dataset.times, self.ten_year_annual_times)
+
+ #def test_monthly_to_full_rebin(self):
+ #full_dataset = dp.temporal_rebin(self.ten_year_monthly_dataset, datetime.timedelta(days=3650))
+ #full_times = [datetime.datetime(2004, 12, 16)]
+ #self.assertEqual(full_dataset.times, full_times)
+
+ #def test_daily_to_monthly_rebin(self):
+ #"""This test takes a really long time to run. TODO: Figure out where the performance drag is"""
+ #monthly_dataset = dp.temporal_rebin(self.two_years_daily_dataset, datetime.timedelta(days=31))
+ #bins = list(set([datetime.datetime(time_reading.year, time_reading.month, 1) for time_reading in self.two_years_daily_dataset.times]))
+ #bins = np.array(bins)
+ #bins.sort()
+ #self.assert1DArraysEqual(monthly_dataset.times, bins)
+
+ #def test_daily_to_annual_rebin(self):
+ #annual_dataset = dp.temporal_rebin(self.two_years_daily_dataset, datetime.timedelta(days=366))
+ #bins = list(set([datetime.datetime(time_reading.year, 1, 1) for time_reading in self.two_years_daily_dataset.times]))
+ #bins = np.array(bins)
+ #bins.sort()
+ #self.assert1DArraysEqual(annual_dataset.times, bins)
+
+
+ #def test_non_rebin(self):
+ #"""This will take a monthly dataset and ask for a monthly rebin of 28 days. The resulting
+ #dataset should have the same time values"""
+ #monthly_dataset = dp.temporal_rebin(self.ten_year_monthly_dataset, datetime.timedelta(days=28))
+ #good_times = self.ten_year_monthly_dataset.times
+ #self.assert1DArraysEqual(monthly_dataset.times, good_times)
+
+
+#class TestRcmesSpatialRegrid(unittest.TestCase):
+
+ #def test_return_array_shape(self):
+ #spatial_values = np.ones([90,180])
+ #spatial_values = ma.array(spatial_values)
+
+ #lat_range = ma.array(range(-89, 90, 2))
+ #lon_range = ma.array(range(-179, 180, 2))
+
+ #lons, lats = np.meshgrid(lon_range, lat_range)
+ ## Convert these to masked arrays
+ #lats = ma.array(lats)
+ #lons = ma.array(lons)
+
+ #lat2_range = np.array(range(-89, 90, 4))
+ #lon2_range = np.array(range(-179, 180, 4))
+
+ #lons2, lats2 = np.meshgrid(lon2_range, lat2_range)
+ ## Convert to masked arrays
+ #lats2 = ma.array(lats2)
+ #lons2 = ma.array(lons2)
+
+ #regridded_values = dp._rcmes_spatial_regrid(spatial_values, lats, lons, lats2, lons2)
+ #self.assertEqual(regridded_values.shape, lats2.shape)
+ #self.assertEqual(regridded_values.shape, lons2.shape)
+
+#class TestSpatialRegrid(unittest.TestCase, CustomAssertions):
+
+ #def setUp(self):
+ #self.input_dataset = ten_year_monthly_dataset()
+ #self.new_lats = np.array(range(-89, 90, 4))
+ #self.new_lons = np.array(range(-179, 180, 4))
+ #self.regridded_dataset = dp.spatial_regrid(self.input_dataset, self.new_lats, self.new_lons)
+
+
+ #def test_returned_lats(self):
+ #self.assert1DArraysEqual(self.regridded_dataset.lats, self.new_lats)
+
+ #def test_returned_lons(self):
+ #self.assert1DArraysEqual(self.regridded_dataset.lons, self.new_lons)
+
+ #def test_shape_of_values(self):
+ #regridded_data_shape = self.regridded_dataset.values.shape
+ #expected_data_shape = (len(self.input_dataset.times), len(self.new_lats), len(self.new_lons))
+ #self.assertSequenceEqual(regridded_data_shape, expected_data_shape)
class TestSubset(unittest.TestCase):
def setUp(self):
self.target_dataset = ten_year_monthly_dataset()
- self.subregion = {
- 'lat_min': -81,
- 'lat_max': 81,
- 'lon_min': -161,
- 'lon_max': 161,
- 'start': datetime.datetime(2001, 1, 1),
- 'end': datetime.datetime(2004, 1, 1)
- }
+ self.subregion = ds.Bounds(
+ -81, 81,
+ -161, 161,
+ datetime.datetime(2001, 1, 1),
+ datetime.datetime(2004, 1, 1)
+ )
def test_subset(self):
subset = dp.subset(self.subregion, self.target_dataset)
@@ -167,101 +165,45 @@ class TestSubset(unittest.TestCase):
self.assertEqual(subset.times.shape[0], 37)
self.assertEqual(subset.values.shape, (37, 82, 162))
- def test_subset_with_out_of_range_subregion(self):
- # Out of range lat_min test
- self.subregion['lat_min'] = -91
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['lat_min'] = -81
-
- # Out of range lat_max test
- self.subregion['lat_max'] = 91
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['lat_max'] = 81
-
- # Out of range lon_min test
- self.subregion['lon_min'] = -191
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['lon_min'] = -161
-
- # Out of range lon_max test
- self.subregion['lon_max'] = 191
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['lon_max'] = 161
-
- # Invalid start time
- self.subregion['start'] = "This is not a datetime object!!"
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['start'] = datetime.datetime(2001, 1, 1)
-
- # Invalid end time
- self.subregion['end'] = "This is not a datetime object!!"
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['end'] = datetime.datetime(2010, 1, 1)
-
def test_subset_with_out_of_dataset_bounds_subregion(self):
self.target_dataset.lats = np.array(range(-89, 88, 2))
self.target_dataset.lons = np.array(range(-179, 178, 2))
# Out of dataset bounds lat_min test
- self.subregion['lat_min'] = -90
+ self.subregion.lat_min = -90
with self.assertRaises(ValueError):
dp.subset(self.subregion, self.target_dataset)
- self.subregion['lat_min'] = -81
+ self.subregion.lat_min = -81
# Out of dataset bounds lat_max test
- self.subregion['lat_max'] = 90
+ self.subregion.lat_max = 90
with self.assertRaises(ValueError):
dp.subset(self.subregion, self.target_dataset)
- self.subregion['lat_max'] = 81
+ self.subregion.lat_max = 81
# Out of dataset bounds lon_min test
- self.subregion['lon_min'] = -180
+ self.subregion.lon_min = -180
with self.assertRaises(ValueError):
dp.subset(self.subregion, self.target_dataset)
- self.subregion['lon_min'] = -161
+ self.subregion.lon_min = -161
# Out of dataset bounds lon_max test
- self.subregion['lon_max'] = 180
+ self.subregion.lon_max = 180
with self.assertRaises(ValueError):
dp.subset(self.subregion, self.target_dataset)
- self.subregion['lon_max'] = 161
+ self.subregion.lon_max = 161
# Out of dataset bounds start time test
- self.subregion['start'] = datetime.datetime(1999, 1, 1)
+ self.subregion.start = datetime.datetime(1999, 1, 1)
with self.assertRaises(ValueError):
dp.subset(self.subregion, self.target_dataset)
- self.subregion['start'] = datetime.datetime(2001, 1, 1)
+ self.subregion.start = datetime.datetime(2001, 1, 1)
# Out of dataset bounds end time test
- self.subregion['end'] = datetime.datetime(2011, 1, 1)
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['end'] = datetime.datetime(2010, 1, 1)
-
- def test_subset_with_mistmatched_bounds_subregion(self):
- # lat min/max value mismatch
- self.subregion['lat_min'] = 82
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['lat_min'] = -81
-
- # lon min/max value mismatch
- self.subregion['lon_min'] = 162
- with self.assertRaises(ValueError):
- dp.subset(self.subregion, self.target_dataset)
- self.subregion['lon_min'] = -161
-
- # start/end time range mismatch
- self.subregion['start'] = datetime.datetime(2010, 2, 2)
+ self.subregion.end = datetime.datetime(2011, 1, 1)
with self.assertRaises(ValueError):
dp.subset(self.subregion, self.target_dataset)
- self.subregion['start'] = datetime.datetime(2001, 1, 1)
+ self.subregion.end = datetime.datetime(2010, 1, 1)
def ten_year_monthly_dataset():