コード例 #1
0
ファイル: test_subset.py プロジェクト: cedadev/cis
 def test_GIVEN_GriddedDataList_WHEN_constrain_THEN_correctly_subsetted_GriddedDataList_returned(self):
     gridded1 = cis.test.util.mock.make_square_5x3_2d_cube()
     gridded2 = cis.test.util.mock.make_square_5x3_2d_cube()
     datalist = GriddedDataList([gridded1, gridded2])
     subset = datalist.subset(longitude=[0.0, 5.0], latitude=[-5.0, 5.0])
     assert isinstance(subset, GriddedDataList)
     assert (subset[0].data.tolist() == [[5, 6], [8, 9], [11, 12]])
     assert (subset[1].data.tolist() == [[5, 6], [8, 9], [11, 12]])
コード例 #2
0
ファイル: test_subset.py プロジェクト: cedadev/cis
 def test_empty_time_subset_of_gridded_data_list_returns_no_data(self):
     """
     Checks that the convention of returning None if subsetting results in an empty subset.
     Longitude has no modulus and so uses the IRIS extract method
     """
     data = GriddedDataList([cis.test.util.mock.make_square_5x3_2d_cube_with_time()])
     subset = data.subset(time=[140500, 140550])
     assert (subset is None)
コード例 #3
0
ファイル: test_subset.py プロジェクト: cedadev/cis
 def test_empty_longitude_subset_of_gridded_data_list_returns_no_data(self):
     """
     Checks that the convention of returning None if subsetting results in an empty subset.
     Longitude has a modulus and so uses the IRIS intersection method
     """
     data = GriddedDataList([cis.test.util.mock.make_square_5x3_2d_cube()])
     subset = data.subset(longitude=[1.0, 3.0])
     assert (subset is None)
コード例 #4
0
 def test_empty_longitude_subset_of_gridded_data_list_returns_no_data(self):
     """
     Checks that the convention of returning None if subsetting results in an empty subset.
     Longitude has a modulus and so uses the IRIS intersection method
     """
     data = GriddedDataList([cis.test.util.mock.make_square_5x3_2d_cube()])
     subset = data.subset(longitude=[1.0, 3.0])
     assert (subset is None)
コード例 #5
0
 def test_GIVEN_GriddedDataList_WHEN_constrain_THEN_correctly_subsetted_GriddedDataList_returned(
         self):
     gridded1 = cis.test.util.mock.make_square_5x3_2d_cube()
     gridded2 = cis.test.util.mock.make_square_5x3_2d_cube()
     datalist = GriddedDataList([gridded1, gridded2])
     subset = datalist.subset(longitude=[0.0, 5.0], latitude=[-5.0, 5.0])
     assert isinstance(subset, GriddedDataList)
     assert (subset[0].data.tolist() == [[5, 6], [8, 9], [11, 12]])
     assert (subset[1].data.tolist() == [[5, 6], [8, 9], [11, 12]])
コード例 #6
0
 def test_empty_time_subset_of_gridded_data_list_returns_no_data(self):
     """
     Checks that the convention of returning None if subsetting results in an empty subset.
     Longitude has no modulus and so uses the IRIS extract method
     """
     data = GriddedDataList(
         [cis.test.util.mock.make_square_5x3_2d_cube_with_time()])
     subset = data.subset(time=[140500, 140550])
     assert (subset is None)