# Download the installer
https://raw.githubusercontent.com/ncasuk/amf-check-writer/main/install-checker-suite.sh
# Run it (with or without conda, depending if you have it installed)
bash ./install-checker-suite.sh --no-conda
# This installs everything into your conda environment, and creates a setup file, e.g.:
source checks-work-dir/setup-checks-env.sh
# ...now you can run the amf-checker, e.g.
TEST_FILE_NAME=ncas-anemometer-1_ral_29001225_mean-winds_v0.1.nc
TEST_FILE_URL="https://github.com/cedadev/compliance-check-lib/blob/main/tests/example_data/nc_file_checks_data/${TEST_FILE_NAME}?raw=true"
wget -O $TEST_FILE_NAME $TEST_FILE_URL
amf-checker --version $CHECKS_VERSION $TEST_FILE_NAME
This should display some output like this:
$ amf-checker --version $CHECKS_VERSION $TEST_FILE_NAME
[INFO] Running compliance-checker with arguments:
compliance-checker --yaml /miniconda/envs/amf-checks-env/lib/python3.9/site-packages/amf-checks/AMF_product_mean-winds_land.yml --test product_mean-winds_land_checks:v2.0 --format text ncas-anemometer-1_ral_29001225_mean-winds_v0.1.nc
Running Compliance Checker on the datasets from: ['ncas-anemometer-1_ral_29001225_mean-winds_v0.1.nc']
2022-10-07 14:17:46.051092 [INFO] :: PYESSV :: Loading vocabularies from /miniconda/envs/amf-checks-env/lib/python3.9/site-packages/amf-pyessv-vocabs ... please wait
--------------------------------------------------------------------------------
IOOS Compliance Checker Report
Version 5.0.2
Report generated 2022-10-07T14:17:46Z
product_mean-winds_land_checks:v2.0
--------------------------------------------------------------------------------
Corrective Actions
ncas-anemometer-1_ral_29001225_mean-winds_v0.1.nc has 35 potential issues
High Priority
--------------------------------------------------------------------------------
Global attribute: Conventions
* Required 'Conventions' global attribute value does not match regex 'CF\-1\.6,\ NCAS\-AMF\-2\.0\.0'.
Global attribute: platform
* Required 'platform' global attribute value is invalid. Check the 'platform:data:platform_id ' vocabularies for the correct value. Value found: 'ral'
Global attribute: platform_altitude
* Required 'platform_altitude' global attribute value does not match regex '-?\d+(\.\d+)? m'.
Which translates to use the IOOS compliance-checker as follows:
compliance-checker --yaml <conda_install>/site-packages/amf-checks/AMF_product_mean-winds_land.yml --test product_mean-winds_land_checks:v2.0 --format text ncas-anemometer-1_ral_29001225_mean-winds_v0.1.nc
Let's understand the details:
--test product_mean-winds_land_checks:v2.0
- means that it should run a test suite with that identifier
--yaml <conda_install>/site-packages/amf-checks/AMF_product_mean-winds_land.yml
- tells the checker to parse the test suite in finds in this YAML file,
which happens to be: "product_mean-winds_land_checks:v2.0"
--format text - writes output to the terminal
ncas-anemometer-1_ral_29001225_mean-winds_v0.1.nc - is the file to check
- __INCLUDE__: AMF_product_common_dimension_land.yml
- __INCLUDE__: AMF_product_common_global-attributes_land.yml <-- NOTE: this is a duplicate
...NOTE...: some products will have product-specific global attributes that will be seen here.
- __INCLUDE__: AMF_product_common_variable_land.yml
...NOTE...: some products will have product-specific dimensions that will be seen here.
- __INCLUDE__: AMF_product_mean-winds_variable.yml
These are compiled from BB's data product descriptions under:
This needs to be read by the amf-checker tool in order to work out which suite of checks must be run.
In the example case, it was "land" and so the check suites that were referenced were land-based,
and were derived from the "...-land" tabs in the "_common" spreadsheet, see:
Checksit - update plans for October 2022
This should display some output like this:
Let's look at what is happening here
The full command-line is:
Which translates to use the IOOS compliance-checker as follows:
Let's understand the details:
So let's look at the YAML file first:
Which clearly includes a number of specific checks. How did they get there?
Let's group them, group 1 is a generic set of checks:
These are generic, and are written directly by the
amf-check-writer
package, see:https://github.com/ncasuk/amf-check-writer/blob/main/amf_check_writer/spreadsheet_handler.py#L134-L149
amf-checks/AMF_product_common_global-attributes_land.yml
amf-checks/AMF_global_attrs.yml
Now come the more specific checks:
These are compiled from BB's data product descriptions under:
https://drive.google.com/drive/u/1/folders/1Ha-Wt1IXXoBekLdnrQpjwIpPm07E0A4e
These have been then converted into two types of file that our checks currently reference:
1. YAML checks
The YAML check files are:
Let's see some example content:
This tells us that the checks need to use classes in the
compliance-check-lib
repo, e.g.:https://github.com/cedadev/compliance-check-lib/blob/main/checklib/register/nc_file_checks_register.py#L435
2. Controlled vocabs
And it also says we need to use vocabularies referenced as:
This is pointing to a data structure copied from BB's spreadsheets into:
So, the checks and controlled vocabs (CVs) are constructed from the spreadsheets.
Note that there are some specific rules we will need to incorporate into checksit, e.g.:
3. Checks need to know deployment mode
Inside the netCDF files, there should be something like:
This needs to be read by the
amf-checker
tool in order to work out which suite of checks must be run.In the example case, it was "land" and so the check suites that were referenced were land-based, and were derived from the "...-land" tabs in the "_common" spreadsheet, see:
https://docs.google.com/spreadsheets/d/1xiLTn0-MbhkdQ7wwq3vNOA9UBPxK6STi2mj81BGtYN8/edit#gid=37445012
Recap on connections between google sheets and check code
A reminder on how it all fits together:
AMF_file_info.yml: hard-coded for all
AMF_file_structure.yml: hard-coded for all
AMF_global_attrs.yml: hard-coded for all
AMF_product_common_dimension_land.yml: from "_common" for "land" deployment mode
AMF_product_common_variable_land.yml: from "_common" for "land" deployment mode
AMF_product_mean-winds_variable.yml: from "mean-winds" product sheet
How can we start using checksit?
Here is a plan for migrating across to
checksit
:specs-fmt-checks-etc
)