Skip to content

Commit

Permalink
numpy>=1.10 compliant. Return a copy (instead of a view) of the band
Browse files Browse the repository at this point in the history
geolocations when creating the SwathDefinition for the band area.

Not really sure if this is where the real problem sits, but seems to fix a problem
with masking with newer numpy version (>=1.10)

Signed-off-by: Adam.Dybbroe <a000680@c20671.ad.smhi.se>
  • Loading branch information
Adam.Dybbroe committed Jul 12, 2017
1 parent fb0fe21 commit 76873ca
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mpop/satin/viirs_sdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def read(self):
self.latitudes[y0_:y1_, :],
self.elevation[y0_:y1_, :],
self.mask[y0_:y1_, :])

self.longitudes = np.ma.array(self.longitudes,
mask=self.mask,
copy=False)
Expand Down Expand Up @@ -891,8 +892,8 @@ def load(self, satscene, calibrate=1, time_interval=None,
satscene[chn].info['band_id'] = band.band_id
satscene[chn].info['start_time'] = band.begin_time
satscene[chn].info['end_time'] = band.end_time
if chn in ['M01', 'M02', 'M03', 'M04', 'M05', 'M06', 'M07', 'M08', 'M09', 'M10', 'M11',
'I01', 'I02', 'I03']:
if chn in ['M01', 'M02', 'M03', 'M04', 'M05', 'M06', 'M07',
'M08', 'M09', 'M10', 'M11', 'I01', 'I02', 'I03']:
satscene[chn].info['sun_zen_correction_applied'] = True

# We assume the same geolocation should apply to all M-bands!
Expand All @@ -903,13 +904,13 @@ def load(self, satscene, calibrate=1, time_interval=None,
satscene[chn].area = geometry.SwathDefinition(
lons=np.ma.masked_where(band.data.mask,
band.geolocation.longitudes,
copy=False),
copy=True),
lats=np.ma.masked_where(band.data.mask,
band.geolocation.latitudes,
copy=False))
copy=True))
height = np.ma.masked_where(band.data.mask,
band.geolocation.elevation,
copy=False)
copy=True)

area_name = ("swath_" + satscene.fullname + "_" +
str(satscene.time_slot) + "_"
Expand Down

0 comments on commit 76873ca

Please sign in to comment.