Skip to content

Commit

Permalink
Corrected the reader for SAFNWC/PPS v2014.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sara.Hornquist committed Nov 7, 2014
1 parent 38b84be commit fcfe64f
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 fcfe64f

Please sign in to comment.