pytroll / pytroll/satpy

'viirs_sdr' filename `end_time` not handled properly around midnight

Open
#2,129 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug component:readers
Dominant language
Python
Stars
1.2k
Forks
335
Avg merge
1d 18h
Merged PRs (30d)
10

Description

Describe the bug
Although there are files in the directory that meet the given time criteria the find_files_and_readers return ValueError: No supported files found. I observed it only for some times close to midnight, e.g. 23:51

files:

GDNBO_j01_d20220619_t2351438_e0003050_b23759_c20220620001612399860_cspp_dev.h5
GIMGO_j01_d20220619_t2351438_e0003050_b23759_c20220620001613080841_cspp_dev.h5
GITCO_j01_d20220619_t2351438_e0003050_b23759_c20220620001612026996_cspp_dev.h5
GMODO_j01_d20220619_t2351438_e0003050_b23759_c20220620001618513659_cspp_dev.h5
GMTCO_j01_d20220619_t2351438_e0003050_b23759_c20220620001612762736_cspp_dev.h5
IVCDB_j01_d20220619_t2351438_e0003050_b23759_c20220620001625276661_cspp_dev.h5
SVDNB_j01_d20220619_t2351438_e0003050_b23759_c20220620001625489783_cspp_dev.h5
SVI01_j01_d20220619_t2351438_e0003050_b23759_c20220620001623557681_cspp_dev.h5
SVI02_j01_d20220619_t2351438_e0003050_b23759_c20220620001624553445_cspp_dev.h5
SVI03_j01_d20220619_t2351438_e0003050_b23759_c20220620001623558110_cspp_dev.h5
SVI04_j01_d20220619_t2351438_e0003050_b23759_c20220620001624553257_cspp_dev.h5
SVI05_j01_d20220619_t2351438_e0003050_b23759_c20220620001623559782_cspp_dev.h5
SVM01_j01_d20220619_t2351438_e0003050_b23759_c20220620001624604441_cspp_dev.h5
SVM02_j01_d20220619_t2351438_e0003050_b23759_c20220620001623551455_cspp_dev.h5
SVM03_j01_d20220619_t2351438_e0003050_b23759_c20220620001623653962_cspp_dev.h5
SVM04_j01_d20220619_t2351438_e0003050_b23759_c20220620001624555074_cspp_dev.h5
SVM05_j01_d20220619_t2351438_e0003050_b23759_c20220620001624661236_cspp_dev.h5
SVM06_j01_d20220619_t2351438_e0003050_b23759_c20220620001624706478_cspp_dev.h5
SVM07_j01_d20220619_t2351438_e0003050_b23759_c20220620001624801815_cspp_dev.h5
SVM08_j01_d20220619_t2351438_e0003050_b23759_c20220620001624764398_cspp_dev.h5
SVM09_j01_d20220619_t2351438_e0003050_b23759_c20220620001625014005_cspp_dev.h5
SVM10_j01_d20220619_t2351438_e0003050_b23759_c20220620001624770840_cspp_dev.h5
SVM11_j01_d20220619_t2351438_e0003050_b23759_c20220620001625003619_cspp_dev.h5
SVM12_j01_d20220619_t2351438_e0003050_b23759_c20220620001625082861_cspp_dev.h5
SVM13_j01_d20220619_t2351438_e0003050_b23759_c20220620001625334705_cspp_dev.h5
SVM14_j01_d20220619_t2351438_e0003050_b23759_c20220620001625116759_cspp_dev.h5
SVM15_j01_d20220619_t2351438_e0003050_b23759_c20220620001625368220_cspp_dev.h5
SVM16_j01_d20220619_t2351438_e0003050_b23759_c20220620001625252645_cspp_dev.h5

To Reproduce


from satpy import find_files_and_readers
from datetime import datetime
reader='viirs_sdr'
files = find_files_and_readers(base_dir='/home/troll/scripts/test_data', reader=reader,start_time=datetime(2022,6,19,23,50), end_time=datetime(2022,6,19,23,52))

after changing the start_time=datetime(2022,6,19,23,50) parameter to start_time=datetime(2022,6,19,0,3) or earlier
files are found.

Expected behavior
Files should be found.

Actual results
Text output of actual results or error messages including full tracebacks if applicable.

Traceback (most recent call last):

  Input In [57] in <cell line: 1>
    runfile('/home/troll/scripts/test_data/test_time_viirs2.py', wdir='/home/troll/scripts/test_data')

  File ~/anaconda3/envs/pytroll/lib/python3.9/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/pydev_umd.py:175 in runfile
    execfile(filename, namespace)

  File ~/anaconda3/envs/pytroll/lib/python3.9/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_execfile.py:25 in execfile
    exec(compile(contents + "\n", file, 'exec'), glob, loc)

  File ~/scripts/test_data/test_time_viirs2.py:12 in <module>
    files = find_files_and_readers(base_dir='/home/troll/scripts/test_data', reader=reader,start_time=datetime(2022,6,19,23,50), end_time=datetime(2022,6,19,23,52))

  File ~/anaconda3/envs/pytroll/lib/python3.9/site-packages/satpy/readers/__init__.py:483 in find_files_and_readers
    raise ValueError("No supported files found")

ValueError: No supported files found

Screenshots
If applicable, add screenshots to help explain your problem.

Environment Info:

  • OS: Ubuntu 20.04 LTS
  • Satpy Version: 0.36.0]
  • PyResample Version: 1.23.0
  • Readers and writers dependencies (when relevant): [run from satpy.utils import check_satpy; check_satpy()]

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in find_files_and_readers with the viirs_sdr reader and reproduce the reported 23:50–23:52 query using the listed filenames. Trace how the filename end_time is parsed around midnight; done means the matching files are returned instead of raising ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.