Closed gapintheclouds closed 3 years ago
We need to write a new check type for global attributes, but I'm not entirely sure what the check needs to contain.
Thanks @gapintheclouds 👍
Some progress: I need to create a new global attribute check using GlobalAttrVocabCheck from https://github.com/cedadev/compliance-check-lib/blob/186817ea2cda3cc4cd711da9e43b5e5fa2b8e26a/checklib/register/nc_file_checks_register.py#L57.
I've tried making a yaml check:
- check_id: hugo_test
check_name: checklib.register.nc_file_checks_register.GlobalAttrVocabCheck
parameters:
vocab_lookup: ncas-instrument
attribute: source
vocabulary_ref: ncas:amf
but get the following error message:
product_aerosol-backscatter_land_checks:2.0.check_hugo_test: 'NoneType' object is not iterable
Probably something simple. @agstephens, any ideas?
@gapintheclouds: I wonder if the error is because it can't find a value in the current version of the controlled vocabularies that you are using. It depends which directory your code is looking in for the vocabs, but on my system I'd be searching in:
.../compliance-check-lib/cc-vocab-cache/pyessv-archive-eg-cvs/ncas/amf/ncas-instrument/
@gapintheclouds: when you have completed your latest changes and made a pull request, you can report on it here and we can close this issue.
Done
A new compliance checking rule for global attributes called "Exact match in vocabulary" needs to check whether the corresponding issue exists in the corresponding volcabulary.
Eg. In the 'global_attributes' sheet in the file '_common.xlsx', the check called 'source' needs an "Exact match in vocabulary" from the list contained in the 'Descriptor' column of the 'ncas_instrument_name_and_descriptors' (or in this case possibly also 'community-instrument-name-and-descriptors') sheet in the file '_vocabularies.xlsx'.
The file I've been testing with is the training file 'ncas-anemometer-1_ral_29001225_mean-winds_v0.1.nc'. For this file the source global attribute needs to equal "NCAS Mechanicle Anemometer unit 1" as given in cell L37.