예제 #1
0
 def test_trajectory_profile_orthogonal(self):
     '''
     Ensures trajectory profile orthogonal detection works
     '''
     with Dataset(resources.STATIC_FILES['trajectory-profile-orthogonal']) as nc:
         for variable in util.get_geophysical_variables(nc):
             assert util.is_trajectory_profile_orthogonal(nc, variable), "{} is trajectory profile orthogonal".format(variable)
    def check_dimensions(self, dataset):
        '''
        Checks that the feature types of this dataset are consitent with a trajectory profile orthogonal dataset

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

        message = '{} must be a valid trajectory profile orthogonal feature type. It must have dimensions of (trajectory, obs, z).'
        message += ' Also, x, y, and t must have dimensions (trajectory, obs). z must be a coordinate variable with dimensions (z).'

        for variable in util.get_geophysical_variables(dataset):
            is_valid = util.is_trajectory_profile_orthogonal(dataset, variable)
            required_ctx.assert_true(is_valid, message.format(variable))
        results.append(required_ctx.to_result())
        return results
    def check_dimensions(self, dataset):
        '''
        Checks that the feature types of this dataset are consitent with a trajectory profile orthogonal dataset

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

        message = '{} must be a valid trajectory profile orthogonal feature type. It must have dimensions of (trajectory, obs, z).'
        message += ' Also, x, y, and t must have dimensions (trajectory, obs). z must be a coordinate variable with dimensions (z).'

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