Skip to content
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

stac_load raises Failed to auto-guess CRS/resolution #105

Closed
davidsackett opened this issue Mar 12, 2023 · 5 comments
Closed

stac_load raises Failed to auto-guess CRS/resolution #105

davidsackett opened this issue Mar 12, 2023 · 5 comments

Comments

@davidsackett
Copy link

Hi All,

I'm new to the project and trying to get it up and running locally for the first time.

When I try to run the stac-load-S2-ms example notebook locally I'm getting a ValueError: Failed to auto-guess CRS/resolution. exception.

Its failing at the cell below:

resolution = 10
...
xx = stac_load(
    items,
    chunks={"x": 2048, "y": 2048},
    stac_cfg=cfg,
    patch_url=pc.sign,
    resolution=resolution,
)

It seems to run correctly when using Binder which makes me think it must be something to do with my environment. I'm running on an M1 Mac with the following conda file:

name: odc-stac
channels:
  - conda-forge
dependencies:
  - python==3.10
  - planetary-computer
  - pystac-client==0.5.1
  - odc-stac
  - ipykernel
  - matplotlib
  - dask
  - distributed

Below is the output of conda list:

# Name                    Version                   Build  Channel
affine                    2.4.0              pyhd8ed1ab_0    conda-forge
appnope                   0.1.3              pyhd8ed1ab_0    conda-forge
arrow-cpp                 11.0.0          hce30654_10_cpu    conda-forge
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
attrs                     22.2.0             pyh71513ae_0    conda-forge
aws-c-auth                0.6.25               hb5790db_4    conda-forge
aws-c-cal                 0.5.21               h4697971_1    conda-forge
aws-c-common              0.8.12               h1a8c8d9_0    conda-forge
aws-c-compression         0.2.16               hab1c2c1_4    conda-forge
aws-c-event-stream        0.2.20               h574306b_2    conda-forge
aws-c-http                0.7.5                h736ca37_3    conda-forge
aws-c-io                  0.13.18              hba8c4f8_3    conda-forge
aws-c-mqtt                0.8.6                hb0ba32c_9    conda-forge
aws-c-s3                  0.2.6                hb5c44dc_0    conda-forge
aws-c-sdkutils            0.1.7                hab1c2c1_4    conda-forge
aws-checksums             0.1.14               hab1c2c1_4    conda-forge
aws-crt-cpp               0.19.8               h562fd06_7    conda-forge
aws-sdk-cpp               1.10.57              h14bed0f_7    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
blosc                     1.21.3               h1d6ff8b_0    conda-forge
bokeh                     2.4.3              pyhd8ed1ab_3    conda-forge
boost-cpp                 1.78.0               h1cb353e_1    conda-forge
brotli                    1.0.9                h1a8c8d9_8    conda-forge
brotli-bin                1.0.9                h1a8c8d9_8    conda-forge
brotlipy                  0.7.0           py310h8e9501a_1005    conda-forge
bzip2                     1.0.8                h3422bc3_4    conda-forge
c-ares                    1.18.1               h3422bc3_0    conda-forge
ca-certificates           2022.12.7            h4653dfc_0    conda-forge
cachetools                5.3.0              pyhd8ed1ab_0    conda-forge
cairo                     1.16.0            h73a0509_1014    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h2399d43_3    conda-forge
cfitsio                   4.2.0                h2f961c4_0    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
click                     8.1.3           unix_pyhd8ed1ab_2    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.7.2              pyhd8ed1ab_1    conda-forge
cloudpickle               2.2.1              pyhd8ed1ab_0    conda-forge
comm                      0.1.2              pyhd8ed1ab_0    conda-forge
contourpy                 1.0.7           py310h2887b22_0    conda-forge
cryptography              39.0.2          py310hfc83b78_0    conda-forge
curl                      7.88.1               h9049daf_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cytoolz                   0.12.0          py310h8e9501a_1    conda-forge
dask                      2023.3.1           pyhd8ed1ab_0    conda-forge
dask-core                 2023.3.1           pyhd8ed1ab_0    conda-forge
debugpy                   1.6.6           py310h0f1eb42_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
distributed               2023.3.1           pyhd8ed1ab_0    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
expat                     2.5.0                hb7217d7_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.2               h82840c6_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.39.0          py310h8e9501a_0    conda-forge
freetype                  2.12.1               hd633e50_1    conda-forge
freexl                    1.0.6                h1a8c8d9_1    conda-forge
fsspec                    2023.3.0           pyhd8ed1ab_1    conda-forge
geos                      3.11.1               hb7217d7_0    conda-forge
geotiff                   1.7.1                hdcdc974_6    conda-forge
gettext                   0.21.1               h0186832_0    conda-forge
gflags                    2.2.2             hc88da5d_1004    conda-forge
giflib                    5.2.1                h27ca646_2    conda-forge
glog                      0.6.0                h6da1cb0_0    conda-forge
hdf4                      4.2.15               h1a38d6a_5    conda-forge
hdf5                      1.12.2          nompi_ha7af310_101    conda-forge
heapdict                  1.0.1                      py_0    conda-forge
icu                       70.1                 h6b3803e_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
importlib-metadata        6.0.0              pyha770c72_0    conda-forge
importlib_metadata        6.0.0                hd8ed1ab_0    conda-forge
ipykernel                 6.21.2             pyh736e0ef_0    conda-forge
ipython                   8.11.0             pyhd1c38e8_0    conda-forge
jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
jpeg                      9e                   h1a8c8d9_3    conda-forge
json-c                    0.16                 hc449e50_0    conda-forge
jupyter_client            8.0.3              pyhd8ed1ab_0    conda-forge
jupyter_core              5.2.0           py310hbe9552e_0    conda-forge
kealib                    1.5.0                hfd766a6_0    conda-forge
kiwisolver                1.4.4           py310h2887b22_1    conda-forge
krb5                      1.20.1               h69eda48_0    conda-forge
lcms2                     2.15                 h481adae_0    conda-forge
lerc                      4.0.0                h9a09cb3_0    conda-forge
libabseil                 20230125.0      cxx17_hb7217d7_1    conda-forge
libaec                    1.0.6                hb7217d7_1    conda-forge
libarrow                  11.0.0          h013759d_10_cpu    conda-forge
libblas                   3.9.0           16_osxarm64_openblas    conda-forge
libbrotlicommon           1.0.9                h1a8c8d9_8    conda-forge
libbrotlidec              1.0.9                h1a8c8d9_8    conda-forge
libbrotlienc              1.0.9                h1a8c8d9_8    conda-forge
libcblas                  3.9.0           16_osxarm64_openblas    conda-forge
libcrc32c                 1.1.2                hbdafb3b_0    conda-forge
libcurl                   7.88.1               h9049daf_0    conda-forge
libcxx                    15.0.7               h75e25f2_0    conda-forge
libdeflate                1.17                 h1a8c8d9_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h642e427_1    conda-forge
libevent                  2.1.10               h7673551_4    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgdal                   3.6.2                h8d4b95d_8    conda-forge
libgfortran               5.0.0           12_2_0_hd922786_31    conda-forge
libgfortran5              12.2.0              h0eea778_31    conda-forge
libglib                   2.74.1               h4646484_1    conda-forge
libgoogle-cloud           2.8.0                h7206bc8_1    conda-forge
libgrpc                   1.52.1               he98ff75_1    conda-forge
libiconv                  1.17                 he4db4b2_0    conda-forge
libkml                    1.3.0             h41464e4_1015    conda-forge
liblapack                 3.9.0           16_osxarm64_openblas    conda-forge
libnetcdf                 4.9.1           nompi_h232cb48_101    conda-forge
libnghttp2                1.52.0               hae82a92_0    conda-forge
libopenblas               0.3.21          openmp_hc731615_3    conda-forge
libpng                    1.6.39               h76d750c_0    conda-forge
libpq                     15.2                 h1a28acd_0    conda-forge
libprotobuf               3.21.12              hb5ab8b9_0    conda-forge
librttopo                 1.1.0               h844f84d_12    conda-forge
libsodium                 1.0.18               h27ca646_1    conda-forge
libspatialite             5.0.1               h14115fc_23    conda-forge
libsqlite                 3.40.0               h76d750c_0    conda-forge
libssh2                   1.10.0               h7a5bd25_3    conda-forge
libthrift                 0.18.0               h6635e49_0    conda-forge
libtiff                   4.5.0                h5dffbdd_2    conda-forge
libutf8proc               2.8.0                h1a8c8d9_0    conda-forge
libwebp-base              1.2.4                h57fd34a_0    conda-forge
libxcb                    1.13              h9b22ae9_1004    conda-forge
libxml2                   2.10.3               h87b0503_0    conda-forge
libzip                    1.9.2                h76ab92c_1    conda-forge
libzlib                   1.2.13               h03a7124_4    conda-forge
llvm-openmp               15.0.7               h7cfbb63_0    conda-forge
locket                    1.0.0              pyhd8ed1ab_0    conda-forge
lz4                       4.3.2           py310ha6df754_0    conda-forge
lz4-c                     1.9.4                hb7217d7_0    conda-forge
markupsafe                2.1.2           py310h8e9501a_0    conda-forge
matplotlib                3.7.1           py310hb6292c7_0    conda-forge
matplotlib-base           3.7.1           py310h78c5c2f_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
msgpack-python            1.0.5           py310h2887b22_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
ncurses                   6.3                  h07bb92c_1    conda-forge
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
nspr                      4.35                 hb7217d7_0    conda-forge
nss                       3.89                 h789eff7_0    conda-forge
numpy                     1.24.2          py310h3d2048e_0    conda-forge
odc-geo                   0.3.3              pyhd8ed1ab_0    conda-forge
odc-stac                  0.3.5              pyhd8ed1ab_0    conda-forge
openjpeg                  2.5.0                hbc2ba62_2    conda-forge
openssl                   3.0.8                h03a7124_0    conda-forge
orc                       1.8.2                hef0d403_2    conda-forge
packaging                 23.0               pyhd8ed1ab_0    conda-forge
pandas                    1.5.3           py310h2b830bf_0    conda-forge
parquet-cpp               1.5.1                         2    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
partd                     1.3.0              pyhd8ed1ab_0    conda-forge
pcre2                     10.40                hb34f9b4_0    conda-forge
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.4.0           py310h5a7539a_1    conda-forge
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h27ca646_0    conda-forge
planetary-computer        0.4.9              pyhd8ed1ab_0    conda-forge
platformdirs              3.1.0              pyhd8ed1ab_0    conda-forge
poppler                   23.03.0              h9564b9f_0    conda-forge
poppler-data              0.4.12               hd8ed1ab_0    conda-forge
postgresql                15.2                 h45c140d_0    conda-forge
proj                      9.1.1                h13f728c_2    conda-forge
prompt-toolkit            3.0.38             pyha770c72_0    conda-forge
prompt_toolkit            3.0.38               hd8ed1ab_0    conda-forge
psutil                    5.9.4           py310h8e9501a_0    conda-forge
pthread-stubs             0.4               h27ca646_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pyarrow                   11.0.0          py310h89f3c6b_10_cpu    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydantic                  1.10.6          py310h8e9501a_0    conda-forge
pygments                  2.14.0             pyhd8ed1ab_0    conda-forge
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyproj                    3.4.1           py310h9862ddf_1    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pystac                    1.7.0              pyhd8ed1ab_0    conda-forge
pystac-client             0.5.1              pyhd8ed1ab_0    conda-forge
python                    3.10.0          h43b31ca_3_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pytz                      2022.7.1           pyhd8ed1ab_0    conda-forge
pyyaml                    6.0             py310h8e9501a_5    conda-forge
pyzmq                     25.0.0          py310hc407298_0    conda-forge
rasterio                  1.3.6           py310h2630d6e_0    conda-forge
re2                       2023.02.02           hb7217d7_0    conda-forge
readline                  8.1.2                h46ed386_0    conda-forge
requests                  2.28.2             pyhd8ed1ab_0    conda-forge
setuptools                67.6.0             pyhd8ed1ab_0    conda-forge
shapely                   2.0.1           py310h9356385_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.10               h17c5cce_0    conda-forge
snuggs                    1.4.7                      py_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sqlite                    3.40.0               h2229b38_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
tblib                     1.7.0              pyhd8ed1ab_0    conda-forge
tiledb                    2.13.2               h9bd36d0_0    conda-forge
tk                        8.6.12               he1e0b03_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tornado                   6.2             py310h8e9501a_1    conda-forge
traitlets                 5.9.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.5.0                hd8ed1ab_0    conda-forge
typing_extensions         4.5.0              pyha770c72_0    conda-forge
tzcode                    2022g                h1a8c8d9_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
unicodedata2              15.0.0          py310h8e9501a_0    conda-forge
urllib3                   1.26.14            pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
xarray                    2023.2.0           pyhd8ed1ab_0    conda-forge
xerces-c                  3.2.4                h627aa08_1    conda-forge
xorg-libxau               1.0.9                h27ca646_0    conda-forge
xorg-libxdmcp             1.1.3                h27ca646_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
zeromq                    4.3.4                hbdafb3b_1    conda-forge
zict                      2.2.0              pyhd8ed1ab_0    conda-forge
zipp                      3.15.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               h03a7124_4    conda-forge
zstd                      1.5.2                hf913c23_6    conda-forge

Any assistance would be greatly appreciated.

@Kirill888
Copy link
Member

Thanks for the report @davidsackett.

That would be because of the lack of backward compatibility in pystac extensions.

I reckon things will work if you use older version of pystac that does not include this commit:

stac-utils/pystac@70f498e

Above bumps projection extension version, while stac catalog served by MPC uses v1.0.0.

More discussions on backward compatibility issues is here:

stac-utils/pystac#448

The effect of NOT having backward compatible parsing of extensions in pystac library is that people have to move away from using extension code and instead extract that metadata manually, or otherwise fiddle with items before parsing, like editing version listed in stac_extsnsions dictionary. I already had to add fallbacks for eo extension parsing, and looks like I'll have to add the same for projection extension.

@davidsackett
Copy link
Author

Thanks for the quick response and advice @Kirill888. I was able to run the notebook using the commit prior to the one you mentioned. Below is the updated conda file:

name: odc-stac
channels:
  - conda-forge
dependencies:
  - python==3.10
  - planetary-computer
  - odc-stac
  - ipykernel
  - matplotlib
  - dask
  - distributed
  - pip:
    - git+https://github.com/stac-utils/pystac.git@c41613a

Much appreciated!

@Kirill888
Copy link
Member

I think just having pystac < 1.7.0 should do the trick as well.

@gadomski
Copy link
Contributor

gadomski commented Apr 6, 2023

@Kirill888 we just released pystac v1.7.2 which hopefully fixes the issue: https://github.com/stac-utils/pystac/releases/tag/v1.7.2

@zxdawn
Copy link

zxdawn commented May 7, 2024

I got the same error when running this code with the new version (1.10.1). Any idea?

from pystac_client import Client
from odc.stac import load


client = Client.open("https://earth-search.aws.element84.com/v1")
collection = "sentinel-2-l2a"

datetime_range = '2023-01-01/2024-04-30'
bbox = (-70.0683, 18.462699999999998, -69.8683, 18.6627)

search = client.search(collections = [collection],
                        bbox = bbox,
                        datetime = datetime_range,
                        query = {"eo:cloud_cover":{"lt":0.03}},
                        # max_items=1,
                        )


s2_data = load(search.items(), bbox=bbox, groupby="solar_day", chunks={})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants