Skip to content

Commit

Permalink
Merge pull request #47 from tparker-usgs/master
Browse files Browse the repository at this point in the history
Expand error message when geolocation or band data is missing
  • Loading branch information
mraspaud committed Jun 7, 2017
2 parents f45ba02 + ec826ef commit a523db8
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions mpop/satin/viirs_sdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,30 +845,40 @@ def load(self, satscene, calibrate=1, time_interval=None,
if os.path.basename(geofile).startswith('GMTCO')]
if len(geofilenames_band) != len(filename_band):
# Try the geoid instead:
num_geo = len(geofilenames_band)
geofilenames_band = [geofile for geofile in geofile_list
if os.path.basename(geofile).startswith('GMODO')]
if len(geofilenames_band) != len(filename_band):
raise IOError("Not all geo location files " +
"for this scene are present for band " +
band.band_id + "!")
num_geo = max(num_geo, len(geofilenames_band))
num_band = len(filename_band)
raise IOError("Incomplete dataset. " +
"Found %d geolocation files" % num_geo +
" and %d %s files" % (num_band,
band.band_id))
elif band.band_id.startswith('I'):
geofilenames_band = [geofile for geofile in geofile_list
if os.path.basename(geofile).startswith('GITCO')]
if len(geofilenames_band) != len(filename_band):
# Try the geoid instead:
num_geo = len(geofilenames_band)
geofilenames_band = [geofile for geofile in geofile_list
if os.path.basename(geofile).startswith('GIMGO')]
if len(geofilenames_band) != len(filename_band):
raise IOError("Not all geo location files " +
"for this scene are present for band " +
band.band_id + "!")
num_geo = max(num_geo, len(geofilenames_band))
num_band = len(filename_band)
raise IOError("Incomplete dataset. " +
"Found %d geolocation files" % num_geo +
" and %d %s files" % (num_band,
band.band_id))
elif band.band_id.startswith('D'):
geofilenames_band = [geofile for geofile in geofile_list
if os.path.basename(geofile).startswith('GDNBO')]
if len(geofilenames_band) != len(filename_band):
raise IOError("Not all geo-location files " +
"for this scene are present for " +
"the Day Night Band!")
num_geo = len(geofilenames_band)
num_band = len(filename_band)
raise IOError("Incomplete dataset. " +
"Found %d GDNBO files " % num_geo +
"and %d %s files" % (num_band, band.band_id))

band.read_lonlat(geofilepaths=geofilenames_band)

Expand Down

0 comments on commit a523db8

Please sign in to comment.