示例#1
0
    def test_gridded_gridded_bin_when_sample_has_dimension_data_doesnt(self):
        # JASCIS-204
        from cis.data_io.gridded_data import make_from_cube
        sample = make_from_cube(make_mock_cube(time_dim_length=7, dim_order=['lat', 'lon', 'time']))
        data = make_from_cube(make_mock_cube(lat_dim_length=11, lon_dim_length=13,
                                             time_dim_length=0, dim_order=['time', 'lon', 'lat']))

        col = GeneralGriddedCollocator()
        constraint = BinningCubeCellConstraint()
        kernel = mean()
        out_cube = col.collocate(points=sample, data=data, constraint=constraint, kernel=kernel)
        assert out_cube[0].shape == (5, 3)
示例#2
0
    def test_basic_col_in_4d(self):
        from cis.collocation.col_implementations import GeneralUngriddedCollocator, mean, SepConstraintKdtree
        import datetime as dt

        ug_data = mock.make_regular_4d_ungridded_data()
        # Note - This isn't actually used for averaging
        sample_points = UngriddedData.from_points_array(
            [HyperPoint(lat=1.0, lon=1.0, alt=12.0, t=dt.datetime(1984, 8, 29, 8, 34))])

        col = GeneralUngriddedCollocator()
        new_data = col.collocate(sample_points, ug_data, SepConstraintKdtree(), mean())[0]
        eq_(new_data.data[0], 25.5)
示例#3
0
    def test_basic_col_in_4d(self):
        from cis.collocation.col_implementations import GeneralUngriddedCollocator, mean, SepConstraintKdtree
        import datetime as dt

        ug_data = mock.make_regular_4d_ungridded_data()
        # Note - This isn't actually used for averaging
        sample_points = UngriddedData.from_points_array([
            HyperPoint(lat=1.0,
                       lon=1.0,
                       alt=12.0,
                       t=dt.datetime(1984, 8, 29, 8, 34))
        ])

        col = GeneralUngriddedCollocator()
        new_data = col.collocate(sample_points, ug_data, SepConstraintKdtree(),
                                 mean())[0]
        eq_(new_data.data[0], 25.5)
    def test_gridded_ungridded_box_mean(self):
        data = make_from_cube(mock.make_mock_cube())
        data.name = lambda: 'Name'
        data.var_name = 'var_name'
        data._standard_name = 'y_wind'
        sample = UngriddedData.from_points_array(
            [HyperPoint(lat=1.0, lon=1.0, alt=12.0, t=dt.datetime(1984, 8, 29, 8, 34)),
             HyperPoint(lat=3.0, lon=3.0, alt=7.0, t=dt.datetime(1984, 8, 29, 8, 34)),
             HyperPoint(lat=-1.0, lon=-1.0, alt=5.0, t=dt.datetime(1984, 8, 29, 8, 34))])
        constraint = SepConstraintKdtree('500km')
        kernel = mean()

        col = GeneralUngriddedCollocator()
        output = col.collocate(sample, data, constraint, kernel)

        expected_result = np.array([28.0/3, 10.0, 20.0/3])
        assert len(output) == 1
        assert isinstance(output, UngriddedDataList)
        assert np.allclose(output[0].data, expected_result)
示例#5
0
 def __init__(self):
     self.mean = mean()
示例#6
0
 def setUp(self):
     self.kernel = mean()
示例#7
0
 def setUp(self):
     self.kernel = mean()