def test_nearest_neighbour_interpolation(self, mock_set): cube_3 = self.cube cube_3.attributes = dict(spatial_processing_type='Nearest neighbour ' 'interpolation') # If the cube has a nearest neighbour interpolation attribute, spatial # processing code should be 3 and number of points used should be 1. product_definition_template_15(cube_3, mock.sentinel.grib) mock_set.assert_any_call(mock.sentinel.grib, "productDefinitionTemplateNumber", 15) mock_set.assert_any_call(mock.sentinel.grib, "spatialProcessing", 3) mock_set.assert_any_call(mock.sentinel.grib, "numberOfPointsUsed", 1)
def test_bicubic_interpolation(self, mock_set): cube_2 = self.cube cube_2.attributes = dict(spatial_processing_type='Bicubic ' 'interpolation') # If the cube has a bicubic interpolation attribute, spatial # processing code should be 2 and number of points used should be 4. product_definition_template_15(cube_2, mock.sentinel.grib) mock_set.assert_any_call(mock.sentinel.grib, "productDefinitionTemplateNumber", 15) mock_set.assert_any_call(mock.sentinel.grib, "spatialProcessing", 2) mock_set.assert_any_call(mock.sentinel.grib, "numberOfPointsUsed", 4)
def test_cell_method(self, mock_set): cube_0 = self.cube cube_0.attributes = dict(spatial_processing_type='No interpolation') cell_method = CellMethod(method='mean', coords=['area']) cube_0.add_cell_method(cell_method) # If the cube has a cell method attached then it should not have any # interpolation on the data, so spatial processing code should be 0 and # number of points used should be 0. product_definition_template_15(cube_0, mock.sentinel.grib) mock_set.assert_any_call(mock.sentinel.grib, "productDefinitionTemplateNumber", 15) mock_set.assert_any_call(mock.sentinel.grib, "spatialProcessing", 0) mock_set.assert_any_call(mock.sentinel.grib, "statisticalProcess", 0)
def test_bicubic_interpolation(self, mock_set): cube_2 = self.cube cube_2.attributes = dict(spatial_processing_type='Bicubic ' 'interpolation') # If the cube has a bicubic interpolation attribute, spatial # processing code should be 2 and number of points used should be 4. product_definition_template_15(cube_2, mock.sentinel.grib) mock_set.assert_any_call(mock.sentinel.grib, "productDefinitionTemplateNumber", 15) mock_set.assert_any_call(mock.sentinel.grib, "spatialProcessing", 2) mock_set.assert_any_call(mock.sentinel.grib, "numberOfPointsUsed", 4)
def test_neighbour_budget_interpolation(self, mock_set): cube_6 = self.cube cube_6.attributes = dict(spatial_processing_type='Neighbour-budget ' 'interpolation') # If the cube has a neighbour-budget interpolation attribute, spatial # processing code should be 6 and number of points used should be 4. product_definition_template_15(cube_6, mock.sentinel.grib) mock_set.assert_any_call(mock.sentinel.grib, "productDefinitionTemplateNumber", 15) mock_set.assert_any_call(mock.sentinel.grib, "spatialProcessing", 6) mock_set.assert_any_call(mock.sentinel.grib, "numberOfPointsUsed", 4)
def test_cell_method(self, mock_set): cube_0 = self.cube cube_0.attributes = dict(spatial_processing_type='No interpolation') cell_method = CellMethod(method='mean', coords=['area']) cube_0.add_cell_method(cell_method) # If the cube has a cell method attached then it should not have any # interpolation on the data, so spatial processing code should be 0 and # number of points used should be 0. product_definition_template_15(cube_0, mock.sentinel.grib) mock_set.assert_any_call(mock.sentinel.grib, "productDefinitionTemplateNumber", 15) mock_set.assert_any_call(mock.sentinel.grib, "spatialProcessing", 0) mock_set.assert_any_call(mock.sentinel.grib, "statisticalProcess", 0)