Skip to content

Commit

Permalink
Merge branch 'pre-master' of github.com:mraspaud/mpop into pre-master
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Nov 10, 2014
2 parents 0c7379f + fcfe64f commit bb3af47
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions mpop/satin/nwcsaf_pps_v2014.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Martin Raspaud <martin.raspaud@smhi.se>
# Adam Dybbroe <adam.dybbroe@smhi.se>
# Sara Hornquist <sara.hornquist@smhi.se>

# This file is part of mpop.

Expand All @@ -22,7 +23,7 @@
# mpop. If not, see <http://www.gnu.org/licenses/>.

"""Plugin for reading PPS's cloud products hdf files, in the fileformat used
in PPS v2012, and before.
in PPS v2014.
"""
import ConfigParser
from ConfigParser import NoOptionError
Expand Down Expand Up @@ -102,7 +103,7 @@ def read(self, filename, load_lonlat=True):
# Read the global attributes

self._md = dict(h5f.attrs)
self._md["satellite"] = h5f.attrs['satellite_id']
self._md["satellite"] = h5f.attrs['platform']
self._md["orbit"] = h5f.attrs['orbit_number']
self._md["time_slot"] = (timedelta(seconds=long(h5f.attrs['sec_1970']))
+ datetime(1970, 1, 1, 0, 0))
Expand Down Expand Up @@ -403,15 +404,15 @@ def load(scene, geofilename=None, **kwargs):

products = []
if "CTTH" in scene.channels_to_load:
products.append("ctth")
products.append("CTTH")
if "CloudType" in scene.channels_to_load:
products.append("cloudtype")
products.append("CT")
if "CMa" in scene.channels_to_load:
products.append("cloudmask")
products.append("CMA")
if "PC" in scene.channels_to_load:
products.append("precipclouds")
products.append("PC")
if "CPP" in scene.channels_to_load:
products.append("cpp")
products.append("CPP")

if len(products) == 0:
return
Expand Down Expand Up @@ -462,11 +463,11 @@ def load(scene, geofilename=None, **kwargs):
geofilename = None


classes = {"ctth": CloudTopTemperatureHeight,
"cloudtype": CloudType,
"cloudmask": CloudMask,
"precipclouds": PrecipitationClouds,
"cpp": CloudPhysicalProperties
classes = {"CTTH": CloudTopTemperatureHeight,
"CT": CloudType,
"CMA": CloudMask,
"PC": PrecipitationClouds,
"CPP": CloudPhysicalProperties
}

nodata_mask = False
Expand Down Expand Up @@ -512,9 +513,10 @@ def load(scene, geofilename=None, **kwargs):
if hasattr(chn, '_projectables'):
for key in chn._projectables:
projectable = getattr(chn, key)
if key in ['cloudtype']:
if key in ['ct']:
nodata_array = np.ma.array(projectable.data)
nodata_mask = np.ma.masked_equal(nodata_array, 0).mask
nodata_mask = np.ma.masked_equal(\
nodata_array, projectable.info["_FillValue"]).mask
break
else:
LOG.warning("Channel has no '_projectables' member." +
Expand Down

0 comments on commit bb3af47

Please sign in to comment.