stactools-packages / sentinel3

stactools package for Sentinel-3 data
Other
7 stars 9 forks source link

Unable to create STAC items #31

Open varisht-tathya opened 9 months ago

varisht-tathya commented 9 months ago

Describe the bug I am unable to create a STAC item of a S3 product. Product has been extracted from a Sen 3 product zip file. I get this error instead:

TypeError: FileExtensionUpdated() takes no arguments

To reproduce Steps to reproduce the behavior:

path = "/home/varisht/S3_DIR/S3A_SL_1_RBT____20230126T040853_20230126T041153_20230127T131532_0179_094_375_2520_PS1_O_NT_004.SEN3"
item = stac.create_item(path, skip_nc=False)

# I get the following error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[74], line 1
----> 1 item = stac.create_item(path, skip_nc=False)

File ~/anaconda3/envs/pystac/lib/python3.12/site-packages/stactools/sentinel3/stac.py:84, in create_item(granule_href, skip_nc, read_href_modifier)
     82 item.add_asset(manifest_asset_key, manifest_asset)
     83 manifest_href = os.path.join(granule_href, MANIFEST_FILENAME)
---> 84 manifest_file = FileExtensionUpdated.ext(manifest_asset, add_if_missing=True)
     85 fill_manifest_file_properties(manifest_href, metalinks.manifest_text, manifest_file)
     87 # create band asset list

File ~/anaconda3/envs/pystac/lib/python3.12/site-packages/stactools/sentinel3/file_extension_updated.py:38, in FileExtensionUpdated.ext(cls, obj, add_if_missing)
     33 @classmethod
     34 def ext(
     35     cls, obj: pystac.Asset, add_if_missing: bool = False
     36 ) -> "FileExtensionUpdated":
     37     super().ext(obj, add_if_missing)
---> 38     return cls(obj)

TypeError: FileExtensionUpdated() takes no arguments

Expected behavior I should get a STAC item Screenshots and shell session dumps

Additional context

sreimond-eodc commented 8 months ago

I have the same issue. Is this package still being developed? Are there alternatives for Sentinel-3 data?

lmizzoni commented 5 months ago

Hello everyone! It seems that using python version 3.10 or higher doesn't work.

Try using the python version 3.8, for me worked well.

fabricebrito commented 5 months ago

@lmizzoni can you pin pystac < 1.9.0 using python 3.10? I guess this issue is linked to pystac commit https://github.com/stac-utils/pystac/commit/d7a67128dcd619171d9ce1396e860e5fb03bcaca#diff-ead4b1abaa38d4af24f580bee0525e7ebdce83cce67cfbf26ef42646179f0fcc and provide the outcome here?

lmizzoni commented 5 months ago

@lmizzoni can you pin pystac < 1.9.0 using python 3.10? I guess this issue is linked to pystac commit stac-utils/pystac@d7a6712#diff-ead4b1abaa38d4af24f580bee0525e7ebdce83cce67cfbf26ef42646179f0fcc and provide the outcome here?

I did some tests using pystac version < 1.9.0 and Python >= 3.10, and everything worked well. After running the command stac sentinel3 create-item <source> <destination>, I received the STAC item without errors.

However, switching to pystac version 1.9.0 or higher causes the error to reappear. Therefore, I agree that the error seems to be linked to that commit.

fbalaban commented 1 month ago

Hey @jonas-eberle, do you want create a PR for that fix you've applied at the fork?