From 77f35c5f35e2226115453c7e51930fb60d240ed5 Mon Sep 17 00:00:00 2001 From: RosalynHatcher Date: Wed, 21 Mar 2018 14:46:37 +0000 Subject: [PATCH] Preparation for release. Add missing check that positive attribute is consistent with sign implied by standard_name from #30 --- CHANGES.md | 12 ++++++++++++ README.md | 11 +++++++---- src/cfchecker/__init__.py | 2 +- src/cfchecker/cfchecks.py | 8 ++++++++ test_files/CF_1_0_OK.check | 2 +- test_files/CF_1_7.check | 8 +++++--- test_files/CF_1_7.nc.gz | Bin 1545 -> 1544 bytes test_files/CRM018_test1.check | 2 +- test_files/CRM021_test1.check | 2 +- test_files/CRM024_test1.check | 2 +- test_files/CRM026_test2.check | 2 +- test_files/CRM027_test1.check | 2 +- test_files/CRM027_test2.check | 2 +- test_files/CRM028_test1.check | 2 +- test_files/CRM032_test1.check | 2 +- test_files/CRM033_test1.check | 2 +- test_files/CRM035.check | 2 +- test_files/CRM037.check | 2 +- test_files/CRM038.check | 2 +- test_files/CRM041.check | 2 +- test_files/GregRappa.check | 2 +- test_files/Trac020_test1.check | 2 +- test_files/Trac020_test2.check | 2 +- test_files/Trac022.check | 2 +- test_files/Trac049_test1.check | 2 +- test_files/Trac049_test2.check | 2 +- test_files/UpgradeVn.pl | 2 +- test_files/badc_units.check | 2 +- test_files/cell_measures.check | 2 +- test_files/cell_methods.check | 2 +- test_files/complex.check | 2 +- test_files/example_5.10.check | 2 +- test_files/example_6.2.check | 2 +- test_files/flag_tests.check | 2 +- test_files/formula_terms.check | 2 +- test_files/hfogo_O1_labelVariable_KT.check | 2 +- test_files/issue27.check | 2 +- test_files/stdName_test.check | 2 +- 38 files changed, 65 insertions(+), 40 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5fc64e6..481acf7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,18 @@ See https://github.com/cedadev/cf-checker/milestones?state=closed for full details of each release. ----------------------------------------------------------------- +## March 2018 + +CF Checker release 3.1.0 + +This is a development release to include addition checks for CF-1.7 comformance. + +### Other Noteworthy Changes + +[#35](https://github.com/cedadev/cf-checker/issues/35): Improve execution speed + +[#29](https://github.com/cedadev/cf-checker/issues/29): Include checks against region names table + ## 03.05.2017 CF Checker release 3.0.1 diff --git a/README.md b/README.md index 4c5c4b0..b9aa56c 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,17 @@ Alternatively, to install from source: ## Running the CF Checker -`cfchecks [-a area_types.xml] [-s standard_names.xml] [-t cache_time_days ] [-v CFVersion] [-x] [--cachedir ] file1 [file2...]` +`cfchecks [-a ] [-r ] [-s ] [-v ] [-x] [-t ] file1 [file2...]` + +For further details and for other available command line options please see the help by running `cfchecks -h` ### Environment Variables The following parameters can be set on the command-line or through environment variables: -1. `CF_STANDARD_NAMES` (or CL option `-s`) : The path or URL to the CF standard names table -2. `CF_AREA_TYPES` or (CL option `-a`) : The path or URL to the CF area types tables +1. `CF_STANDARD_NAMES` or (CL option `-s`) : The path or URL to the CF standard names table +2. `CF_AREA_TYPES` or (CL option `-a`) : The path or URL to the CF area types table +3. `CF_REGION_NAMES` or (CL option `-r`): The path or URL to the CF region names table ### Wrapper script @@ -64,7 +67,7 @@ The wrapper is maintained by CEDA and not by NCAS CMS. ### Running the Test script -In the release tarball there is a `test_files` directory containing a `test.sh` script which runs a series of test files through the CF Checker and confirms the checker is working as expected. It is a very elementary system, which will be rewritten soon. Before running it you will need to edit the location of the cfchecker script in the `tests.sh` file: +In the release tarball there is a `test_files` directory containing a `test.sh` script which runs a series of test files through the CF Checker and confirms the checker is working as expected. It is a very elementary system, which will be rewritten soon. Before running it you will need to edit the location of the cfchecks script in the `tests.sh` file: cfchecker="" diff --git a/src/cfchecker/__init__.py b/src/cfchecker/__init__.py index 5120f1b..3c51b2f 100644 --- a/src/cfchecker/__init__.py +++ b/src/cfchecker/__init__.py @@ -1 +1 @@ -__version__ = '3.0.6-dev' +__version__ = '3.1.0-rc1' diff --git a/src/cfchecker/cfchecks.py b/src/cfchecker/cfchecks.py index d97ccfe..fff1888 100644 --- a/src/cfchecker/cfchecks.py +++ b/src/cfchecker/cfchecks.py @@ -2664,6 +2664,14 @@ def chkDescription(self, varName): else: self._add_error("No region names specified", varName, code="3.3") + if hasattr(var, 'positive'): + # Check that positive attribute is consistent with sign implied by standard_name + if (re.match("height", name, re.I) and not re.match("up", var.positive, re.I)) or \ + (re.match("depth", name, re.I) and not re.match("down", var.positive, re.I)): + self._add_warn("Positive attribute inconsistent with sign conventions implied by the standard_name", + varName, code="4.3") + + #--------------------------------- def getStringValue(self, varName): #--------------------------------- diff --git a/test_files/CF_1_0_OK.check b/test_files/CF_1_0_OK.check index be4b768..89a4a23 100644 --- a/test_files/CF_1_0_OK.check +++ b/test_files/CF_1_0_OK.check @@ -1,6 +1,6 @@ CHECKING NetCDF FILE: CF_1_0_OK.nc ===================== -Using CF Checker Version 3.0.6-dev +Using CF Checker Version 3.1.0-rc1 Checking against CF Version CF-1.0 Using Standard Name Table Version 50 (2018-03-14T11:01:19Z) Using Standardized Region Name Table Version 2 (12 June 2013) diff --git a/test_files/CF_1_7.check b/test_files/CF_1_7.check index e5b85b4..3707a91 100644 --- a/test_files/CF_1_7.check +++ b/test_files/CF_1_7.check @@ -1,6 +1,6 @@ CHECKING NetCDF FILE: CF_1_7.nc ===================== -Using CF Checker Version 3.0.6-dev +Using CF Checker Version 3.1.0-rc1 Checking against CF Version CF-1.7 Using Standard Name Table Version 50 (2018-03-14T11:01:19Z) Using Area Type Table Version 7 (14 March 2018) @@ -20,6 +20,8 @@ ERROR: (5): co-ordinate variable not monotonic ------------------ Checking variable: depth ------------------ +WARN: (4.3): Positive attribute inconsistent with sign conventions implied by the standard_name +ERROR: (3.1): Units are not consistent with those given in the standard_name table. ERROR: (5): co-ordinate variable not monotonic ------------------ @@ -128,6 +130,6 @@ Checking variable: crs ERROR: (5.6): Attribute longitude_of_prime_meridian of incorrect data type (Appendix F) ERROR: (5.6): reference_ellipsoid_name, prime_meridian_name, horizontal_datum_name and geographic_crs_name must all be definied if any one is defined -ERRORS detected: 24 -WARNINGS given: 3 +ERRORS detected: 25 +WARNINGS given: 4 INFORMATION messages: 2 diff --git a/test_files/CF_1_7.nc.gz b/test_files/CF_1_7.nc.gz index 3285767b320fd1c4effd6fd3970776b2edd75d6b..024193b7598fbf665edc27a186a79fe546f5457b 100644 GIT binary patch literal 1544 zcmV+j2KV_NiwFp&ZL(Sb14Bk%F<&<>ZesxDSiN)HL=@MZedn(;c0TN6#*o=6lL?dH z4H*=8tGQc^KgObUjMo|2M3BV`JTl$5;vkWQ!5 zUF>8W7|?mGUA^7+@q16Z?`iw?otkH_S!grRCKZb)-0RR90Zr7trBCP<66HDCM95>^ zpEP~i>-XDX)^AAGjfh>Z$4xU{FN~E4sbS;20j;Ii=%$zosa>aKEpFerws!pnQdBC` zVTLrvVhPhy#jGBB-qQV;^{9|c9Uj& z=eBv=qp@Zwvw2M`+pIfF4;2+L32~1IM%p2jIlq-6Z4DJi#^5<<7YZ2G+`5*#&j6lX z9FwSE_cY7}69fIIk;Y8PK5agrT|ueDF&CMSGYR@dNfZ*}#S z`Fnd6E~~3gAnd^)w{~jd{r7M{jxxOf$8(EX2Stp839m0F^JSw#huX)Z@w~8`iVgwI zwwOSBG)kx-Diw4bz6*p2tOn=K;yWx1ACNG$6SW?-N53Basrf`qg85wt`iwk4*Zobf z4e7awpgv2OBH0^UZD+m0&gNHL6kS^%8yn{b_+t|BG*$&29_h71Z|U)Ms7LFgvA&%~ z(NVq!plrAB3i6-mSR$gg=GnbaU$v6lsVW~wqkVk!ffIye0>*caz!!-4Dg_G#iMtdL zr37oI$}VaZX`YR}`sSi#xVhnFS4--E#SlJ<3pcN}nUlR)5(JocI+B{L&C)-7p3~>}p& z7rXxY5S<(r=_kkZiNo~WF_>2F*Qbu@d57uMV`Fkmo0oKd(NBedd9dX)L*bG%W6r2CxM9d1uPl zx%20B;CH!|%@UMRcwRC&_<<&HAFLYICO`L=ey`x0={W85tc{V?EUmlg zdCR(=)nGLjL)o5F6*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