stactools-packages / planet

stactools package for working with Planet data
Other
3 stars 2 forks source link

TypeError: Type is not JSON serializable: Affine #20

Open julianblue opened 1 year ago

julianblue commented 1 year ago

Hi all,

when running the planet stactool I get the following error:

Saving STAC collection at /Users/julianblau/Work/rsdata-stac-tools/test-id/collection.json...
Traceback (most recent call last):
  File "/usr/local/bin/stac", line 8, in <module>
    sys.exit(run_cli())
  File "/usr/local/lib/python3.9/site-packages/stactools/cli/cli.py", line 38, in run_cli
    cli(prog_name="stac")
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/julianblau/Library/Python/3.9/lib/python/site-packages/stactools/planet/commands.py", line 83, in convert_command
    convert_order(manifest,
  File "/Users/julianblau/Library/Python/3.9/lib/python/site-packages/stactools/planet/commands.py", line 32, in convert_order
    collection.save(catalog_type=catalog_type)
  File "/Users/julianblau/Library/Python/3.9/lib/python/site-packages/pystac/catalog.py", line 862, in save
    item.save_object(
  File "/Users/julianblau/Library/Python/3.9/lib/python/site-packages/pystac/stac_object.py", line 418, in save_object
    stac_io.save_json(dest_href, self.to_dict(include_self_link=include_self_link))
  File "/Users/julianblau/Library/Python/3.9/lib/python/site-packages/pystac/stac_io.py", line 256, in save_json
    txt = self.json_dumps(json_dict, *args, **kwargs)
  File "/Users/julianblau/Library/Python/3.9/lib/python/site-packages/pystac/stac_io.py", line 124, in json_dumps
    return orjson.dumps(json_dict, option=orjson.OPT_INDENT_2, **kwargs).decode(
TypeError: Type is not JSON serializable: Affine

My dependencies:

# Name                    Version                   Build  Channel
affine                    2.4.0                    pypi_0    pypi
aiohttp                   3.8.4                    pypi_0    pypi
aiosignal                 1.3.1                    pypi_0    pypi
async-timeout             4.0.2                    pypi_0    pypi
attrs                     23.1.0                   pypi_0    pypi
ca-certificates           2023.01.10           hecd8cb5_0  
certifi                   2023.5.7                 pypi_0    pypi
charset-normalizer        3.1.0                    pypi_0    pypi
click                     8.1.3                    pypi_0    pypi
click-plugins             1.1.1                    pypi_0    pypi
cligj                     0.7.2                    pypi_0    pypi
exceptiongroup            1.1.1                    pypi_0    pypi
frozenlist                1.3.3                    pypi_0    pypi
fsspec                    2023.5.0                 pypi_0    pypi
idna                      3.4                      pypi_0    pypi
iniconfig                 2.0.0                    pypi_0    pypi
jsonschema                4.17.3                   pypi_0    pypi
libcxx                    14.0.6               h9765a3e_0  
libffi                    3.4.2                hecd8cb5_6  
lxml                      4.9.2                    pypi_0    pypi
multidict                 6.0.4                    pypi_0    pypi
ncurses                   6.4                  hcec6c5f_0  
numpy                     1.24.3                   pypi_0    pypi
openssl                   1.1.1t               hca72f7f_0  
packaging                 23.1                     pypi_0    pypi
pip                       23.0.1           py39hecd8cb5_0  
pluggy                    1.0.0                    pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
pyproj                    3.5.0                    pypi_0    pypi
pyrsistent                0.19.3                   pypi_0    pypi
pystac                    1.7.3                    pypi_0    pypi
pytest                    7.3.1                    pypi_0    pypi
python                    3.9.16               h218abb5_2  
python-dateutil           2.8.2                    pypi_0    pypi
python-dotenv             1.0.0                    pypi_0    pypi
pyyaml                    6.0                      pypi_0    pypi
rasterio                  1.3.6                    pypi_0    pypi
readline                  8.2                  hca72f7f_0  
requests                  2.30.0                   pypi_0    pypi
setuptools                66.0.0           py39hecd8cb5_0  
shapely                   2.0.1                    pypi_0    pypi
six                       1.16.0                   pypi_0    pypi
snuggs                    1.4.7                    pypi_0    pypi
sqlite                    3.41.2               h6c40b1e_0  
stac-check                1.3.2                    pypi_0    pypi
stac-validator            3.3.1                    pypi_0    pypi
stactools                 0.4.7                    pypi_0    pypi
stactools-planet          0.2.0                    pypi_0    pypi
tk                        8.6.12               h5d9f67b_0  
tomli                     2.0.1                    pypi_0    pypi
types-setuptools          67.7.0.1                 pypi_0    pypi
tzdata                    2023c                h04d1e81_0  
urllib3                   2.0.2                    pypi_0    pypi
wheel                     0.38.4           py39hecd8cb5_0  
xz                        5.4.2                h6c40b1e_0  
yarl                      1.9.2                    pypi_0    pypi
zlib                      1.2.13               h4dc903c_0  

Any ideas what could cause this ?

Thanks in advance.