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

SEVIRI HRIT reading: More userfriendly warning when no EPI/PRO files are present #147

Closed
adybbroe opened this issue Jan 5, 2018 · 6 comments
Labels
component:readers enhancement code enhancements, features, improvements help wanted
Milestone

Comments

@adybbroe
Copy link
Contributor

adybbroe commented Jan 5, 2018

Code Sample, a minimal, complete, and verifiable piece of code

from satpy.scene import Scene
from satpy.utils import debug_on
debug_on()
seviri = Scene(filenames=..., reader='hrit_msg')

Problem description

It often happens that a user forgets to copy the EPI and PRO files to the data directory. When instantiating the Scene object you will get a RuntimeError exception as depicted below.
Running with debug info on you will also get some warnings like:

[WARNING: 2018-01-05 10:50:09 : satpy.readers.yaml_reader] Missing requirements for /data/lang/satellit/geo/hrit/2015/201511/16/12/H-000-MSG1__-MSG1________-IR_120___-000005___-201511161200-__

But it is not obvious it comes from the missing prologue and epilogue files.

Expected Output

A warning message saying that this might most probably be due to the missing header/trailer files:

WARNING: No EPI/PRO files found!

Actual Result, Traceback if applicable

    102                                                     reader_kwargs=reader_kwargs,
    103                                                     metadata=metadata)
--> 104         self.info.update(self._compute_metadata_from_readers())
    105         self.datasets = DatasetDict()
    106         self.cpl = CompositorLoader(self.ppp_config_dir)

/home/a000680/usr/src/satpy/satpy/scene.pyc in _compute_metadata_from_readers(self)
    119         if self.readers:
    120             mda['start_time'] = min(x.start_time
--> 121                                     for x in self.readers.values())
    122             mda['end_time'] = max(x.end_time
    123                                   for x in self.readers.values())

/home/a000680/usr/src/satpy/satpy/scene.pyc in <genexpr>((x,))
    119         if self.readers:
    120             mda['start_time'] = min(x.start_time
--> 121                                     for x in self.readers.values())
    122             mda['end_time'] = max(x.end_time
    123                                   for x in self.readers.values())

/home/a000680/usr/src/satpy/satpy/readers/yaml_reader.pyc in start_time(self)
    410     def start_time(self):
    411         if not self.file_handlers:
--> 412             raise RuntimeError("Start time unknown until files are selected")
    413         return min(x[0].start_time for x in self.file_handlers.values())
    414 

RuntimeError: Start time unknown until files are selected

Versions of Python, package at hand and relevant dependencies

Python 2.7.5
Satpy 0.7.7

Thank you for reporting an issue !

@mraspaud mraspaud modified the milestones: v0.8.0, v0.8.1 Jan 11, 2018
@mraspaud mraspaud modified the milestones: v0.8.1, v0.9 Jan 19, 2018
@howff
Copy link

howff commented Mar 20, 2018

The other common mistake is to give compressed files. A suitable warning, or a hook to allow decompression, would be useful.

@djhoese
Copy link
Member

djhoese commented Jun 14, 2018

@adybbroe @mraspaud Wasn't this resolved? I thought we finally got annoyed enough that one of you fixed this.

@mraspaud mraspaud modified the milestones: v0.9, v0.9.1 Jul 5, 2018
@mraspaud mraspaud added enhancement code enhancements, features, improvements help wanted component:readers labels Jul 5, 2018
@djhoese djhoese modified the milestones: v0.9.1, v0.10 Aug 20, 2018
@sfinkens
Copy link
Member

sfinkens commented Oct 8, 2018

If filenames contains multiple scans of which only one is missing the prolog/epilog, you don't even get a RuntimeError. In that case it is likely to miss the warnings among all the other log messages. Wouldn't it make more sense to raise an exception if a requirement cannot be found? You cannot continue anyway.

@djhoese
Copy link
Member

djhoese commented Oct 9, 2018

@sfinkens That sounds reasonable to me. @mraspaud @adybbroe thoughts?

SatPy tries to balance usability with a good user experience. A lot of satpy users (at least in my experience) need to generate as many of the products as possible for the data they have available. If one of the products can't be generated then the others should still be generated. In your case, I agree with you that this should raise an error if nothing more can be done.

@mraspaud I think we already check to make sure the file types are the same length (or maybe we used to). Maybe we could make sure that they are all the same length and their requirements are all met.

@sfinkens
Copy link
Member

sfinkens commented Oct 9, 2018

I gave it a go, trying to find the balance you mentioned. Let me know what you think.

@djhoese djhoese modified the milestones: v0.10, v1.0, v0.11 Oct 9, 2018
@mraspaud
Copy link
Member

@howff this is addressed in #436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:readers enhancement code enhancements, features, improvements help wanted
Projects
None yet
Development

No branches or pull requests

5 participants