示例#1
0
 def test_2d_regular_grid(self):
     '''
     Ensures 2D Regular Grid detection works
     '''
     with Dataset(resources.STATIC_FILES['2d-regular-grid']) as nc:
         for variable in util.get_geophysical_variables(nc):
             assert util.is_2d_regular_grid(nc, variable), "{} is 2D regular grid".format(variable)
示例#2
0
    def check_dimensions(self, dataset):
        '''
        Checks that the feature types of this dataset are consistent with a regular gridded dataset

        :param netCDF4.Dataset dataset: An open netCDF dataset
        '''
        results = []
        required_ctx = TestCtx(
            BaseCheck.HIGH,
            'All geophysical variables are regular gridded feature types')

        message = '{} must be a valid regular gridded feature type. It must have dimensions (t, z, y, x)'
        message += ' and each dimension must be a coordinate variable with a dimension with the same name'
        message += ' as the variable. z is optional.'

        for variable in util.get_geophysical_variables(dataset):
            is_valid = util.is_2d_regular_grid(dataset, variable)
            is_valid = is_valid or util.is_3d_regular_grid(dataset, variable)
            required_ctx.assert_true(is_valid, message.format(variable))
        results.append(required_ctx.to_result())
        return results
示例#3
0
    def check_dimensions(self, dataset):
        '''
        Checks that the feature types of this dataset are consistent with a regular gridded dataset

        :param netCDF4.Dataset dataset: An open netCDF dataset
        '''
        results = []
        required_ctx = TestCtx(BaseCheck.HIGH, 'All geophysical variables are regular gridded feature types')

        message = '{} must be a valid regular gridded feature type. It must have dimensions (t, z, y, x)'
        message += ' and each dimension must be a coordinate variable with a dimension with the same name'
        message += ' as the variable. z is optional.'

        for variable in util.get_geophysical_variables(dataset):
            is_valid = util.is_2d_regular_grid(dataset, variable)
            is_valid = is_valid or util.is_3d_regular_grid(dataset, variable)
            required_ctx.assert_true(
                is_valid,
                message.format(variable)
            )
        results.append(required_ctx.to_result())
        return results