Example #1
0
 def test_timeseries_profile_ortho_depth(self):
     '''
     Ensures timeseries profile ortho depth detection works
     '''
     with Dataset(resources.STATIC_FILES['timeseries-profile-ortho-depth']) as nc:
         for variable in util.get_geophysical_variables(nc):
             assert util.is_timeseries_profile_ortho_depth(nc, variable), "{} is timeseries-profile-ortho-depth".format(variable)
    def check_dimensions(self, dataset):
        '''
        Checks that the feature types of this dataset are consistent with a timeseries-profile-orthogonal dataset.

        :param netCDF4.Dataset dataset: An open netCDF dataset
        '''
        results = []
        required_ctx = TestCtx(BaseCheck.HIGH, 'All geophysical variables are timeseries-profile-ortho-depth-incomplete-time feature types')

        message = '{} must be a valid timeseries-profile-ortho-depth-incomplete-time feature type.'
        message += ' it must have dimensions (station, time, z). x and y must have dimensions (station).'
        message += ' time must have dimensions (station, time). And z must be a coordinate variable with'
        message += ' dimension (z).'

        for variable in util.get_geophysical_variables(dataset):
            is_valid = util.is_timeseries_profile_ortho_depth(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 consistent with a timeseries-profile-orthogonal dataset.

        :param netCDF4.Dataset dataset: An open netCDF dataset
        '''
        results = []
        required_ctx = TestCtx(
            BaseCheck.HIGH,
            'All geophysical variables are timeseries-profile-ortho-depth-incomplete-time feature types'
        )

        message = '{} must be a valid timeseries-profile-ortho-depth-incomplete-time feature type.'
        message += ' it must have dimensions (station, time, z). x and y must have dimensions (station).'
        message += ' time must have dimensions (station, time). And z must be a coordinate variable with'
        message += ' dimension (z).'

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