-
Notifications
You must be signed in to change notification settings - Fork 49
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 for Pystac ItemCollections #69
Conversation
FWIW, I got a different error message than what you posted in #64 ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-5554f41e60de> in <module>
13 )
14
---> 15 stack = stackstac.stack(results.get_all_items(), assets=["B02", "B03"])
~/src/gjoseph92/stackstac/stackstac/stack.py in stack(items, assets, epsg, resolution, bounds, bounds_latlon, snap_bounds, resampling, chunksize, dtype, fill_value, rescale, sortby_date, xy_coords, properties, band_coords, gdal_env, errors_as_nodata, reader)
278 automatically computed from the items you pass in.
279 """
--> 280 plain_items = items_to_plain(items)
281
282 if sortby_date is not False:
~/src/gjoseph92/stackstac/stackstac/stac_types.py in items_to_plain(items)
161
162 if isinstance(items, (PystacItemCollection, PystacClientItemCollection)):
--> 163 return [item.to_dict() for item in items.features]
164
165 raise TypeError(f"Unrecognized STAC collection type {type(items)}: {items!r}")
AttributeError: 'ItemCollection' object has no attribute 'features' But this PR fixes that. +1 to tests :) I have some very basic ones started for my work on #62 that I can split out when I find time. |
Whoops! indeed, the error I posted is raised if using stackstac 0.2.1 rather than the master branch (TypeError: Unrecognized STAC collection type <class 'pystac.item_collection.ItemCollection'>: <pystac.item_collection.ItemCollection object at 0x7f10d3d833a0>)
sounds great to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @scottyhq and thanks for updating docs as well!
If you want to add some tests, by all means go for it. My time to work on stackstac is very limited right now, so I'm sure I won't get to it for a while.
Not sure if I should add the poetry.lock file that I updated to test this out locally
Yes, please add this (see https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control). That'll be especially helpful once we have CI.
@@ -54,7 +54,7 @@ graphviz = "^0.16" | |||
jupyterlab = "^3.0.14" | |||
keyring = "^23.0.1" | |||
py-spy = "^0.3.4" | |||
pystac = "^0" | |||
pystac = "^1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be any stricter on minor versions? Or is any 1.x fine? Probably is fine, I'm just checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
less restrictive seems best, especially with pystac as a 'dev' dependency (although might be worth getting more specific if it becomes a core dependency #20)? If I understand correctly these dev pins are only considered when running poetry update
where the lockfile is solved for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think that's right. poetry update
gives you the latest versions of everything within the bounds specified in the lockfile. Agreed that we should leave it like this for now, and we'll get more restrictive if necessary in the future.
Co-authored-by: Gabe Joseph <gjoseph92@gmail.com>
…into pystac_client2
Hey all, Is there a status on the next release of stackstac? I'm running stackstac 0.2.1 and I'm getting the same error message @scottyhq reported while running the example from the documentation > https://stackstac.readthedocs.io/en/latest/basic.html. |
@amfriesz don't have any plans yet; my time is very limited right now. I think there are still a few things broken related to pystac—both documentation/examples/readme issues, and more broadly stac-utils/pystac#546. Pystac is so slow that I'd actually like to switch all examples away from it for now #79. So to me, that work is blocking a release. |
@gjoseph92, thanks for the update. |
Until stac-utils/pystac#546 is resolved, pystac is very painful to use, so I'd rather not have it be the lead example. Partially Revert "Fix for Pystac ItemCollections (#69)" This reverts commit 98809b4.
Until stac-utils/pystac#546 is resolved, pystac is very painful to use, so I'd rather not have it be the lead example. Partially Revert "Fix for Pystac ItemCollections (#69)" This reverts commit 98809b4.
And fix a couple errors in #69
Hi,
My code is
I'm doing something wrong?
|
Try Sorry I haven't gotten a release out. I was testing things out for a release and noticed some intermittent failures when upgrading rasterio (which feel thread-safety related), so I wanted to verify that first in case we need to pin versions for now. |
In my case at the end I had to remove completely stackstac and reinstall it. Thanks a lot |
Follow on to #64 to work with Pystac ItemCollection https://pystac.readthedocs.io/en/latest/api.html#itemcollection.
Partially addresses #65, but did not update all the docs and examples
Not sure if I should add the poetry.lock file that I updated to test this out locally