Skip to content

Commit

Permalink
Merge pull request #923 from benjwadams/improve_conformance_rebase
Browse files Browse the repository at this point in the history
Test for CF 1.6 conformance section 3
  • Loading branch information
benjwadams authored Apr 28, 2022
2 parents 7c1b51c + 9f50329 commit f132cc3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion compliance_checker/tests/test_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def test_check_data_types(self):
"""

# TEST CONFORMANCE 2.2 REQUIRED
# TODO: Check 1D char array

# check default netCDF data types
dataset = self.load_dataset(STATIC_FILES["rutgers"])
Expand Down Expand Up @@ -366,7 +367,7 @@ def test_check_conventions_are_cf_16(self):
§2.6.1 the NUG defined global attribute Conventions to the string value
"CF-1.6"
"""
# CONFORMANCE 2.6.1 REQUIRED
# TEST CONFORMANCE 2.6.1 REQUIRED
# Note: conformance doc for 1.6 mentions CF-1.5
# :Conventions = "CF-1.6"
dataset = self.load_dataset(STATIC_FILES["rutgers"])
Expand Down Expand Up @@ -479,6 +480,7 @@ def test_check_standard_name(self):

dataset = MockTimeSeries()
temperature = dataset.createVariable("temperature", "f8", ("time",))
temperature.standard_name = "sea_water_temperature"
temperature.ancillary_variables = "temperature_flag"

temperature_flag = dataset.createVariable("temperature_flag", "i2", ("time",))
Expand All @@ -492,6 +494,13 @@ def test_check_standard_name(self):
temperature_flag.units = "1"
_, _, messages = get_results(self.cf.check_standard_name(dataset))

# TEST CONFORMANCE 3 RECOMMENDED
# long_name or standard_name present
del temperature.standard_name
_, _, messages = get_results(self.cf.check_standard_name(dataset))
assert ("Attribute long_name or/and standard_name is highly "
"recommended for variable temperature" in messages)

def test_cell_bounds(self):
dataset = self.load_dataset(STATIC_FILES["grid-boundaries"])
results = self.cf.check_cell_boundaries(dataset)
Expand Down

0 comments on commit f132cc3

Please sign in to comment.