コード例 #1
0
    def test_single_point_gives_single_value_in_masked_cell_using_kernel_and_con_missing_for_masked_true_binned_only(
            self):
        from cis.collocation.col_implementations import max
        con = BinnedCubeCellOnlyConstraint()
        kernel = max()

        single_point_results_in_single_value_in_masked_cell_using_kernel_and_con_missing_for_masked_true(con, kernel)
コード例 #2
0
    def test_max_kernel_with_dataset_in_two_dimensions_with_missing_values(self):
        self.kernel = max()

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

        data = make_regular_2d_ungridded_data_with_missing_values()

        cube_out = data.aggregate(how=self.kernel, **grid)

        result = numpy.ma.array([[4.0, 2.0, 6.0],
                                 [10.0, 14.0, 15.0]],
                                mask=[[0, 0, 0],
                                      [0, 0, 0]], fill_value=float('nan'))

        compare_masked_arrays(cube_out.data, result)
コード例 #3
0
    def test_max_kernel_with_dataset_in_two_dimensions_with_missing_values(
            self):
        self.kernel = max()

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

        data = make_regular_2d_ungridded_data_with_missing_values()

        cube_out = data.aggregate(how=self.kernel, **grid)

        result = numpy.ma.array([[4.0, 2.0, 6.0], [10.0, 14.0, 15.0]],
                                mask=[[0, 0, 0], [0, 0, 0]],
                                fill_value=float('nan'))

        compare_masked_arrays(cube_out.data, result)
コード例 #4
0
    def test_max_kernel_with_dataset_in_two_dimensions_with_missing_values(self):
        self.kernel = max()

        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([[4.0, 2.0, 6.0],
                                 [10.0, 14.0, 15.0]],
                                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))