当前位置: 首页>>代码示例>>Python>>正文


Python Aggregator.aggregate_ungridded方法代码示例

本文整理汇总了Python中cis.aggregation.aggregator.Aggregator.aggregate_ungridded方法的典型用法代码示例。如果您正苦于以下问题:Python Aggregator.aggregate_ungridded方法的具体用法?Python Aggregator.aggregate_ungridded怎么用?Python Aggregator.aggregate_ungridded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cis.aggregation.aggregator.Aggregator的用法示例。


在下文中一共展示了Aggregator.aggregate_ungridded方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_aggregating_coord_to_length_one_with_explicit_bounds_gets_output_as_length_one

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
 def test_aggregating_coord_to_length_one_with_explicit_bounds_gets_output_as_length_one(self):
     data = make_regular_2d_ungridded_data()
     grid = {'x': AggregationGrid(-180, 180, 360, False), 'y': AggregationGrid(-90, 90, 10, False),}
     agg = Aggregator(data, grid)
     output = agg.aggregate_ungridded(self.kernel)
     lon = output.coord('longitude')
     assert_that(lon.points, is_([0]))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:9,代码来源:test_aggregation.py

示例2: test_aggregating_to_length_one_with_explicit_bounds_get_correct_bounds

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
 def test_aggregating_to_length_one_with_explicit_bounds_get_correct_bounds(self):
     data = make_regular_2d_ungridded_data()
     grid = {'x': AggregationGrid(-180, 180, 360, False), 'y': AggregationGrid(-90, 90, 10, False),}
     agg = Aggregator(data, grid)
     output = agg.aggregate_ungridded(self.kernel)
     lon = output.coord('longitude')
     assert_arrays_equal(lon.bounds, [[-180, 180]])
开发者ID:gitter-badger,项目名称:cis-1,代码行数:9,代码来源:test_aggregation.py

示例3: test_collapsed_coords_get_output_as_length_1

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
 def test_collapsed_coords_get_output_as_length_1(self):
     data = make_regular_2d_ungridded_data()
     grid = {'x': AggregationGrid(0, 360, 10, False)}
     agg = Aggregator(data, grid)
     output = agg.aggregate_ungridded(self.kernel)
     lat = output.coord('latitude')
     assert_that(lat.points, is_([0]))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:9,代码来源:test_aggregation.py

示例4: test_collapsed_coords_get_max_min_bounds

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
 def test_collapsed_coords_get_max_min_bounds(self):
     data = make_regular_2d_ungridded_data()
     grid = {'y': AggregationGrid(-90, 90, 10, False)}
     agg = Aggregator(data, grid)
     output = agg.aggregate_ungridded(self.kernel)
     lon = output.coord('longitude')
     assert_arrays_equal(lon.bounds, [[-5, 5]])
开发者ID:gitter-badger,项目名称:cis-1,代码行数:9,代码来源:test_aggregation.py

示例5: test_aggregation_two_dims_using_moments_kernel

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_aggregation_two_dims_using_moments_kernel(self):
        self.kernel = moments()
        data1 = make_regular_2d_ungridded_data_with_missing_values()
        data2 = make_regular_2d_ungridded_data_with_missing_values()
        data2.metadata._name = 'snow'
        data2._data += 10
        data = UngriddedDataList([data1, data2])
        grid = {'y': AggregationGrid(-12.5, 12.5, 15, False), 'x': AggregationGrid(-7.5, 7.5, 10, False)}

        agg = Aggregator(data, grid)
        output = agg.aggregate_ungridded(self.kernel)

        expect_mean = numpy.array([[4.4, 4.5], [35.0 / 3, 13.5]])
        expect_stddev = numpy.array([[numpy.sqrt(9.3), numpy.sqrt(4.5)],
                                     [numpy.sqrt(13.0 / 3), numpy.sqrt(4.5)]])
        expect_count = numpy.array([[5, 2], [3, 2]])

        assert isinstance(output, GriddedDataList)
        assert len(output) == 6
        mean_1, stddev_1, count_1, mean_2, stddev_2, count_2 = output
        assert mean_1.var_name == 'rain'
        assert stddev_1.var_name == 'rain_std_dev'
        assert count_1.var_name == 'rain_num_points'
        assert mean_2.var_name == 'snow'
        assert stddev_2.var_name == 'snow_std_dev'
        assert count_2.var_name == 'snow_num_points'
        assert_arrays_almost_equal(mean_1.data, expect_mean)
        assert_arrays_almost_equal(stddev_1.data, expect_stddev)
        assert_arrays_almost_equal(count_1.data, expect_count)
        assert_arrays_almost_equal(mean_2.data, expect_mean + 10)
        assert_arrays_almost_equal(stddev_2.data, expect_stddev)
        assert_arrays_almost_equal(count_2.data, expect_count)
开发者ID:gitter-badger,项目名称:cis-1,代码行数:34,代码来源:test_aggregation.py

示例6: test_aggregating_list_of_datasets_over_two_dims

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_aggregating_list_of_datasets_over_two_dims(self):

        grid = {'x': AggregationGrid(-7.5, 7.5, 5, False), 'y': AggregationGrid(-12.5, 12.5, 5, False)}

        datalist = UngriddedDataList([make_regular_2d_ungridded_data_with_missing_values(),
                                     make_regular_2d_ungridded_data_with_missing_values()])

        agg = Aggregator(datalist, grid)
        cube_out = agg.aggregate_ungridded(self.kernel)

        result = numpy.ma.array([[1.0, 2.0, 3.0],
                                 [4.0, 5.0, 6.0],
                                 [7.0, 8.0, 9.0],
                                 [10.0, 11.0, 12.0],
                                 [13.0, 14.0, 15.0]],
                                mask=[[0, 0, 0],
                                      [0, 1, 0],
                                      [0, 0, 1],
                                      [0, 0, 0],
                                      [1, 0, 0]], fill_value=float('inf'))

        print cube_out[0].data.fill_value
        assert len(cube_out) == 2
        assert numpy.array_equal(numpy.ma.filled(cube_out[0].data), numpy.ma.filled(result))
        assert numpy.array_equal(numpy.ma.filled(cube_out[1].data), numpy.ma.filled(result))
开发者ID:cpaulik,项目名称:cis,代码行数:27,代码来源:test_aggregation.py

示例7: test_aggregating_single_point_in_one_dimension

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_aggregating_single_point_in_one_dimension(self):
        grid = {'y': AggregationGrid(-12.5, 12.5, 5, False)}

        data = make_dummy_ungridded_data_single_point()

        agg = Aggregator(data, grid)
        cube_out = agg.aggregate_ungridded(self.kernel)

        result = numpy.ma.array([[0], [0], [1.0], [0], [0]], mask=[[1], [1], [0], [1], [1]], fill_value=float('inf'))

        assert_arrays_equal(numpy.ma.filled(cube_out[0].data), numpy.ma.filled(result))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:13,代码来源:test_aggregation.py

示例8: test_mean_kernel_with_dataset_in_two_dimensions_with_missing_values

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_mean_kernel_with_dataset_in_two_dimensions_with_missing_values(self):
        grid = {'x': AggregationGrid(-7.5, 7.5, 5, False), 'y': AggregationGrid(-12.5, 12.5, 12.5, False)}

        data = make_regular_2d_ungridded_data_with_missing_values()

        agg = Aggregator(data, grid)
        cube_out = agg.aggregate_ungridded(self.kernel)

        result = numpy.ma.array([[2.5, 2.0, 4.5],
                                 [8.5, 11.0, 13.5]],
                                mask=[[0, 0, 0],
                                      [0, 0, 0]], fill_value=float('inf'))

        assert_arrays_equal(numpy.ma.filled(cube_out[0].data), numpy.ma.filled(result))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:16,代码来源:test_aggregation.py

示例9: test_can_name_variables_by_standard_name

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_can_name_variables_by_standard_name(self):
        """
        Note that this is also the variable name for many ungridded cases
        """
        grid = {'latitude': AggregationGrid(-12.5, 12.5, 5, False)}

        data = make_dummy_ungridded_data_single_point()

        agg = Aggregator(data, grid)
        cube_out = agg.aggregate_ungridded(self.kernel)

        result = numpy.ma.array([[0], [0], [1.0], [0], [0]], mask=[[1], [1], [0], [1], [1]], fill_value=float('inf'))

        assert_arrays_equal(numpy.ma.filled(cube_out[0].data), numpy.ma.filled(result))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:16,代码来源:test_aggregation.py

示例10: test_GIVEN_ungridded_data_WHEN_collapse_THEN_calculations_correct

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_GIVEN_ungridded_data_WHEN_collapse_THEN_calculations_correct(self):
        grid = {'y': AggregationGrid(-12.5, 12.5, 12.5, False)}
        data = mock.make_regular_2d_ungridded_data()
        kernel_class = get_kernel('moments')
        kernel = kernel_class()
        agg = Aggregator(data, grid)
        result = agg.aggregate_ungridded(kernel)

        expected_means = numpy.array([3.5, 11])
        expected_std_dev = numpy.array([numpy.sqrt(3.5), numpy.sqrt(7.5)])
        expected_no = numpy.array([6, 9])
        assert_that(len(result), is_(3))
        assert_arrays_almost_equal(result[0].data.flatten(), expected_means)
        assert_arrays_almost_equal(result[1].data.flatten(), expected_std_dev)
        assert_that(numpy.array_equal(result[2].data.flatten(), expected_no))
开发者ID:cpaulik,项目名称:cis,代码行数:17,代码来源:test_aggregation_kernels.py

示例11: test_aggregating_single_point_in_one_dimension_upper_bound_edge_case

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_aggregating_single_point_in_one_dimension_upper_bound_edge_case(self):
        """
        Test to document the behaviour of aggregation when a point on a cell's upper bound is taken to be in that cell
          or out of it. If the point is on the upper bound it is NOT taken to be part of that cell.
        """
        grid = {'y': AggregationGrid(-12.5, 12.5, 5, False)}

        data = make_dummy_ungridded_data_single_point(lat=2.50000)

        agg = Aggregator(data, grid)
        cube_out = agg.aggregate_ungridded(self.kernel)

        result = numpy.ma.array([[0], [0], [0.0], [1.0], [0]], mask=[[1], [1], [1], [0], [1]], fill_value=float('inf'))

        assert_arrays_equal(numpy.ma.filled(cube_out[0].data), numpy.ma.filled(result))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:17,代码来源:test_aggregation.py

示例12: test_stddev_kernel_with_dataset_in_two_dimensions_with_missing_values

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_stddev_kernel_with_dataset_in_two_dimensions_with_missing_values(self):
        self.kernel = stddev()

        grid = {'x': AggregationGrid(-7.5, 7.5, 5, False), 'y': AggregationGrid(-12.5, 12.5, 12.5, False)}

        data = make_regular_2d_ungridded_data_with_missing_values()

        agg = Aggregator(data, grid)
        cube_out = agg.aggregate_ungridded(self.kernel)

        result = numpy.ma.array([[numpy.sqrt(4.5), float('NaN'), numpy.sqrt(4.5)],
                                 [numpy.sqrt(4.5), 3.0, numpy.sqrt(4.5)]],
                                mask=[[0, 1, 0],
                                      [0, 0, 0]], fill_value=float('inf'))

        assert_arrays_equal(numpy.ma.filled(cube_out[0].data), numpy.ma.filled(result))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:18,代码来源:test_aggregation.py

示例13: test_aggregating_simple_dataset_in_two_dimensions_with_missing_values

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_aggregating_simple_dataset_in_two_dimensions_with_missing_values(self):
        grid = {'x': AggregationGrid(-7.5, 7.5, 5, False), 'y': AggregationGrid(-12.5, 12.5, 5, False)}

        data = make_regular_2d_ungridded_data_with_missing_values()

        agg = Aggregator(data, grid)
        cube_out = agg.aggregate_ungridded(self.kernel)

        result = numpy.ma.array([[1.0, 2.0, 3.0],
                                 [4.0, 5.0, 6.0],
                                 [7.0, 8.0, 9.0],
                                 [10.0, 11.0, 12.0],
                                 [13.0, 14.0, 15.0]],
                                mask=[[0, 0, 0],
                                      [0, 1, 0],
                                      [0, 0, 1],
                                      [0, 0, 0],
                                      [1, 0, 0]], fill_value=float('inf'))

        assert numpy.array_equal(numpy.ma.filled(cube_out[0].data), numpy.ma.filled(result))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:22,代码来源:test_aggregation.py

示例14: test_aggregating_edge_cases

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_aggregating_edge_cases(self):
        """
        Further tests to reinforce the above edge case tests in two dimensions. Note that the upper edges of the
        ungridded data points array are removed from the aggregate because they fall on the respective cells' upper
        bounds.
        """
        grid = {'x': AggregationGrid(-5, 5, 5, False), 'y': AggregationGrid(-10, 10, 5, False)}

        data = make_regular_2d_ungridded_data()

        agg = Aggregator(data, grid)
        cube_out = agg.aggregate_ungridded(self.kernel)

        result = numpy.array([[1.0, 2.0],  # 3.0],
                              [4.0, 5.0],  # 6.0],
                              [7.0, 8.0],  # 9.0],
                              [10.0, 11.0]])  # 12.0],
        # [13.0, 14.0, 15.0]],

        assert_arrays_equal(numpy.ma.filled(cube_out[0].data), numpy.ma.filled(result))
开发者ID:gitter-badger,项目名称:cis-1,代码行数:22,代码来源:test_aggregation.py

示例15: test_aggregation_one_dim_using_moments_kernel

# 需要导入模块: from cis.aggregation.aggregator import Aggregator [as 别名]
# 或者: from cis.aggregation.aggregator.Aggregator import aggregate_ungridded [as 别名]
    def test_aggregation_one_dim_using_moments_kernel(self):
        self.kernel = moments()
        data = make_regular_2d_ungridded_data_with_missing_values()
        grid = {'y': AggregationGrid(-12.5, 12.5, 12.5, False)}

        agg = Aggregator(data, grid)
        output = agg.aggregate_ungridded(self.kernel)

        expect_mean = numpy.array([[3.2], [11]])
        expect_stddev = numpy.array([[numpy.sqrt(3.7)], [numpy.sqrt(26 / 3.0)]])
        expect_count = numpy.array([[5], [7]])

        assert isinstance(output, GriddedDataList)
        assert len(output) == 3
        actual_mean, actual_stddev, actual_count = output
        assert actual_mean.var_name == 'rain'
        assert actual_stddev.var_name == 'rain_std_dev'
        assert actual_count.var_name == 'rain_num_points'
        assert_arrays_almost_equal(actual_mean.data, expect_mean)
        assert_arrays_almost_equal(actual_stddev.data, expect_stddev)
        assert_arrays_almost_equal(actual_count.data, expect_count)
开发者ID:gitter-badger,项目名称:cis-1,代码行数:23,代码来源:test_aggregation.py


注:本文中的cis.aggregation.aggregator.Aggregator.aggregate_ungridded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。