Skip to content

Commit

Permalink
Prevent crashing when a load requirement is not available
Browse files Browse the repository at this point in the history
When requiring a band which isn't available, mpop would crash. This is now
fixed and replaced by a warning in the log.

Signed-off-by: Martin Raspaud <martin.raspaud@smhi.se>
  • Loading branch information
mraspaud committed Dec 4, 2015
1 parent 0e24503 commit 95ea9f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mpop/readers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,11 @@ def load(self, datasets_to_load, metadata=None, **dataset_info):
file_type = dataset_info["file_type"]
file_key = dataset_info["file_key"]
nav_name = dataset_info["navigation"]
file_reader = self.file_readers[file_type]
try:
file_reader = self.file_readers[file_type]
except KeyError:
LOG.warning("Can't file any file for type: %s", str(file_type))
continue

# Get the swath data (fully scaled and in the correct data type)
data = file_reader.get_swath_data(file_key, dataset_id=ds_id)
Expand Down

0 comments on commit 95ea9f3

Please sign in to comment.