def test_subset_temporal_index(self): # Test general functionality dataset = xr.Dataset({ 'first': (['lat', 'lon', 'time'], np.ones([180, 360, 6])), 'second': (['lat', 'lon', 'time'], np.ones([180, 360, 6])), 'lat': np.linspace(-89.5, 89.5, 180), 'lon': np.linspace(-179.5, 179.5, 360), 'time': [ '2000-01-01', '2000-02-01', '2000-03-01', '2000-04-01', '2000-05-01', '2000-06-01' ] }) actual = subset.subset_temporal_index(dataset, 2, 4) expected = xr.Dataset({ 'first': (['lat', 'lon', 'time'], np.ones([180, 360, 3])), 'second': (['lat', 'lon', 'time'], np.ones([180, 360, 3])), 'lat': np.linspace(-89.5, 89.5, 180), 'lon': np.linspace(-179.5, 179.5, 360), 'time': ['2000-03-01', '2000-04-01', '2000-05-01'] }) assert_dataset_equal(expected, actual)
def test_subset_temporal_index(self): # Test general functionality dataset = xr.Dataset({ 'first': (['lat', 'lon', 'time'], np.ones([180, 360, 6])), 'second': (['lat', 'lon', 'time'], np.ones([180, 360, 6])), 'lat': np.linspace(-89.5, 89.5, 180), 'lon': np.linspace(-179.5, 179.5, 360), 'time': ['2000-01-01', '2000-02-01', '2000-03-01', '2000-04-01', '2000-05-01', '2000-06-01']}) actual = subset.subset_temporal_index(dataset, 2, 4) expected = xr.Dataset({ 'first': (['lat', 'lon', 'time'], np.ones([180, 360, 3])), 'second': (['lat', 'lon', 'time'], np.ones([180, 360, 3])), 'lat': np.linspace(-89.5, 89.5, 180), 'lon': np.linspace(-179.5, 179.5, 360), 'time': ['2000-03-01', '2000-04-01', '2000-05-01']}) assert_dataset_equal(expected, actual)