Skip to content

Commit

Permalink
Bugfix: mipp_xrit: do not crash on unknown channels, just warn and skip.
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Raspaud <martin.raspaud@smhi.se>
  • Loading branch information
mraspaud committed May 13, 2015
1 parent 30e9994 commit 8672c66
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mpop/satin/mipp_xrit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010, 2011, 2013, 2014.
# Copyright (c) 2010, 2011, 2013, 2014, 2015.

# SMHI,
# Folkborgsvägen 1,
Expand Down Expand Up @@ -143,8 +143,12 @@ def load_generic(satscene, options, calibrate=True, area_extent=None,

# Convert area definitions to maximal area_extent
if not area_converted_to_extent and area_def_names is not None:
metadata = xrit.sat.load(satscene.fullname, satscene.time_slot,
chn, only_metadata=True)
try:
metadata = xrit.sat.load(satscene.fullname, satscene.time_slot,
chn, only_metadata=True)
except mipp.ReaderError as err:
LOGGER.warning(str(err))
continue
# if area_extent is given, assume it gives the maximum
# extent of the satellite view
if area_extent is not None:
Expand Down Expand Up @@ -182,9 +186,9 @@ def load_generic(satscene, options, calibrate=True, area_extent=None,
else:
metadata, data = image()

except ReaderError, err:
except ReaderError as err:
# if channel can't be found, go on with next channel
LOGGER.error(str(err))
LOGGER.warning(str(err))
continue

satscene[chn] = data
Expand Down

0 comments on commit 8672c66

Please sign in to comment.