Skip to content

Commit

Permalink
Don't crash when reading non aapp1b file.
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 Nov 17, 2014
1 parent 94b40fe commit b42331a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mpop/satin/aapp1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ def load_avhrr(satscene, options):
LOGGER.debug("Loading from " + filename)

scene = AAPP1b(filename)
scene.read()
try:
scene.read()
except ValueError:
LOGGER.info("Can't read " + filename)
return
scene.calibrate(chns, calibrate=options.get('calibrate', 1))

if satscene.area is None:
Expand Down Expand Up @@ -351,8 +355,9 @@ def read(self):
with open(self.filename, "rb") as fp_:
header = np.memmap(fp_, dtype=_HEADERTYPE, mode="r",
shape=(_HEADERTYPE.itemsize, ))
data = np.memmap(
fp_, dtype=_SCANTYPE, offset=688 + 10664 * 2, mode="r")
data = np.memmap(fp_,
dtype=_SCANTYPE,
offset=22016, mode="r")

LOGGER.debug("Reading time " + str(datetime.datetime.now() - tic))

Expand Down

0 comments on commit b42331a

Please sign in to comment.