Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for forecast reference metadata in CF checks. #779

Merged
merged 2 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compliance_checker/cfutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ def get_forecast_metadata_variables(ds):
:param netCDF4.Dataset ds: An open netCDF4 Dataset.
:rtype: list
'''
forecast_metadata_standard_names = [
forecast_metadata_standard_names = {
'forecast_period',
'forecast_reference_time',
]
}
forecast_metadata_variables = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually meant forecast_metadata_variables for the list -> set conversion, apologies if this wasn't explicit. This likely to be fairly minor, so I'll just keep as is and merge, possibly revisiting this for #727 and other similar places in code which use lists.

for varname in ds.variables:
standard_name = getattr(ds.variables[varname], 'standard_name', None)
Expand Down
8 changes: 4 additions & 4 deletions compliance_checker/tests/test_feature_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ def test_forecast_reference_metadata(self):
not misclassified as geophysical variables.
'''
with Dataset(resources.STATIC_FILES['forecast_reference']) as nc:
assert util.is_geophysical(nc, 'forecast_reference_time') is False
assert util.is_geophysical(nc, 'forecast_hour') is False
assert util.is_geophysical(nc, 'air_temp') is True
assert util.is_geophysical(nc, 'time') is False
self.assertFalse(util.is_geophysical(nc, 'forecast_reference_time'))
self.assertFalse(util.is_geophysical(nc, 'forecast_hour'))
self.assertTrue(util.is_geophysical(nc, 'air_temp'))
self.assertFalse(util.is_geophysical(nc, 'time'))

assert len(util.get_coordinate_variables(nc)) == 3
assert len(util.get_geophysical_variables(nc)) == 1
Expand Down