Esempio n. 1
0
 def test_point(self):
     '''
     Ensures point detection works
     '''
     with Dataset(resources.STATIC_FILES['point']) as nc:
         for variable in util.get_geophysical_variables(nc):
             assert util.is_point(nc, variable), "{} is point".format(variable)
Esempio n. 2
0
    def check_dimensions(self, dataset):
        """
        Checks that the feature types of this dataset are consitent with a point dataset
        """
        required_ctx = TestCtx(BaseCheck.HIGH, "All geophysical variables are point feature types")
        t = util.get_time_variable(dataset)

        # Exit prematurely
        if not t:
            required_ctx.assert_true(False, "A dimension representing time is required for point feature types")
            return required_ctx.to_result()
        t_dims = dataset.variables[t].dimensions
        o = None or (t_dims and t_dims[0])

        message = "{} must be a valid timeseries feature type. It must have dimensions of ({}), and all coordinates must have dimensions of ({})"
        for variable in util.get_geophysical_variables(dataset):
            is_valid = util.is_point(dataset, variable)
            required_ctx.assert_true(is_valid, message.format(variable, o, o))
        return required_ctx.to_result()
Esempio n. 3
0
    def check_dimensions(self, dataset):
        '''
        Checks that the feature types of this dataset are consitent with a point dataset
        '''
        required_ctx = TestCtx(
            BaseCheck.HIGH,
            'All geophysical variables are point feature types')
        t = util.get_time_variable(dataset)

        # Exit prematurely
        if not t:
            required_ctx.assert_true(
                False,
                'A dimension representing time is required for point feature types'
            )
            return required_ctx.to_result()
        t_dims = dataset.variables[t].dimensions
        o = None or (t_dims and t_dims[0])

        message = '{} must be a valid timeseries feature type. It must have dimensions of ({}), and all coordinates must have dimensions of ({})'
        for variable in util.get_geophysical_variables(dataset):
            is_valid = util.is_point(dataset, variable)
            required_ctx.assert_true(is_valid, message.format(variable, o, o))
        return required_ctx.to_result()