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
Issues with numpy 1.24.0 #194
Comments
Thanks for reporting @julianblue. This maybe seems like numpy/numpy#22004:
However I'm confused, since we do already pass I won't be able to work on this for a few weeks. For now, pinning NumPy is a fine workaround; ideally we'd make a release doing that. If anyone wants to take a look at this sooner, please post what you find here. |
Do you have a reproducible example @julianblue? I can't reproduce using stackstac
|
@TomAugspurger I did not specify the assets to pull all available bands. Specifying the assets does NOT cause the error to be raised @gjoseph92 . stack = stackstac.stack(itm_coll, resolution=10) |
the code fails in the metadata conversion for proj:transform (not present in the preview band) [[10.0, 0.0, 399960.0, 0.0, -10.0, 5700000.0], [60.0, 0.0, 399960.0, 0.0, -60.0, 5700000.0], [10.0, 0.0, 399960.0, 0.0, -10.0, 5700000.0], [10.0, 0.0, 399960.0, 0.0, -10.0, 5700000.0], [10.0, 0.0, 399960.0, 0.0, -10.0, 5700000.0], [20.0, 0.0, 399960.0, 0.0, -20.0, 5700000.0], [20.0, 0.0, 399960.0, 0.0, -20.0, 5700000.0], [20.0, 0.0, 399960.0, 0.0, -20.0, 5700000.0], [10.0, 0.0, 399960.0, 0.0, -10.0, 5700000.0], [60.0, 0.0, 399960.0, 0.0, -60.0, 5700000.0], [20.0, 0.0, 399960.0, 0.0, -20.0, 5700000.0], [20.0, 0.0, 399960.0, 0.0, -20.0, 5700000.0], [20.0, 0.0, 399960.0, 0.0, -20.0, 5700000.0], [20.0, 0.0, 399960.0, 0.0, -20.0, 5700000.0], [10.0, 0.0, 399960.0, 0.0, -10.0, 5700000.0], [10.0, 0.0, 399960.0, 0.0, -10.0, 5700000.0], None] The none in the list should ideally not exist for raster band data and should be a transform like the other bands? This causes props_arr = np.squeeze(
np.array(
props,
# Avoid DeprecationWarning creating ragged arrays when elements are lists/tuples of different lengths
dtype="object"
if (
isinstance(props, _ourlist)
and len(set(len(x) for x in props if isinstance(x, (list, tuple))))
> 1
)
else None,
)
) to set dtype=None and raises the error. Shouldn't the dtype in that case be set to "object" as well instead of none? |
@julianblue can you give #195 a try? I don't have a computer available, so just did this on my phone and can't test it out. I feel like something along these lines might work (not sure if this is exactly the thing to do, though). |
Hi @gjoseph92 , |
I hit this issue today on stackstac==0.4.3. It is happening when I use the query extension to filter out Landsat 7 items from the landsat-c2-l2 collection in the Planetary Computer STAC. Other operations that use the Here is a reprex: import planetary_computer
import pystac_client
import stackstac
COLLECTION = "landsat-c2-l2"
BBOX = (-91.67481115470213, 47.86318699029263, -91.52471085746416, 47.93118792159696)
DATE_RANGE = ["2022-07-01", "2022-07-31"]
EPSG = 5070
RESOLUTION = 30
ASSETS = ["red", "green", "blue", "qa_pixel"]
BOUNDS_5070 = (326000, 2771000, 337000, 2778000)
planetary_computer_catalog = pystac_client.Client.open(
"https://planetarycomputer.microsoft.com/api/stac/v1",
modifier=planetary_computer.sign_inplace,
)
# include all items
stac_items = planetary_computer_catalog.search(
collections=[COLLECTION],
bbox=BBOX,
datetime=DATE_RANGE,
).item_collection()
print(f"there are {len(stac_items)} items if we do not apply any filters")
# works
landsat_stack = stackstac.stack(
items=stac_items,
assets=ASSETS,
epsg=EPSG,
resolution=RESOLUTION,
bounds=BOUNDS_5070,
xy_coords="center",
)
print(landsat_stack)
# filter out cloudy items
stac_items_less_cloudy = planetary_computer_catalog.search(
collections=[COLLECTION],
bbox=BBOX,
datetime=DATE_RANGE,
query={"eo:cloud_cover": {"lte": 50}},
).item_collection()
print(f"there are {len(stac_items_less_cloudy)} items if we exclude cloudy images")
# works
landsat_stack_filt = stackstac.stack(
items=stac_items_less_cloudy,
assets=ASSETS,
epsg=EPSG,
resolution=RESOLUTION,
bounds=BOUNDS_5070,
xy_coords="center",
)
print(landsat_stack_filt)
# exclude Landsat 7
stac_items_no_landsat_7 = planetary_computer_catalog.search(
collections=[COLLECTION],
bbox=BBOX,
datetime=DATE_RANGE,
query={"platform": {"neq": "landsat-7"}},
).item_collection()
print(f"there are {len(stac_items_no_landsat_7)} items if we exclude Landsat 7")
# fails with inhomogenous error
landsat_stack_filt = stackstac.stack(
items=stac_items_no_landsat_7,
assets=ASSETS,
epsg=EPSG,
resolution=RESOLUTION,
bounds=BOUNDS_5070,
xy_coords="center",
)
print(landsat_stack_filt) Output:
|
FYI @julianblue @hrodmn, I just released a version with this fixed (0.4.4). Sorry for the long wait. |
Thanks @gjoseph92! |
Hi @gjoseph92 ,
I am getting an error when trying to stack data when the latest numpy version 1.24.0 is installed. All works fine with 1.23.5.
The text was updated successfully, but these errors were encountered: