Skip to content

Instantly share code, notes, and snippets.

@kwilcox
Created December 2, 2016 21:48
Show Gist options
  • Save kwilcox/1a42e95c178af529b9f468fac2050ee5 to your computer and use it in GitHub Desktop.
Save kwilcox/1a42e95c178af529b9f468fac2050ee5 to your computer and use it in GitHub Desktop.
CC conda issue
/data/Development/compliance-checker   stringerror ✔ 
$ conda list
# packages in environment at /home/kwilcox/miniconda3/envs/cc35:
#
Using Anaconda API: https://api.anaconda.org
arrow 0.8.0 py35_0 conda-forge
ca-certificates 2016.9.26 0 conda-forge
certifi 2016.9.26 py35_0 conda-forge
cf_units 1.1.3 py35_0 conda-forge
curl 7.49.1 1 conda-forge
expat 2.1.0 2 conda-forge
hdf4 4.2.12 0 conda-forge
hdf5 1.8.17 7 conda-forge
icu 56.1 4 conda-forge
isodate 0.5.4 py35_0 conda-forge
jinja2 2.8 py35_1 conda-forge
jpeg 9b 0 conda-forge
libiconv 1.14 3 conda-forge
libnetcdf 4.4.1.1 0 conda-forge
libxml2 2.9.3 9 conda-forge
libxslt 1.1.29 1 conda-forge
lxml 3.6.4 py35_1 conda-forge
markupsafe 0.23 py35_0 conda-forge
ncurses 5.9 10 conda-forge
netcdf4 1.2.5 np111py35_0 conda-forge
openssl 1.0.2h 3 conda-forge
owslib 0.13.0 py35_0 conda-forge
pip 9.0.1 py35_0 conda-forge
py 1.4.31 py35_0 conda-forge
pygeoif 0.6 py35_1 conda-forge
pyproj 1.9.5.1 py35_0 conda-forge
pytest 3.0.4 py35_0 conda-forge
python 3.5.2 2 conda-forge
python-dateutil 2.6.0 py35_0 conda-forge
pytz 2016.7 py35_0 conda-forge
readline 6.2 0 conda-forge
requests 2.12.1 py35_0 conda-forge
setuptools 29.0.1 py35_1 conda-forge
six 1.10.0 py35_1 conda-forge
sqlite 3.13.0 1 conda-forge
tk 8.5.19 0 conda-forge
udunits2 2.2.20 1 conda-forge
wheel 0.29.0 py35_0 conda-forge
xz 5.2.2 0 conda-forge
zlib 1.2.8 3 conda-forge
httpretty 0.8.14 py35_0 defaults
libgfortran 3.0.0 1 defaults
mkl 11.3.3 0 defaults
numpy 1.11.2 py35_0 defaults
===================================================================== FAILURES =====================================================================
____________________________________________________________ TestCF.test_check_calendar ____________________________________________________________
self = test_check_calendar ( compliance_checker.tests.test_cf:TestCF.test_check_calendar )
def test_check_calendar(self):
dataset = self.load_dataset(STATIC_FILES['example-grid'])
results = self.cf.check_calendar(dataset)
for r in results:
self.assertTrue(r.value)
dataset = self.load_dataset(STATIC_FILES['bad'])
results = self.cf.check_calendar(dataset)
scored, out_of, messages = self.get_results(results)
> assert "Variable time should have a valid calendar: 'nope' is not a valid calendar" in messages
E AssertionError: assert "Variable time should have a valid calendar: 'nope' is not a valid calendar" in ["Variable bad_time_2 should have a v
alid calendar: 'nope' is not a valid calendar"]
compliance_checker/tests/test_cf.py:748: AssertionError
________________________________________________________ TestCF.test_check_time_coordinate _________________________________________________________
self = test_check_time_coordinate ( compliance_checker.tests.test_cf:TestCF.test_check_time_coordinate )
def test_check_time_coordinate(self):
dataset = self.load_dataset(STATIC_FILES['example-grid'])
results = self.cf.check_time_coordinate(dataset)
for r in results:
self.assertTrue(r.value)
dataset = self.load_dataset(STATIC_FILES['bad'])
results = self.cf.check_time_coordinate(dataset)
scored, out_of, messages = self.get_results(results)
> assert 'time does not have correct time units' in messages
E AssertionError: assert 'time does not have correct time units' in ['bad_time_1 does not have units', 'bad_time_2 does not have correct time
units']
compliance_checker/tests/test_cf.py:735: AssertionError
__________________________________________________________ TestCF.test_naming_conventions __________________________________________________________
self = test_naming_conventions ( compliance_checker.tests.test_cf:TestCF.test_naming_conventions )
def test_naming_conventions(self):
'''
Section 2.3 Naming Conventions
Variable, dimension and attribute names should begin with a letter and be composed of letters, digits, and underscores.
'''
dataset = self.load_dataset(STATIC_FILES['rutgers'])
results = self.cf.check_naming_conventions(dataset)
num_var = len(dataset.variables)
result_dict = {result.name: result for result in results}
result = result_dict[u'§2.3 Naming Conventions for variables']
assert result.value == (num_var, num_var)
dataset = self.load_dataset(STATIC_FILES['bad'])
results = self.cf.check_naming_conventions(dataset)
result_dict = {result.name: result for result in results}
result = result_dict[u'§2.3 Naming Conventions for variables']
> assert result.value == (13, 14)
E AssertionError: assert (14, 15) == (13, 14)
E At index 0 diff: 14 != 13
E Full diff:
E - (14, 15)
E + (13, 14)
compliance_checker/tests/test_cf.py:120: AssertionError
___________________________________________________ TestFeatureDetection.test_trajectory_single ____________________________________________________
self = <compliance_checker.tests.test_feature_detection.TestFeatureDetection testMethod=test_trajectory_single>
def test_trajectory_single(self):
'''
Ensures trajectory-single detection works
'''
with Dataset(resources.STATIC_FILES['trajectory-single']) as nc:
for variable in util.get_geophysical_variables(nc):
> assert util.is_single_trajectory(nc, variable), "{} is trajectory-single".format(variable)
E AssertionError: temperature is trajectory-single
E assert False
E + where False = <function is_single_trajectory at 0x7f8810e696a8>(<class 'netCDF4._netCDF4.Dataset'>\nroot group (NETCDF3_CLASSIC
data model, file format NETCDF3):\n dimensions(sizes)... lat(time), float32 lon(time), float32 z(time), float32 temperature(time)\n groups: \n
, 'temperature')
E + where <function is_single_trajectory at 0x7f8810e696a8> = util.is_single_trajectory
compliance_checker/tests/test_feature_detection.py:64: AssertionError
====================================================== 4 failed, 113 passed in 50.54 seconds =======================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment