IOOS1_2Check#

class compliance_checker.ioos.IOOS1_2Check[source]#

Class to implement the IOOS Metadata 1.2 Specification

Methods

check_accuracy(ds)

Special check for accuracy when in the salinity context.

check_cf_role_variables(ds)

The IOOS-1.2 specification details the following requirements regarding the cf_role attribute and its relation to variable dimensionality:

check_contributor_role_and_vocabulary(ds)

Check the dataset has global attributes contributor_role and contributor_role_vocabulary.

check_creator_and_publisher_type(ds)

Check if global attribute creator_type and publisher_type are contained within the values "person", "group", "institution", or "position".

check_feature_type(ds)

Wrapper for checking featureType global attribute using the CF module.

check_geophysical_vars_have_attrs(ds)

All geophysical variables must have certain attributes.

check_gts_ingest_global(ds)

Check if a dataset has the global attribute "gts_ingest" and that it matches "true" or "false".

check_gts_ingest_requirements(ds)

Check which variables qualify for ingest.

check_high(ds)

Performs a check on each highly recommended attributes' existence in the dataset

check_instrument_make_model_calib_date(ds)

Instrument variables should have attributes make_model and calibration_date.

check_instrument_variables(ds)

If present, the instrument_variable is one that contains additional metadata about the instrument the data was collected with.

check_ioos_ingest(ds)

If a dataset contains the global attribute ioos_ingest, its value must be "false".

check_platform_global(ds)

The "platform" attribute must be a single string containing no blank characters.

check_platform_vocabulary(ds)

The platform_vocabulary attribute is recommended to be a URL to https://mmisw.org/ont/ioos/platform or https://vocab.nerc.ac.uk/collection/L06/current/.

check_qartod_variables_flags(ds)

https://ioos.github.io/ioos-metadata/ioos-metadata-profile-v1-2.html#quality-controlqartod

check_qartod_variables_references(ds)

For any variables that are deemed QARTOD variables, check that they contain the "references" attribute and that the value of the attribute is a valid URL.

check_recommended(ds)

Performs a check on each recommended attributes' existence in the dataset

check_single_platform(ds)

Verify that a dataset only has a single platform attribute, and thus a single platform variable.

check_standard_name(ds)

Wrapper for checking standard names using the CF module.

check_station_location_lat(ds)

Checks station lat attributes are set

check_station_location_lon(ds)

Checks station lon attributes are set

check_time_period(ds)

Check that time period attributes are both set.

check_units(ds)

Wrapper to check units with the CF module.

check_vertical_coordinates(ds)

Check that vertical units (corresponding to axis "Z") are a unit equivalent to one of "meter", "inch", "foot", "yard", "US_survey_foot", "mile", or "fathom".

check_wmo_platform_code(ds)

Per the spec:

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)

Common setup method for a Checker.

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

register_checker

supported_ds

Methods Summary

__init__()

check_accuracy(ds)

Special check for accuracy when in the salinity context.

check_cf_role_variables(ds)

The IOOS-1.2 specification details the following requirements regarding the cf_role attribute and its relation to variable dimensionality:

check_contributor_role_and_vocabulary(ds)

Check the dataset has global attributes contributor_role and contributor_role_vocabulary.

check_creator_and_publisher_type(ds)

Check if global attribute creator_type and publisher_type are contained within the values "person", "group", "institution", or "position".

check_feature_type(ds)

Wrapper for checking featureType global attribute using the CF module.

check_geophysical_vars_have_attrs(ds)

All geophysical variables must have certain attributes.

check_gts_ingest_global(ds)

Check if a dataset has the global attribute "gts_ingest" and that it matches "true" or "false".

check_gts_ingest_requirements(ds)

Check which variables qualify for ingest.

check_high(ds)

Performs a check on each highly recommended attributes' existence in the dataset

check_instrument_make_model_calib_date(ds)

Instrument variables should have attributes make_model and calibration_date.

check_instrument_variables(ds)

If present, the instrument_variable is one that contains additional metadata about the instrument the data was collected with.

check_ioos_ingest(ds)

If a dataset contains the global attribute ioos_ingest, its value must be "false".

check_platform_global(ds)

The "platform" attribute must be a single string containing no blank characters.

check_platform_vocabulary(ds)

The platform_vocabulary attribute is recommended to be a URL to https://mmisw.org/ont/ioos/platform or https://vocab.nerc.ac.uk/collection/L06/current/.

check_qartod_variables_flags(ds)

https://ioos.github.io/ioos-metadata/ioos-metadata-profile-v1-2.html#quality-controlqartod

check_qartod_variables_references(ds)

For any variables that are deemed QARTOD variables, check that they contain the "references" attribute and that the value of the attribute is a valid URL.

check_recommended(ds)

Performs a check on each recommended attributes' existence in the dataset

check_single_platform(ds)

Verify that a dataset only has a single platform attribute, and thus a single platform variable.

check_standard_name(ds)

Wrapper for checking standard names using the CF module.

check_station_location_lat(ds)

Checks station lat attributes are set

check_station_location_lon(ds)

Checks station lon attributes are set

check_time_period(ds)

Check that time period attributes are both set.

check_units(ds)

Wrapper to check units with the CF module.

check_vertical_coordinates(ds)

Check that vertical units (corresponding to axis "Z") are a unit equivalent to one of "meter", "inch", "foot", "yard", "US_survey_foot", "mile", or "fathom".

check_wmo_platform_code(ds)

Per the spec:

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)

Common setup method for a Checker.

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#
register_checker = True#
supported_ds = [<class 'netCDF4._netCDF4.Dataset'>]#

Methods Documentation

__init__()[source]#
check_accuracy(ds)[source]#

Special check for accuracy when in the salinity context. ioos/compliance-checker#839

Parameters:
ds: netCDF4.Dataset
Returns:
list of Results objects
check_cf_role_variables(ds)[source]#

The IOOS-1.2 specification details the following requirements regarding the cf_role attribute and its relation to variable dimensionality:

cf_role may be applied to the “Platform Variable”, as indicated by geophysical_variable:platform, but it may also be an independent variable. To comply with the single platform per dataset rule of the IOOS Metadata Profile, the cf_role variable will typically have a dimension of 1, unless it is a TimeSeries dataset following the ‘TimeSeries - multiple station’ format.

To summarize the rules checked in this method:
  • ‘timeseries’, cf_role var must have dim 1

  • ‘timeseriesprofile’ must have cf_role=timeseries_id variable have dim 1 and dim of cf_role=profile_id can be > 1

  • ‘trajectory’ or ‘trajectoryprofile’ variable with cf_role=trajectory_id must have dim 1, cf_role=profile_id variable can be > 1

Relevant documentation found in the specification as well as GitHub issues: ioos/compliance-checker#748 ioos/compliance-checker#828

check_contributor_role_and_vocabulary(ds)[source]#

Check the dataset has global attributes contributor_role and contributor_role_vocabulary. It is recommended to come from one of NERC or NOAA-NCEI.

Parameters:
ds: netCDF4.Dataset (open)
Returns:
list of Result objects
check_creator_and_publisher_type(ds)[source]#

Check if global attribute creator_type and publisher_type are contained within the values “person”, “group”, “institution”, or “position”. If creator_type is not present within the global attributes, assume it is set to a value of “person”.

Parameters:
ds: netCDF4.Dataset

An open netCDF4 Dataset

Returns:
list of Result
check_feature_type(ds)[source]#

Wrapper for checking featureType global attribute using the CF module.

check_geophysical_vars_have_attrs(ds)[source]#

All geophysical variables must have certain attributes.

Parameters:
ds: netCDF4.Dataset
Returns:
list: list of Result objects
check_gts_ingest_global(ds)[source]#

Check if a dataset has the global attribute “gts_ingest” and that it matches “true” or “false”. This attribute is “required, if applicable”.

Parameters:
ds (netCDF4.Dataset): open dataset
Returns:
Result
check_gts_ingest_requirements(ds)[source]#

Check which variables qualify for ingest.

According to https://ioos.github.io/ioos-metadata/ioos-metadata-profile-v1-2.html#requirements-for-ioos-dataset-ndbcgts-ingest, the gts_ingest is “required, if applicable”. Any variables which a user would like ingested must also contain the gts_ingest attribute with a value of true. The variable must:

  • have a valid CF standard_name attribute (already checked)

  • have an ancillary variable reqpresenting QARTOD aggregate flags

  • have a valid udunits units attribute (already checked)

This check will always fail so as to notify the user which variables qualified/did not qualify for ingest. ioos/compliance-checker#759

Parameters:
ds (netCDF4.Dataset): open Dataset
Returns:
Result
check_high(ds)[source]#

Performs a check on each highly recommended attributes’ existence in the dataset

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

check_instrument_make_model_calib_date(ds)[source]#

Instrument variables should have attributes make_model and calibration_date. Both should be strings, with calibration_date following ISO-8601 date format.

ioos/compliance-checker#839

check_instrument_variables(ds)[source]#

If present, the instrument_variable is one that contains additional metadata about the instrument the data was collected with.

Parameters:

ds (netCDF4.Dataset) – open Dataset

Returns:

list of Results

check_ioos_ingest(ds)[source]#

If a dataset contains the global attribute ioos_ingest, its value must be “false”. All datasets are assumed to be ingested except those with this flag. If the dataset should be ingested, no flag (or “true”) should be present.

Parameters:
ds: netCDF4.Dataset (open)
Returns:
Result
check_platform_global(ds)[source]#

The “platform” attribute must be a single string containing no blank characters.

Parameters:
ds: netCDF4.Dataset (open)
Returns:
Result
check_platform_vocabulary(ds)[source]#

The platform_vocabulary attribute is recommended to be a URL to https://mmisw.org/ont/ioos/platform or https://vocab.nerc.ac.uk/collection/L06/current/. However, it is required to at least be a URL.

Parameters:

ds (netCDF4.Dataset) – open Dataset

Returns:

Result

check_qartod_variables_flags(ds)[source]#

https://ioos.github.io/ioos-metadata/ioos-metadata-profile-v1-2.html#quality-controlqartod

Check that all QARTOD variables have flag_meanings and flag_values attributes. Use delegation to methods in the CF module.

Parameters:
ds (netCDF4.Dataset): open dataset
Returns:
list of Result objects
check_qartod_variables_references(ds)[source]#

For any variables that are deemed QARTOD variables, check that they contain the “references” attribute and that the value of the attribute is a valid URL.

Parameters:

ds (netCDF4.Dataset) – open Dataset

Returns:

list of Results

Performs a check on each recommended attributes’ existence in the dataset

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

check_single_platform(ds)[source]#

Verify that a dataset only has a single platform attribute, and thus a single platform variable. Gridded model datasets are not required to declare a platform or platform variables.

Parameters:

ds (netCDF-4 Dataset) – open Dataset object

Returns:

Result

check_standard_name(ds)[source]#

Wrapper for checking standard names using the CF module. Extends the StandardNameTable to include QARTOD variable standard names.

check_station_location_lat(ds)#

Checks station lat attributes are set

check_station_location_lon(ds)#

Checks station lon attributes are set

check_time_period(ds)#

Check that time period attributes are both set.

check_units(ds)[source]#

Wrapper to check units with the CF module.

check_vertical_coordinates(ds)[source]#

Check that vertical units (corresponding to axis “Z”) are a unit equivalent to one of “meter”, “inch”, “foot”, “yard”, “US_survey_foot”, “mile”, or “fathom”. Check that the vertical coordinate variable “positive” attribute is either “up” or “down”. Note that unlike the CF version of this check, pressure units are not accepted and length units are constrained to the aforementioned set instead of accepting any valid UDUNITS length unit.

Parameters:

ds (netCDF4.Dataset) – An open netCDF dataset

Return type:

list

Returns:

List of results

check_wmo_platform_code(ds)[source]#

Per the spec:

“The WMO identifier for the platform used to measure the data. This identifier can be any of the following types:

  • WMO ID for buoys (numeric, 5 digits)

  • WMO ID for gliders (numeric, 7 digits)

  • NWS ID (alphanumeric, 5 digits)”

This attribute is “required, if applicable” – a warning message will only show up if the attribute is present and does not conform.

Parameters:

ds (netCDF4.Dataset) – open Dataset

Returns:

Result

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)[source]#

Common setup method for a Checker.

Automatically run when running a CheckSuite. Define this method in your Checker class.

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