locationtech-labs / geopyspark

GeoTrellis for PySpark
Other
179 stars 59 forks source link

Regression when using time_intervals in gps.query #622

Closed jdries closed 6 years ago

jdries commented 6 years ago

When I do this:

time_intervals = [pd.to_datetime(from_date),pd.to_datetime(to_date)]
gps.query(uri="accumulo://host:2181/hdp-accumulo-instance",layer_name=product_id,query_geom=bbox,query_proj=srs,time_intervals=time_intervals)

I get an exception on this code in catalog.py:213 (master branch) about not being able to use tuples as list indices:

File "/data3/hadoop/yarn/local/usercache/mep_tsviewer/appcache/application_1514822824284_33569/container_e3232_1514822824284_33569_01_000001/openeo_geopyspark-0.0.0-py3.5.egg/openeogeotrellis/__init__.py", line 53, in getImageCollection
    return GeotrellisTimeSeriesImageCollection(gps.query(uri="accumulo://epod6.vgt.vito.be:2181/hdp-accumulo-instance",layer_name=product_id,query_geom=bbox,query_proj=srs,time_intervals=time_intervals))
  File "/data3/hadoop/yarn/local/usercache/mep_tsviewer/appcache/application_1514822824284_33569/container_e3232_1514822824284_33569_01_000001/geopyspark-0.3.0+openeo1-py3.6.egg/geopyspark/geotrellis/catalog.py", line 213, in query
    time = time_intervals[x]
TypeError: list indices must be integers or slices, not tuple

Because of this code:

        for x in enumerate(time_intervals):
            time = time_intervals[x]

so apparently x is a tuple, x[0] produces an index. This did work in version 0.3.0, python version 3.5.

jbouffard commented 6 years ago

@jdries Thank you for bringing this to our attention! I just put up #623 which will resolve this issue.