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

Sentinel 2 dataset can't see files downloaded from Copernicus Browser - filename doesn't fit regex #1912

Open
soheir96 opened this issue Feb 27, 2024 · 1 comment
Labels
datasets Geospatial or benchmark datasets

Comments

@soheir96
Copy link

Description

Hi All,
I've downloaded band files for Sentinel 2A from the Copernicus Browser, and I think Copernicus might have changed their file naming style from what they used before?
File names I had downloaded:

2023-06-14-00_00_2023-06-14-23_59_Sentinel-2_L2A_B02_(Raw).tiff
2023-06-14-00_00_2023-06-14-23_59_Sentinel-2_L2A_B03_(Raw).tiff
2023-06-14-00_00_2023-06-14-23_59_Sentinel-2_L2A_B04_(Raw).tiff

Trying to use the load dataset function described in the docs (https://torchgeo.readthedocs.io/en/stable/api/datasets.html#torchgeo.datasets.Sentinel2) results in the following error

[FileNotFoundError](https://docs.python.org/3/library/exceptions.html#FileNotFoundError) – if no files are found in paths

as it can't recognise the filenames as they differ from the expected format.

Steps to reproduce

  1. Download files from Copernicus Browser
  2. Try to load files using Sentinel2 dataset:
dataset = Sentinel2(paths= PATH_TO_DATA)

Version

0.5.1

@adamjstewart adamjstewart added the datasets Geospatial or benchmark datasets label Feb 27, 2024
@adamjstewart adamjstewart added this to the 0.5.2 milestone Feb 27, 2024
@adamjstewart
Copy link
Collaborator

Updating filename_regex is easy because we can use "or" in the regex, but updating date_format is much harder because only a single value is currently allowed. We would have to allow multiple possible values of date_format and try all of them. Do you know if there's any documentation that describes the Copernicus Browser naming scheme? It's frustrating when there are several official download sites and they all use a different naming scheme...

FWIW, you can always subclass Sentinel2 and write your own custom regex/format. But I would love to be able to support this out of the box if we can.

@adamjstewart adamjstewart removed this from the 0.5.2 milestone Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasets Geospatial or benchmark datasets
Projects
None yet
Development

No branches or pull requests

2 participants