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

Fix #110 #112

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions src/cfchecker/cfchecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3114,8 +3114,8 @@ def chkDescription(self, varName):
elif len(region_names):
for region in region_names:

if not region.decode('utf-8') in list(self.region_name_lh.list):
self._add_error("Invalid region name: {}".format(region.decode('utf-8')),
if not region.tolist().decode('utf-8') in list(self.region_name_lh.list):
self._add_error("Invalid region name: {}".format(region.tolist().decode('utf-8')),
varName,
code="3.3")
else:
Expand Down Expand Up @@ -3145,8 +3145,8 @@ def chkDescription(self, varName):

elif len(area_types):
for area in area_types:
if not area.decode('utf-8') in list(self.area_type_lh.list):
self._add_error("Invalid area_type: {}".format(area.decode('utf-8')),
if not area.tolist().decode('utf-8') in list(self.area_type_lh.list):
self._add_error("Invalid area_type: {}".format(area.tolist().decode('utf-8')),
varName, code="3.3")

else:
Expand Down
3 changes: 3 additions & 0 deletions test_files/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.nc
tests_output*
cfcache-files-py3/
32 changes: 32 additions & 0 deletions test_files/issue110.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
CHECKING NetCDF FILE: issue110.nc
=====================
Using CF Checker Version 4.1.0
Checking against CF Version CF-1.7
Using Standard Name Table Version 79 (2022-03-19T15:25:54Z)
Using Area Type Table Version 10 (23 June 2020)
Using Standardized Region Name Table Version 4 (18 December 2018)


------------------
Checking variable: siconca
------------------

------------------
Checking variable: time
------------------

------------------
Checking variable: lat
------------------

------------------
Checking variable: lon
------------------

------------------
Checking variable: type
------------------

ERRORS detected: 0
WARNINGS given: 0
INFORMATION messages: 0
Binary file added test_files/issue110.nc.gz
Binary file not shown.
14 changes: 9 additions & 5 deletions test_files/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@
outdir=tests_output.$$
mkdir $outdir

std_name_table=http://cfconventions.org/Data/cf-standard-names/current/src/cf-standard-name-table.xml
area_table=http://cfconventions.org/Data/area-type-table/current/src/area-type-table.xml
# Pin the tables, as the tests fail if they differ.
# This can be unpinned in future MRs updating the tests.
std_name_table=https://cfconventions.org/Data/cf-standard-names/79/src/cf-standard-name-table.xml
area_table=https://cfconventions.org/Data/area-type-table/10/src/area-type-table.xml

cfchecker="cfchecks"

cfchecker=$(which cfchecks)

failed=0

echo "Unzipping input netcdf files..."
gzip -d *.gz

cache_opts="-x --cache_dir /home/ros/temp/cfcache-files-py3"
mkdir -p cfcache-files-py3
cache_opts="-x --cache_dir ./cfcache-files-py3"

for file in `ls *.nc`
do
Expand All @@ -37,7 +41,7 @@ do
$cfchecker $cache_opts -s $std_name_table -v 1.0 $file > $outdir/$file.out 2>&1
else
# Run checker using the CF version specified in the conventions attribute of the file
$cfchecker $cache_opts -s $std_name_table -v auto $file > $outdir/$file.out 2>&1
$cfchecker $cache_opts -s $std_name_table -a $area_table -v auto $file > $outdir/$file.out 2>&1
fi

# Check the output against what is expected
Expand Down