TUW-GEO / gldas

Readers and converters for data from the GLDAS Noah Land Surface Model. Written in Python.
https://gldas.readthedocs.io
BSD 3-Clause "New" or "Revised" License
11 stars 8 forks source link

Missing import in interface.GLDASTs? #19

Closed awst-baum closed 5 years ago

awst-baum commented 6 years ago

When I read timeseries data as per the example in the docs

from gldas.interface import GLDASTs
gldas_reader = GLDASTs(gldas_data_folder)
ts = gldas_reader.read_ts(70.125, 35.125)
print(ts.head())

I get

Traceback (most recent call last):
File ".../gldas_usecase.py", line 45, in <module>
    gldas_reader = GLDASTs(gldas_data_folder)
File ".../lib/python3.6/site-packages/gldas/interface.py", line 384, in __init__
    grid = pygeogrids.netcdf.load_grid(grid_path)
AttributeError: module 'pygeogrids' has no attribute 'netcdf'

which can be fixed by importing (in my script):

import pygeogrids.netcdf

Does this mean GLDASTs is missing an import?

cpaulik commented 6 years ago

Interesting that this never came up.

We should probably use something like from pygeogrids.netcdf import load_grid and then use that.

awst-baum commented 6 years ago

I still don't trust my own error report since the reader is tested in test_reshuffle.py::test_reshuffle and that was successfully run only a two weeks ago: https://travis-ci.org/TUW-GEO/gldas/builds/418145796

cpaulik commented 6 years ago

I think it works because of this line https://github.com/TUW-GEO/repurpose/blob/master/repurpose/img2ts.py#L44 which is executed when img2ts is imported in the reshuffling test.

wpreimes commented 6 years ago

@awst-baum I have also seen that error before, I normally fixed it the same way you did it, but never changed it in the package directly. I will add the import when I fix whatever is causing the build to fail.

wpreimes commented 5 years ago

This should be fixed now