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

slstr_l2: Failed to filter out correct files using find_files_and_readers() with start_time and end_time #1594

Closed
johannesocean opened this issue Mar 12, 2021 · 7 comments

Comments

@johannesocean
Copy link
Contributor

johannesocean commented Mar 12, 2021

Describe the bug
satpy.readers.find_files_and_readers does not filter out the correct files based on start_time and end_time.

Possibly something fishy with the file_pattern of satpy/etc/readers/slstr_l2.yaml ?

Data source: CODA

To Reproduce

from datetime import datetime
from satpy import Scene, find_files_and_readers

sen3_data_l2 = 'C:/Temp/Satellit/sentinel_data/sst'
filenames = find_files_and_readers(
    start_time=datetime(2020, 6, 1, 7, 10),
    end_time=datetime(2020, 6, 1, 12, 50),
    base_dir=sen3_data_l2,
    reader='slstr_l2',
    sensor='slstr_l2',
)

Expected behavior

>>>pprint(filenames)
{'slstr_l2': 'C:/Temp/Satellit/sentinel_data/sst\\20200601092517-MAR-L2P_GHRSST-SSTskin-SLSTRA-20200601113739-v02.0-fv01.0.nc']}

Actual results
Text output of actual results or error messages including full tracebacks if applicable.
[DEBUG: 2021-03-12 09:05:42 : satpy.readers.yaml_reader] Reading ('C:\Continuum\Miniconda3\envs\satpy_env\Lib\site-packages\satpy\etc\readers\slstr_l2.yaml',)

>>>pprint(filenames)
{'slstr_l2': ['C:/Temp/Satellit/sentinel_data/sst\\20210213100240-MAR-L2P_GHRSST-SSTskin-SLSTRA-20210213121415-v02.0-fv01.0.nc',
              'C:/Temp/Satellit/sentinel_data/sst\\20200601092517-MAR-L2P_GHRSST-SSTskin-SLSTRA-20200601113739-v02.0-fv01.0.nc']}

Environment Info:

  • OS: Windows10
  • Satpy Version: 0.25.1
@djhoese
Copy link
Member

djhoese commented Mar 12, 2021

I think this is a problem in the file pattern in the reader:

'{dt1:%Y%m%d%H%M%S}-{generating_centre:3s}-{type_id:3s}_GHRSST-SSTskin-SLSTR{something:1s}-{dt2:%Y%m%d%H%M%S}-{version}.nc'

The find_files_and_readers function uses parameters start_time and end_time if they exist. This file pattern uses dt1 and dt2. Any idea what these dates represent in the filename (I'm not familiar with this data)?

@djhoese
Copy link
Member

djhoese commented Mar 12, 2021

@eysteinn May have ideas as the original author of this reader (that's what git tells me at least).

@johannesocean
Copy link
Contributor Author

Ah, right. So dt1 and dt2 should probably be replaced by start_time and end_time.. but that did not solve the issue..

'SLSTRB' as file_type seems to indicate that we´re only working with the SLSTR sensor on Sentinel-3B and not 3A as well (perhaps not relevant for this particular case though)

@djhoese
Copy link
Member

djhoese commented Mar 12, 2021

Hm if the start/end time change in the file pattern didn't fix it, then I'm not sure where to go from here. I don't have a ton of time to look deeper so hopefully @eysteinn or another expert on this data can investigate more.

@johannesocean
Copy link
Contributor Author

Cool, we wait for @eysteinn, otherwise I´ll might have another look at it next week..

@johannesocean
Copy link
Contributor Author

@djhoese So find_files_and_readers does in fact work as expected if you replace dt1 and dt2 with start_time and end_time (I must have done some typos last time..)

@djhoese
Copy link
Member

djhoese commented Mar 18, 2021

@JohannesSMHI Great! Do you think you could make a pull request?

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

No branches or pull requests

2 participants