CF1_6Check#

class compliance_checker.cf.CF1_6Check(options=None)[source]#

CF-1.6-specific implementation of CFBaseCheck; supports checking netCDF datasets. These checks are translated documents:

Methods

check_add_offset_scale_factor_type(ds)

If a variable has the attributes add_offset and scale_factor, check that the variables and attributes are of the same type OR that the variable is of type byte, short or int and the attributes are of type float or double.

check_ancillary_variables(ds)

Checks the ancillary_variable attribute for all variables to ensure they are CF compliant.

check_appendix_a(ds)

Validates a CF dataset against the contents of its Appendix A table for attribute types and locations.

check_aux_coordinates(ds)

Chapter 5 paragraph 3

check_calendar(ds)

Check the calendar attribute for variables defining time and ensure it is a valid calendar prescribed by CF.

check_cell_boundaries(ds)

Checks the dimensions of cell boundary variables to ensure they are CF compliant.

check_cell_measures(ds)

7.2 To indicate extra information about the spatial properties of a variable's grid cells, a cell_measures attribute may be defined for a variable.

check_cell_methods(ds)

7.3 To describe the characteristic of a field that is represented by cell values, we define the cell_methods attribute of the variable.

check_cf_role(ds)

Check variables defining cf_role for legal cf_role values.

check_child_attr_data_types(ds)

For any variables which contain any of the following attributes:

check_climatological_statistics(ds)

7.4 A climatological time coordinate variable does not have a bounds attribute.

check_compression_gathering(ds)

At the current time the netCDF interface does not provide for packing data.

check_convention_globals(ds)

Check the common global attributes are strings if they exist.

check_convention_possibly_var_attrs(ds)

Check variable and global attributes are strings for recommended attributes under CF §2.6.2

check_conventions_version(ds)

CF §2.6.1 the NUG defined global attribute Conventions to the string value "CF-<version_number>"; check the Conventions attribute contains the appropriate string.

check_coordinate_types(ds)

Check the axis attribute of coordinate variables

check_coordinate_variables_strict_monotonicity(ds)

Checks that data in coordinate variables is either monotonically increasing or decreasing

check_data_types(ds)

Checks the data type of all netCDF variables to ensure they are valid data types under CF.

check_dimension_names(ds)

Checks variables contain no duplicate dimension names.

check_dimension_order(ds)

Checks each variable's dimension order to ensure that the order is consistent and in order under CF §2.4

check_dimensional_vertical_coordinate(ds[, ...])

Check units for variables defining vertical position are valid under CF.

check_dimensionless_vertical_coordinates(ds)

Check the validity of dimensionless coordinates under CF

check_duplicate_axis(ds)

Checks that no variable contains two coordinates defining the same

check_feature_type(ds)

Check the global attribute featureType for valid CF featureTypes

check_filename(ds)

Checks that the filename ends with .nc

check_fill_value_equal_missing_value(ds)

If both missing_value and _FillValue be used, they should have the same value.

check_fill_value_outside_valid_range(ds)

Checks each variable's _FillValue to ensure that it's in valid_range or between valid_min and valid_max according to CF §2.5.1

check_flags(ds)

Check the flag_values, flag_masks and flag_meanings attributes for variables to ensure they are CF compliant.

check_geographic_region(ds)

6.1.1 When data is representative of geographic regions which can be identified by names but which have complex boundaries that cannot practically be specified using longitude and latitude boundary coordinates, a labeled axis should be used to identify the regions.

check_grid_coordinates(ds)

5.6 When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the coordinates attribute.

check_grid_mapping(ds)

5.6 When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the coordinates attribute.

check_hints(ds)

Checks for potentially mislabeled metadata and makes suggestions for how to correct

check_latitude(ds)

Check variable(s) that define latitude and are defined correctly according to CF.

check_longitude(ds)

Check variable(s) that define longitude and are defined correctly according to CF.

check_multi_dimensional_coords(ds)

Checks that no multidimensional coordinate shares a name with its dimensions.

check_names_unique(ds)

Checks the variable names for uniqueness regardless of case.

check_naming_conventions(ds)

Checks the variable names to ensure they are valid CF variable names under CF.

check_packed_data(ds)

8.1 Simple packing may be achieved through the use of the optional NUG defined attributes scale_factor and add_offset.

check_reduced_horizontal_grid(ds)

5.3 A "reduced" longitude-latitude grid is one in which the points are arranged along constant latitude lines with the number of points on a latitude line decreasing toward the poles.

check_standard_name(ds)

Check a variables's standard_name attribute to ensure that it meets CF compliance.

check_time_coordinate(ds)

Check variables defining time are valid under CF

check_units(ds)

Check the units attribute for all variables to ensure they are CF compliant under CF §3.1

check_valid_range_and_valid_min_max_present(ds)

The valid_range attribute must not be present if the valid_min and/or valid_max attributes are present.

check_variable_features(ds)

Checks the variable feature types match the dataset featureType attribute.

get_test_ctx(severity, name[, variable])

Creates an existing TestCtx object in _defined_results dict if it does not exist for the current checker instance, or an returns the existing TestCtx for modification.

setup(ds)

Initialize various special variable types within the class.

std_check_in(dataset, name, allowed_vals)

Returns 0 if attr not present, 1 if present but not in correct value, 2 if good

std_check

Attributes Summary

HIGH

LOW

MEDIUM

appendix_a

appendix_d_parametric_coords

register_checker

supported_ds

Methods Summary

__init__([options])

check_add_offset_scale_factor_type(ds)

If a variable has the attributes add_offset and scale_factor, check that the variables and attributes are of the same type OR that the variable is of type byte, short or int and the attributes are of type float or double.

check_ancillary_variables(ds)

Checks the ancillary_variable attribute for all variables to ensure they are CF compliant.

check_appendix_a(ds)

Validates a CF dataset against the contents of its Appendix A table for attribute types and locations.

check_aux_coordinates(ds)

Chapter 5 paragraph 3

check_calendar(ds)

Check the calendar attribute for variables defining time and ensure it is a valid calendar prescribed by CF.

check_cell_boundaries(ds)

Checks the dimensions of cell boundary variables to ensure they are CF compliant.

check_cell_measures(ds)

7.2 To indicate extra information about the spatial properties of a variable's grid cells, a cell_measures attribute may be defined for a variable.

check_cell_methods(ds)

7.3 To describe the characteristic of a field that is represented by cell values, we define the cell_methods attribute of the variable.

check_cf_role(ds)

Check variables defining cf_role for legal cf_role values.

check_child_attr_data_types(ds)

For any variables which contain any of the following attributes:

check_climatological_statistics(ds)

7.4 A climatological time coordinate variable does not have a bounds attribute.

check_compression_gathering(ds)

At the current time the netCDF interface does not provide for packing data.

check_convention_globals(ds)

Check the common global attributes are strings if they exist.

check_convention_possibly_var_attrs(ds)

Check variable and global attributes are strings for recommended attributes under CF §2.6.2

check_conventions_version(ds)

CF §2.6.1 the NUG defined global attribute Conventions to the string value "CF-<version_number>"; check the Conventions attribute contains the appropriate string.

check_coordinate_types(ds)

Check the axis attribute of coordinate variables

check_coordinate_variables_strict_monotonicity(ds)

Checks that data in coordinate variables is either monotonically increasing or decreasing

check_data_types(ds)

Checks the data type of all netCDF variables to ensure they are valid data types under CF.

check_dimension_names(ds)

Checks variables contain no duplicate dimension names.

check_dimension_order(ds)

Checks each variable's dimension order to ensure that the order is consistent and in order under CF §2.4

check_dimensional_vertical_coordinate(ds[, ...])

Check units for variables defining vertical position are valid under CF.

check_dimensionless_vertical_coordinates(ds)

Check the validity of dimensionless coordinates under CF

check_duplicate_axis(ds)

Checks that no variable contains two coordinates defining the same

check_feature_type(ds)

Check the global attribute featureType for valid CF featureTypes

check_filename(ds)

Checks that the filename ends with .nc

check_fill_value_equal_missing_value(ds)

If both missing_value and _FillValue be used, they should have the same value.

check_fill_value_outside_valid_range(ds)

Checks each variable's _FillValue to ensure that it's in valid_range or between valid_min and valid_max according to CF §2.5.1

check_flags(ds)

Check the flag_values, flag_masks and flag_meanings attributes for variables to ensure they are CF compliant.

check_geographic_region(ds)

6.1.1 When data is representative of geographic regions which can be identified by names but which have complex boundaries that cannot practically be specified using longitude and latitude boundary coordinates, a labeled axis should be used to identify the regions.

check_grid_coordinates(ds)

5.6 When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the coordinates attribute.

check_grid_mapping(ds)

5.6 When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the coordinates attribute.

check_hints(ds)

Checks for potentially mislabeled metadata and makes suggestions for how to correct

check_latitude(ds)

Check variable(s) that define latitude and are defined correctly according to CF.

check_longitude(ds)

Check variable(s) that define longitude and are defined correctly according to CF.

check_multi_dimensional_coords(ds)

Checks that no multidimensional coordinate shares a name with its dimensions.

check_names_unique(ds)

Checks the variable names for uniqueness regardless of case.

check_naming_conventions(ds)

Checks the variable names to ensure they are valid CF variable names under CF.

check_packed_data(ds)

8.1 Simple packing may be achieved through the use of the optional NUG defined attributes scale_factor and add_offset.

check_reduced_horizontal_grid(ds)

5.3 A "reduced" longitude-latitude grid is one in which the points are arranged along constant latitude lines with the number of points on a latitude line decreasing toward the poles.

check_standard_name(ds)

Check a variables's standard_name attribute to ensure that it meets CF compliance.

check_time_coordinate(ds)

Check variables defining time are valid under CF

check_units(ds)

Check the units attribute for all variables to ensure they are CF compliant under CF §3.1

check_valid_range_and_valid_min_max_present(ds)

The valid_range attribute must not be present if the valid_min and/or valid_max attributes are present.

check_variable_features(ds)

Checks the variable feature types match the dataset featureType attribute.

get_test_ctx(severity, name[, variable])

Creates an existing TestCtx object in _defined_results dict if it does not exist for the current checker instance, or an returns the existing TestCtx for modification.

setup(ds)

Initialize various special variable types within the class.

std_check(dataset, name)

std_check_in(dataset, name, allowed_vals)

Returns 0 if attr not present, 1 if present but not in correct value, 2 if good

Attributes Documentation

HIGH = 3#
LOW = 1#
MEDIUM = 2#
appendix_a = {'Conventions': {'Type': 'S', 'attr_loc': {'G'}, 'cf_section': None}, '_FillValue': {'Type': 'D', 'attr_loc': {'C', 'D'}, 'cf_section': None}, 'add_offset': {'Type': 'N', 'attr_loc': {'D'}, 'cf_section': '8.1'}, 'ancillary_variables': {'Type': 'S', 'attr_loc': {'D'}, 'cf_section': '3.4'}, 'axis': {'Type': 'S', 'attr_loc': {'C'}, 'cf_section': '4'}, 'bounds': {'Type': 'S', 'attr_loc': {'C'}, 'cf_section': '7.1'}, 'calendar': {'Type': 'S', 'attr_loc': {'C'}, 'cf_section': '4.4.1'}, 'cell_measures': {'Type': 'S', 'attr_loc': {'D'}, 'cf_section': '7.2'}, 'cell_methods': {'Type': 'S', 'attr_loc': {'D'}, 'cf_section': '7.3'}, 'cf_role': {'Type': 'S', 'attr_loc': {'C'}, 'cf_section': '9.5'}, 'climatology': {'Type': 'S', 'attr_loc': {'C'}, 'cf_section': '7.4'}, 'compress': {'Type': 'S', 'attr_loc': {'C'}, 'cf_section': '8.2'}, 'coordinates': {'Type': 'S', 'attr_loc': {'D'}, 'cf_section': '5'}, 'featureType': {'Type': 'S', 'attr_loc': {'G'}, 'cf_section': '9.4'}, 'flag_masks': {'Type': 'D', 'attr_loc': {'D'}, 'cf_section': '3.5'}, 'flag_meanings': {'Type': 'S', 'attr_loc': {'D'}, 'cf_section': '3.5'}, 'flag_values': {'Type': 'D', 'attr_loc': {'D'}, 'cf_section': '3.5'}, 'formula_terms': {'Type': 'S', 'attr_loc': {'C'}, 'cf_section': '4.3.2'}, 'grid_mapping': {'Type': 'S', 'attr_loc': {'D'}, 'cf_section': '5.6'}, 'history': {'Type': 'S', 'attr_loc': {'G'}, 'cf_section': None}, 'institution': {'Type': 'S', 'attr_loc': {'D', 'G'}, 'cf_section': '2.6.2'}, 'leap_month': {'Type': 'N', 'attr_loc': {'C'}, 'cf_section': '4.4.1'}, 'leap_year': {'Type': 'N', 'attr_loc': {'C'}, 'cf_section': '4.4.1'}, 'long_name': {'Type': 'S', 'attr_loc': {'C', 'D'}, 'cf_section': '3.2'}, 'missing_value': {'Type': 'D', 'attr_loc': {'C', 'D'}, 'cf_section': '2.5.1'}, 'month_lengths': {'Type': 'N', 'attr_loc': {'C'}, 'cf_section': '4.4.1'}, 'positive': {'Type': 'S', 'attr_loc': {'C'}, 'cf_section': None}, 'references': {'Type': 'S', 'attr_loc': {'D', 'G'}, 'cf_section': '2.6.2'}, 'scale_factor': {'Type': 'N', 'attr_loc': {'D'}, 'cf_section': '8.1'}, 'source': {'Type': 'S', 'attr_loc': {'D', 'G'}, 'cf_section': '2.6.2'}, 'standard_error_multiplier': {'Type': 'N', 'attr_loc': {'D'}, 'cf_section': None}, 'standard_name': {'Type': 'S', 'attr_loc': {'C', 'D'}, 'cf_section': '3.3'}, 'title': {'Type': 'S', 'attr_loc': {'G'}, 'cf_section': None}, 'units': {'Type': 'S', 'attr_loc': {'C', 'D'}, 'cf_section': '3.1'}, 'valid_max': {'Type': 'N', 'attr_loc': {'C', 'D'}, 'cf_section': None}, 'valid_min': {'Type': 'N', 'attr_loc': {'C', 'D'}, 'cf_section': None}, 'valid_range': {'Type': 'N', 'attr_loc': {'C', 'D'}, 'cf_section': None}}#
appendix_d_parametric_coords = {'atmosphere_hybrid_height_coordinate': ({'a', 'b', 'orog'}, {'altitude', 'height_above_geopotential_datum'}), 'atmosphere_hybrid_sigma_pressure_coordinate': (({'a', 'b', 'ps'}, {'ap', 'b', 'ps'}), {'air_pressure'}), 'atmosphere_ln_pressure_coordinate': ({'lev', 'p0'}, {'air_pressure'}), 'atmosphere_sigma_coordinate': ({'ps', 'ptop', 'sigma'}, {'air_pressure'}), 'atmosphere_sleve_coordinate': ({'a', 'b1', 'b2', 'zsurf1', 'zsurf2', 'ztop'}, {'altitude', 'height_above_geopotential_datum'}), 'ocean_double_sigma_coordinate': ({'a', 'depth', 'href', 'k_c', 'sigma', 'z1', 'z2'}, {'altitude': {'depth': 'sea_floor_depth_below_geoid', 'eta': 'sea_surface_height_above_geoid', 'zlev': 'altitude'}, 'height_above_geopotential_datum': {'depth': 'sea_floor_depth_below_geopotential_datum', 'eta': 'sea_surface_height_above_geopotential_datum', 'zlev': 'height_above_geopotential_datum'}, 'height_above_mean_sea_level': {'depth': 'sea_floor_depth_below_mean_sea_level', 'eta': 'sea_surface_height_above_mean_sea_level', 'zlev': 'height_above_mean_sea_level'}, 'height_above_reference_ellipsoid': {'depth': 'sea_floor_depth_below_reference_ellipsoid', 'eta': 'sea_surface_height_above_reference_ellipsoid', 'zlev': 'height_above_reference_ellipsoid'}}), 'ocean_s_coordinate': ({'a', 'b', 'depth', 'depth_c', 'eta', 's'}, {'altitude': {'depth': 'sea_floor_depth_below_geoid', 'eta': 'sea_surface_height_above_geoid', 'zlev': 'altitude'}, 'height_above_geopotential_datum': {'depth': 'sea_floor_depth_below_geopotential_datum', 'eta': 'sea_surface_height_above_geopotential_datum', 'zlev': 'height_above_geopotential_datum'}, 'height_above_mean_sea_level': {'depth': 'sea_floor_depth_below_mean_sea_level', 'eta': 'sea_surface_height_above_mean_sea_level', 'zlev': 'height_above_mean_sea_level'}, 'height_above_reference_ellipsoid': {'depth': 'sea_floor_depth_below_reference_ellipsoid', 'eta': 'sea_surface_height_above_reference_ellipsoid', 'zlev': 'height_above_reference_ellipsoid'}}), 'ocean_sigma_coordinate': ({'depth', 'eta', 'sigma'}, {'altitude': {'depth': 'sea_floor_depth_below_geoid', 'eta': 'sea_surface_height_above_geoid', 'zlev': 'altitude'}, 'height_above_geopotential_datum': {'depth': 'sea_floor_depth_below_geopotential_datum', 'eta': 'sea_surface_height_above_geopotential_datum', 'zlev': 'height_above_geopotential_datum'}, 'height_above_mean_sea_level': {'depth': 'sea_floor_depth_below_mean_sea_level', 'eta': 'sea_surface_height_above_mean_sea_level', 'zlev': 'height_above_mean_sea_level'}, 'height_above_reference_ellipsoid': {'depth': 'sea_floor_depth_below_reference_ellipsoid', 'eta': 'sea_surface_height_above_reference_ellipsoid', 'zlev': 'height_above_reference_ellipsoid'}}), 'ocean_sigma_z_coordinate': ({'depth', 'depth_c', 'eta', 'sigma', 'zlev'}, {'altitude': {'depth': 'sea_floor_depth_below_geoid', 'eta': 'sea_surface_height_above_geoid', 'zlev': 'altitude'}, 'height_above_geopotential_datum': {'depth': 'sea_floor_depth_below_geopotential_datum', 'eta': 'sea_surface_height_above_geopotential_datum', 'zlev': 'height_above_geopotential_datum'}, 'height_above_mean_sea_level': {'depth': 'sea_floor_depth_below_mean_sea_level', 'eta': 'sea_surface_height_above_mean_sea_level', 'zlev': 'height_above_mean_sea_level'}, 'height_above_reference_ellipsoid': {'depth': 'sea_floor_depth_below_reference_ellipsoid', 'eta': 'sea_surface_height_above_reference_ellipsoid', 'zlev': 'height_above_reference_ellipsoid'}})}#
register_checker = True#
supported_ds = [<class 'netCDF4._netCDF4.Dataset'>]#

Methods Documentation

__init__(options=None)[source]#
check_add_offset_scale_factor_type(ds)[source]#

If a variable has the attributes add_offset and scale_factor, check that the variables and attributes are of the same type OR that the variable is of type byte, short or int and the attributes are of type float or double.

check_ancillary_variables(ds)[source]#

Checks the ancillary_variable attribute for all variables to ensure they are CF compliant.

CF §3.4 It is a string attribute whose value is a blank separated list of variable names. The nature of the relationship between variables associated via ancillary_variables must be determined by other attributes. The variables listed by the ancillary_variables attribute will often have the standard name of the variable which points to them including a modifier (Appendix C, Standard Name Modifiers) to indicate the relationship.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_appendix_a(ds)#

Validates a CF dataset against the contents of its Appendix A table for attribute types and locations. Returns a list of results with the outcomes of the Appendix A validation results against the existing attributes in the docstring.

Parameters:
  • var (netCDF4.Variable) – a variable in an existing NetCDF dataset

  • ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

A list of results corresponding to the results returned

check_aux_coordinates(ds)[source]#

Chapter 5 paragraph 3

The dimensions of an auxiliary coordinate variable must be a subset of the dimensions of the variable with which the coordinate is associated, with two exceptions. First, string-valued coordinates (Section 6.1, “Labels”) have a dimension for maximum string length. Second, in the ragged array representations of data (Chapter 9, Discrete Sampling Geometries), special methods are needed to connect the data and coordinates.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_calendar(ds)[source]#

Check the calendar attribute for variables defining time and ensure it is a valid calendar prescribed by CF.

CF §4.4.1 In order to calculate a new date and time given a base date, base time and a time increment one must know what calendar to use.

The values currently defined for calendar are: - gregorian or standard - proleptic_gregorian - noleap or 365_day - all_leap or 366_day - 360_day - julian - none

The calendar attribute may be set to none in climate experiments that simulate a fixed time of year. The time of year is indicated by the date in the reference time of the units attribute.

If none of the calendars defined above applies, a non-standard calendar can be defined. The lengths of each month are explicitly defined with the month_lengths attribute of the time axis.

If leap years are included, then two other attributes of the time axis should also be defined:

leap_year, leap_month

The calendar attribute is not required when a non-standard calendar is being used. It is sufficient to define the calendar using the month_lengths attribute, along with leap_year, and leap_month as appropriate. However, the calendar attribute is allowed to take non-standard values and in that case defining the non-standard calendar using the appropriate attributes is required.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_cell_boundaries(ds)[source]#

Checks the dimensions of cell boundary variables to ensure they are CF compliant.

7.1 To represent cells we add the attribute bounds to the appropriate coordinate variable(s). The value of bounds is the name of the variable that contains the vertices of the cell boundaries. We refer to this type of variable as a “boundary variable.” A boundary variable will have one more dimension than its associated coordinate or auxiliary coordinate variable. The additional dimension should be the most rapidly varying one, and its size is the maximum number of cell vertices.

Applications that process cell boundary data often times need to determine whether or not adjacent cells share an edge. In order to facilitate this type of processing the following restrictions are placed on the data in boundary variables:

Bounds for 1-D coordinate variables

For a coordinate variable such as lat(lat) with associated boundary variable latbnd(x,2), the interval endpoints must be ordered consistently with the associated coordinate, e.g., for an increasing coordinate, lat(1) > lat(0) implies latbnd(i,1) >= latbnd(i,0) for all i

If adjacent intervals are contiguous, the shared endpoint must be represented identically in each instance where it occurs in the boundary variable. For example, if the intervals that contain grid points lat(i) and lat(i+1) are contiguous, then latbnd(i+1,0) = latbnd(i,1).

Bounds for 2-D coordinate variables with 4-sided cells

In the case where the horizontal grid is described by two-dimensional auxiliary coordinate variables in latitude lat(n,m) and longitude lon(n,m), and the associated cells are four-sided, then the boundary variables are given in the form latbnd(n,m,4) and lonbnd(n,m,4), where the trailing index runs over the four vertices of the cells.

Bounds for multi-dimensional coordinate variables with p-sided cells

In all other cases, the bounds should be dimensioned (…,n,p), where (…,n) are the dimensions of the auxiliary coordinate variables, and p the number of vertices of the cells. The vertices must be traversed anticlockwise in the lon-lat plane as viewed from above. The starting vertex is not specified.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_cell_measures(ds)[source]#

7.2 To indicate extra information about the spatial properties of a variable’s grid cells, a cell_measures attribute may be defined for a variable. This is a string attribute comprising a list of blank-separated pairs of words of the form “measure: name”. “area” and “volume” are the only defined measures.

The “name” is the name of the variable containing the measure values, which we refer to as a “measure variable”. The dimensions of the measure variable should be the same as or a subset of the dimensions of the variable to which they are related, but their order is not restricted.

The variable must have a units attribute and may have other attributes such as a standard_name.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_cell_methods(ds)[source]#

7.3 To describe the characteristic of a field that is represented by cell values, we define the cell_methods attribute of the variable. This is a string attribute comprising a list of blank-separated words of the form “name: method”. Each “name: method” pair indicates that for an axis identified by name, the cell values representing the field have been determined or derived by the specified method.

name can be a dimension of the variable, a scalar coordinate variable, a valid standard name, or the word “area”

values of method should be selected from the list in Appendix E, Cell Methods, which includes point, sum, mean, maximum, minimum, mid_range, standard_deviation, variance, mode, and median. Case is not significant in the method name. Some methods (e.g., variance) imply a change of units of the variable, as is indicated in Appendix E, Cell Methods.

Because the default interpretation for an intensive quantity differs from that of an extensive quantity and because this distinction may not be understood by some users of the data, it is recommended that every data variable include for each of its dimensions and each of its scalar coordinate variables the cell_methods information of interest (unless this information would not be meaningful). It is especially recommended that cell_methods be explicitly specified for each spatio-temporal dimension and each spatio-temporal scalar coordinate variable.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_cf_role(ds)[source]#

Check variables defining cf_role for legal cf_role values.

§9.5 The only acceptable values of cf_role for Discrete Geometry CF data sets are timeseries_id, profile_id, and trajectory_id

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

check_child_attr_data_types(ds)[source]#
For any variables which contain any of the following attributes:
  • valid_min/valid_max

  • valid_range

  • scale_factor

  • add_offset

  • _FillValue

the data type of the attribute must match the type of its parent variable as specified in the NetCDF User Guide (NUG) https://docs.unidata.ucar.edu/netcdf-c/current/attribute_conventions.html, referenced in the CF Conventions in Section 2.5.2 (http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html#missing-data)

Parameters:

ds (netCDF4.Dataset) – open netCDF dataset object

Return type:

compliance_checker.base.Result

check_climatological_statistics(ds)[source]#

7.4 A climatological time coordinate variable does not have a bounds attribute. Instead, it has a climatology attribute, which names a variable with dimensions (n,2), n being the dimension of the climatological time axis. Using the units and calendar of the time coordinate variable, element (i,0) of the climatology variable specifies the beginning of the first subinterval and element (i,1) the end of the last subinterval used to evaluate the climatological statistics with index i in the time dimension. The time coordinates should be values that are representative of the climatological time intervals, such that an application which does not recognise climatological time will nonetheless be able to make a reasonable interpretation.

A climatological axis may use different statistical methods to measure variation among years, within years, and within days. The methods which can be specified are those listed in Appendix E, Cell Methods and each entry in the cell_methods attribute may also contain non-standardised information in parentheses after the method. The value of the cell_method attribute must be in one of the following forms: - time: method1 within years time: method2 over years - time: method1 within days time: method2 over days - time: method1 within days time: method2 over days time: method3 over years

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_compression_gathering(ds)[source]#

At the current time the netCDF interface does not provide for packing data. However a simple packing may be achieved through the use of the optional NUG defined attributes scale_factor and add_offset . After the data values of a variable have been read, they are to be multiplied by the scale_factor , and have add_offset added to them. If both attributes are present, the data are scaled before the offset is added. When scaled data are written, the application should first subtract the offset and then divide by the scale factor. The units of a variable should be representative of the unpacked data.

This standard is more restrictive than the NUG with respect to the use of the scale_factor and add_offset attributes; ambiguities and precision problems related to data type conversions are resolved by these restrictions. If the scale_factor and add_offset attributes are of the same data type as the associated variable, the unpacked data is assumed to be of the same data type as the packed data. However, if the scale_factor and add_offset attributes are of a different data type from the variable (containing the packed data) then the unpacked data should match the type of these attributes, which must both be of type float or both be of type double . An additional restriction in this case is that the variable containing the packed data must be of type byte , short or int . It is not advised to unpack an int into a float as there is a potential precision loss.

When data to be packed contains missing values the attributes that indicate missing values ( _FillValue , valid_min , valid_max ,

valid_range ) must be of the same data type as

the packed data. See Section 2.5.1, “Missing Data” for a discussion of how applications should treat variables that have attributes indicating both missing values and transformations defined by a scale and/or offset.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_convention_globals(ds)[source]#

Check the common global attributes are strings if they exist.

CF §2.6.2 title/history global attributes, must be strings. Do not need to exist.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of Results

check_convention_possibly_var_attrs(ds)[source]#

Check variable and global attributes are strings for recommended attributes under CF §2.6.2

CF §2.6.2 institution, source, references, and comment, either global or assigned to individual variables. When an attribute appears both globally and as a variable attribute, the variable’s version has precedence. Must be strings.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of Results

check_conventions_version(ds)#

CF §2.6.1 the NUG defined global attribute Conventions to the string value “CF-<version_number>”; check the Conventions attribute contains the appropriate string.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

check_coordinate_types(ds)[source]#

Check the axis attribute of coordinate variables

CF §4 The attribute axis may be attached to a coordinate variable and given one of the values X, Y, Z or T which stand for a longitude, latitude, vertical, or time axis respectively. Alternatively the standard_name attribute may be used for direct identification.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_coordinate_variables_strict_monotonicity(ds)[source]#

Checks that data in coordinate variables is either monotonically increasing or decreasing

check_data_types(ds)[source]#

Checks the data type of all netCDF variables to ensure they are valid data types under CF.

CF §2.2 The netCDF data types char, byte, short, int, float or real, and double are all acceptable

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

check_dimension_names(ds)[source]#

Checks variables contain no duplicate dimension names.

CF §2.4 A variable may have any number of dimensions, including zero, and the dimensions must all have different names.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

check_dimension_order(ds)[source]#

Checks each variable’s dimension order to ensure that the order is consistent and in order under CF §2.4

CF §2.4 If any or all of the dimensions of a variable have the interpretations of “date or time” (T), “height or depth” (Z), “latitude” (Y), or “longitude” (X) then we recommend, those dimensions to appear in the relative order T, then Z, then Y, then X in the CDL definition corresponding to the file. All other dimensions should, whenever possible, be placed to the left of the spatiotemporal dimensions.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

check_dimensional_vertical_coordinate(ds, dimless_vertical_coordinates={'atmosphere_hybrid_height_coordinate': ({'a', 'b', 'orog'}, {'altitude', 'height_above_geopotential_datum'}), 'atmosphere_hybrid_sigma_pressure_coordinate': (({'a', 'b', 'ps'}, {'ap', 'b', 'ps'}), {'air_pressure'}), 'atmosphere_ln_pressure_coordinate': ({'lev', 'p0'}, {'air_pressure'}), 'atmosphere_sigma_coordinate': ({'ps', 'ptop', 'sigma'}, {'air_pressure'}), 'atmosphere_sleve_coordinate': ({'a', 'b1', 'b2', 'zsurf1', 'zsurf2', 'ztop'}, {'altitude', 'height_above_geopotential_datum'}), 'ocean_double_sigma_coordinate': ({'a', 'depth', 'href', 'k_c', 'sigma', 'z1', 'z2'}, {'altitude': {'depth': 'sea_floor_depth_below_geoid', 'eta': 'sea_surface_height_above_geoid', 'zlev': 'altitude'}, 'height_above_geopotential_datum': {'depth': 'sea_floor_depth_below_geopotential_datum', 'eta': 'sea_surface_height_above_geopotential_datum', 'zlev': 'height_above_geopotential_datum'}, 'height_above_mean_sea_level': {'depth': 'sea_floor_depth_below_mean_sea_level', 'eta': 'sea_surface_height_above_mean_sea_level', 'zlev': 'height_above_mean_sea_level'}, 'height_above_reference_ellipsoid': {'depth': 'sea_floor_depth_below_reference_ellipsoid', 'eta': 'sea_surface_height_above_reference_ellipsoid', 'zlev': 'height_above_reference_ellipsoid'}}), 'ocean_s_coordinate': ({'a', 'b', 'depth', 'depth_c', 'eta', 's'}, {'altitude': {'depth': 'sea_floor_depth_below_geoid', 'eta': 'sea_surface_height_above_geoid', 'zlev': 'altitude'}, 'height_above_geopotential_datum': {'depth': 'sea_floor_depth_below_geopotential_datum', 'eta': 'sea_surface_height_above_geopotential_datum', 'zlev': 'height_above_geopotential_datum'}, 'height_above_mean_sea_level': {'depth': 'sea_floor_depth_below_mean_sea_level', 'eta': 'sea_surface_height_above_mean_sea_level', 'zlev': 'height_above_mean_sea_level'}, 'height_above_reference_ellipsoid': {'depth': 'sea_floor_depth_below_reference_ellipsoid', 'eta': 'sea_surface_height_above_reference_ellipsoid', 'zlev': 'height_above_reference_ellipsoid'}}), 'ocean_sigma_coordinate': ({'depth', 'eta', 'sigma'}, {'altitude': {'depth': 'sea_floor_depth_below_geoid', 'eta': 'sea_surface_height_above_geoid', 'zlev': 'altitude'}, 'height_above_geopotential_datum': {'depth': 'sea_floor_depth_below_geopotential_datum', 'eta': 'sea_surface_height_above_geopotential_datum', 'zlev': 'height_above_geopotential_datum'}, 'height_above_mean_sea_level': {'depth': 'sea_floor_depth_below_mean_sea_level', 'eta': 'sea_surface_height_above_mean_sea_level', 'zlev': 'height_above_mean_sea_level'}, 'height_above_reference_ellipsoid': {'depth': 'sea_floor_depth_below_reference_ellipsoid', 'eta': 'sea_surface_height_above_reference_ellipsoid', 'zlev': 'height_above_reference_ellipsoid'}}), 'ocean_sigma_z_coordinate': ({'depth', 'depth_c', 'eta', 'sigma', 'zlev'}, {'altitude': {'depth': 'sea_floor_depth_below_geoid', 'eta': 'sea_surface_height_above_geoid', 'zlev': 'altitude'}, 'height_above_geopotential_datum': {'depth': 'sea_floor_depth_below_geopotential_datum', 'eta': 'sea_surface_height_above_geopotential_datum', 'zlev': 'height_above_geopotential_datum'}, 'height_above_mean_sea_level': {'depth': 'sea_floor_depth_below_mean_sea_level', 'eta': 'sea_surface_height_above_mean_sea_level', 'zlev': 'height_above_mean_sea_level'}, 'height_above_reference_ellipsoid': {'depth': 'sea_floor_depth_below_reference_ellipsoid', 'eta': 'sea_surface_height_above_reference_ellipsoid', 'zlev': 'height_above_reference_ellipsoid'}})})[source]#

Check units for variables defining vertical position are valid under CF.

CF §4.3.1 The units attribute for dimensional coordinates will be a string formatted as per the udunits.dat file.

The acceptable units for vertical (depth or height) coordinate variables are: - units of pressure as listed in the file udunits.dat. For vertical axes

the most commonly used of these include include bar, millibar, decibar, atmosphere (atm), pascal (Pa), and hPa.

  • units of length as listed in the file udunits.dat. For vertical axes the most commonly used of these include meter (metre, m), and kilometer (km).

  • other units listed in the file udunits.dat that may under certain circumstances reference vertical position such as units of density or temperature.

Plural forms are also acceptable.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_dimensionless_vertical_coordinates(ds)[source]#

Check the validity of dimensionless coordinates under CF

CF §4.3.2 The units attribute is not required for dimensionless coordinates.

The standard_name attribute associates a coordinate with its definition from Appendix D, Dimensionless Vertical Coordinates. The definition provides a mapping between the dimensionless coordinate values and dimensional values that can positively and uniquely indicate the location of the data.

A new attribute, formula_terms, is used to associate terms in the definitions with variables in a netCDF file. To maintain backwards compatibility with COARDS the use of these attributes is not required, but is strongly recommended.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_duplicate_axis(ds)[source]#

Checks that no variable contains two coordinates defining the same

Chapter 5 paragraph 6

If an axis attribute is attached to an auxiliary coordinate variable, it can be used by applications in the same way the axis attribute attached to a coordinate variable is used. However, it is not permissible for a [geophysical variable] to have both a coordinate variable and an auxiliary coordinate variable, or more than one of either type of variable, having an axis attribute with any given value e.g. there must be no more than one axis attribute for X for any [geophysical variable].

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

Returns:

List of results

check_feature_type(ds)[source]#

Check the global attribute featureType for valid CF featureTypes

9.4 A global attribute, featureType, is required for all Discrete Geometry representations except the orthogonal multidimensional array representation, for which it is highly recommended.

The value assigned to the featureType attribute is case-insensitive.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

check_filename(ds)[source]#

Checks that the filename ends with .nc

check_fill_value_equal_missing_value(ds)[source]#

If both missing_value and _FillValue be used, they should have the same value. This according to CF §2.5.1 Recommendations:

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of Results

check_fill_value_outside_valid_range(ds)[source]#

Checks each variable’s _FillValue to ensure that it’s in valid_range or between valid_min and valid_max according to CF §2.5.1

CF §2.5.1 The _FillValue should be outside the range specified by valid_range (if used) for a variable.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of Results

check_flags(ds)[source]#

Check the flag_values, flag_masks and flag_meanings attributes for variables to ensure they are CF compliant.

CF §3.5 The attributes flag_values, flag_masks and flag_meanings are intended to make variables that contain flag values self describing. Status codes and Boolean (binary) condition flags may be expressed with different combinations of flag_values and flag_masks attribute definitions.

The flag_values and flag_meanings attributes describe a status flag consisting of mutually exclusive coded values.

The flag_meanings attribute is a string whose value is a blank separated list of descriptive words or phrases, one for each flag value. Each word or phrase should consist of characters from the alphanumeric set and the following five: ‘_’, ‘-’, ‘.’, ‘+’, ‘@’.

The flag_masks and flag_meanings attributes describe a number of independent Boolean conditions using bit field notation by setting unique bits in each flag_masks value.

The flag_masks, flag_values and flag_meanings attributes, used together, describe a blend of independent Boolean conditions and enumerated status codes. A flagged condition is identified by a bitwise AND of the variable value and each flag_masks value; a result that matches the flag_values value indicates a true condition.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_geographic_region(ds)[source]#

6.1.1 When data is representative of geographic regions which can be identified by names but which have complex boundaries that cannot practically be specified using longitude and latitude boundary coordinates, a labeled axis should be used to identify the regions.

Recommend that the names be chosen from the list of standardized region names whenever possible. To indicate that the label values are standardized the variable that contains the labels must be given the standard_name attribute with the value region.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_grid_coordinates(ds)[source]#

5.6 When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the coordinates attribute.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_grid_mapping(ds)#

5.6 When the coordinate variables for a horizontal grid are not longitude and latitude, it is required that the true latitude and longitude coordinates be supplied via the coordinates attribute. If in addition it is desired to describe the mapping between the given coordinate variables and the true latitude and longitude coordinates, the attribute grid_mapping may be used to supply this description.

This attribute is attached to data variables so that variables with different mappings may be present in a single file. The attribute takes a string value which is the name of another variable in the file that provides the description of the mapping via a collection of attached attributes. This variable is called a grid mapping variable and is of arbitrary type since it contains no data. Its purpose is to act as a container for the attributes that define the mapping.

The one attribute that all grid mapping variables must have is grid_mapping_name which takes a string value that contains the mapping’s name. The other attributes that define a specific mapping depend on the value of grid_mapping_name. The valid values of grid_mapping_name along with the attributes that provide specific map parameter values are described in Appendix F, Grid Mappings.

When the coordinate variables for a horizontal grid are longitude and latitude, a grid mapping variable with grid_mapping_name of latitude_longitude may be used to specify the ellipsoid and prime meridian.

In order to make use of a grid mapping to directly calculate latitude and longitude values it is necessary to associate the coordinate variables with the independent variables of the mapping. This is done by assigning a standard_name to the coordinate variable. The appropriate values of the standard_name depend on the grid mapping and are given in Appendix F, Grid Mappings.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_hints(ds)[source]#

Checks for potentially mislabeled metadata and makes suggestions for how to correct

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_latitude(ds)[source]#

Check variable(s) that define latitude and are defined correctly according to CF.

CF §4.1 Variables representing latitude must always explicitly include the units attribute; there is no default value. The recommended unit of latitude is degrees_north. Also acceptable are degree_north, degree_N, degrees_N, degreeN, and degreesN.

Optionally, the latitude type may be indicated additionally by providing the standard_name attribute with the value latitude, and/or the axis attribute with the value Y.

  • Four checks per latitude variable

    1. latitude has units attribute

    1. latitude has an allowed units attribute

    1. latitude uses degrees_north (if not in rotated pole)

    1. latitude defines either standard_name or axis

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_longitude(ds)[source]#

Check variable(s) that define longitude and are defined correctly according to CF.

CF §4.2 Variables representing longitude must always explicitly include the units attribute; there is no default value. The recommended unit of longitude is degrees_east. Also acceptable are degree_east, degree_E, degrees_E, degreeE, and degreesE.

Optionally, the longitude type may be indicated additionally by providing the standard_name attribute with the value longitude, and/or the axis attribute with the value X.

  • Four checks per longitude variable

    1. longitude has units attribute

    1. longitude has an allowed units attribute

    1. longitude uses degrees_east (if not in rotated pole)

    1. longitude defines either standard_name or axis

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_multi_dimensional_coords(ds)[source]#

Checks that no multidimensional coordinate shares a name with its dimensions.

Chapter 5 paragraph 4

We recommend that the name of a [multidimensional coordinate] should not match the name of any of its dimensions.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_names_unique(ds)[source]#

Checks the variable names for uniqueness regardless of case.

CF §2.3 names should not be distinguished purely by case, i.e., if case is disregarded, no two names should be the same.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

check_naming_conventions(ds)[source]#

Checks the variable names to ensure they are valid CF variable names under CF.

CF §2.3 Variable, dimension and attribute names should begin with a letter and be composed of letters, digits, and underscores.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

compliance_checker.base.Result

check_packed_data(ds)[source]#

8.1 Simple packing may be achieved through the use of the optional NUG defined attributes scale_factor and add_offset. After the data values of a variable have been read, they are to be multiplied by the scale_factor, and have add_offset added to them.

The units of a variable should be representative of the unpacked data.

If the scale_factor and add_offset attributes are of the same data type as the associated variable, the unpacked data is assumed to be of the same data type as the packed data. However, if the scale_factor and add_offset attributes are of a different data type from the variable (containing the packed data) then the unpacked data should match the type of these attributes, which must both be of type float or both be of type double. An additional restriction in this case is that the variable containing the packed data must be of type byte, short or int. It is not advised to unpack an int into a float as there is a potential precision loss.

When data to be packed contains missing values the attributes that indicate missing values (_FillValue, valid_min, valid_max, valid_range) must be of the same data type as the packed data.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_reduced_horizontal_grid(ds)[source]#

5.3 A “reduced” longitude-latitude grid is one in which the points are arranged along constant latitude lines with the number of points on a latitude line decreasing toward the poles.

Recommend that this type of gridded data be stored using the compression scheme described in Section 8.2, “Compression by Gathering”. The compressed latitude and longitude auxiliary coordinate variables are identified by the coordinates attribute.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_standard_name(ds)[source]#

Check a variables’s standard_name attribute to ensure that it meets CF compliance.

CF §3.3 A standard name is associated with a variable via the attribute standard_name which takes a string value comprised of a standard name optionally followed by one or more blanks and a standard name modifier

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_time_coordinate(ds)[source]#

Check variables defining time are valid under CF

CF §4.4 Variables representing time must always explicitly include the units attribute; there is no default value.

The units attribute takes a string value formatted as per the recommendations in the Udunits package.

The acceptable units for time are listed in the udunits.dat file. The most commonly used of these strings (and their abbreviations) includes day (d), hour (hr, h), minute (min) and second (sec, s). Plural forms are also acceptable. The reference time string (appearing after the identifier since) may include date alone; date and time; or date, time, and time zone. The reference time is required. A reference time in year 0 has a special meaning (see Section 7.4, “Climatological Statistics”).

Recommend that the unit year be used with caution. It is not a calendar year. For similar reasons the unit month should also be used with caution.

A time coordinate is identifiable from its units string alone. Optionally, the time coordinate may be indicated additionally by providing the standard_name attribute with an appropriate value, and/or the axis attribute with the value T.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_units(ds)[source]#

Check the units attribute for all variables to ensure they are CF compliant under CF §3.1

CF §3.1 The units attribute is required for all variables that represent dimensional quantities (except for boundary variables defined in Section 7.1, “Cell Boundaries” and climatology variables defined in Section 7.4, “Climatological Statistics”).

Units are not required for dimensionless quantities. A variable with no units attribute is assumed to be dimensionless. However, a units attribute specifying a dimensionless unit may optionally be included.

  • units required

  • type must be recognized by udunits

  • if standard name specified, must be consistent with standard name table, must also be consistent with a specified cell_methods attribute if present

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_valid_range_and_valid_min_max_present(ds)[source]#

The valid_range attribute must not be present if the valid_min and/or valid_max attributes are present. This according to 2.5.1 Requirements.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of Results

check_variable_features(ds)[source]#

Checks the variable feature types match the dataset featureType attribute. If more than one unique feature type is found, report this as an error.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

get_test_ctx(severity, name, variable=None)#

Creates an existing TestCtx object in _defined_results dict if it does not exist for the current checker instance, or an returns the existing TestCtx for modification. Takes a severity level and name and uses the two element tuple formed by the arguments as a key into the dict.

Parameters:
  • severity (int) – A BaseCheck severity level

  • name (str) – The name of the check

Rtype compliance_checker.base.TestCtx:

Returns:

A new or or existing TestCtx instance taken from this instance’s _defined_results dict

setup(ds)#

Initialize various special variable types within the class. Mutates a number of instance variables.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

classmethod std_check(dataset, name)#
classmethod std_check_in(dataset, name, allowed_vals)#

Returns 0 if attr not present, 1 if present but not in correct value, 2 if good