Reading-eScience-Centre / pycovjson

Create CovJSON files from common scientific data formats
BSD 3-Clause "New" or "Revised" License
12 stars 7 forks source link

TypeError: Can't convert 'NoneType' object to str implicitly #28

Closed lewismc closed 8 years ago

lewismc commented 8 years ago

Hi Folks, when attempting to create a small covjson file for one of our datasets I get the following issue. Here is an example granule, you can download and test either netCDF3 or netCDF4 to test it out and reproduce.

lmcgibbn@LMC-056430 /usr/local/pycovjson(master) $ pycovjson-convert -i ~/Desktop/osu_cioss_weekly_msla_geovel_2012_v1.nc.gz.nc -o ~/Desktop/osu_cioss_weekly_msla_geovel_2012_v1.nc.gz.nc.covjson
Traceback (most recent call last):
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/xarray-0.8.2-py3.5.egg/xarray/core/dataset.py", line 467, in _construct_dataarray
    variable = self._variables[name]
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/pycovjson-0.3.8-py3.5.egg/pycovjson/read_netcdf.py", line 264, in get_axis
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/xarray-0.8.2-py3.5.egg/xarray/core/dataset.py", line 520, in __getitem__
    return self._construct_dataarray(key)
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/xarray-0.8.2-py3.5.egg/xarray/core/dataset.py", line 469, in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name)
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/xarray-0.8.2-py3.5.egg/xarray/core/dataset.py", line 41, in _get_virtual_variable
    raise KeyError(key)
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/lmcgibbn/miniconda3/bin/pycovjson-convert", line 9, in <module>
    load_entry_point('pycovjson==0.3.8', 'console_scripts', 'pycovjson-convert')()
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/pycovjson-0.3.8-py3.5.egg/pycovjson/cli/convert.py", line 65, in main
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/pycovjson-0.3.8-py3.5.egg/pycovjson/write.py", line 51, in write
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/pycovjson-0.3.8-py3.5.egg/pycovjson/write.py", line 64, in _construct_coverage
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/pycovjson-0.3.8-py3.5.egg/pycovjson/write.py", line 123, in _construct_range
  File "/Users/lmcgibbn/miniconda3/lib/python3.5/site-packages/pycovjson-0.3.8-py3.5.egg/pycovjson/read_netcdf.py", line 268, in get_axis
TypeError: Can't convert 'NoneType' object to str implicitly
lewismc commented 8 years ago

@RileyWilliams do you know what the following line refers to? https://github.com/Reading-eScience-Centre/pycovjson/blob/master/pycovjson/write.py#L121 Is there an open issue to address this?

lewismc commented 8 years ago

This is happening with a bunch of datasets now. http://podaac.jpl.nasa.gov/dataset/OSTM_L2_OST_OGDR_GPS

RileyWilliams commented 8 years ago

I believe this is fixed, however I need to create a new release containing these fixes

lewismc commented 8 years ago

I don't think so. I am always using master branch. Can you please try to reproduce using the granule I have mentioned above?

On Wednesday, October 19, 2016, RileyWilliams notifications@github.com wrote:

I believe this is fixed, however I need to create a new release containing these fixes

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Reading-eScience-Centre/pycovjson/issues/28#issuecomment-254771982, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHJl7oyOFh-7DSL5J8BkZnfVE07OjQnks5q1e2_gaJpZM4KaOLv .

Lewis Dr. Lewis J. McGibbney Ph.D, B.Sc Director Phone: +1(626)498-3090 Skype: lewis.john.mcgibbney Email: lewis.mcgibbney@gmail.com

RileyWilliams commented 8 years ago

This error is down to not supplying a variable name with the -v option, I have now updated cli/convert.py so that this is a required option.

lewismc commented 8 years ago

Great. Tested and working excellently with master branch.