Commit 35a1dba1 authored by Nick Bearson's avatar Nick Bearson
Browse files

fixes to demlw, now always returns a uint8 and does some basic value checking

parent e0ce579f
......@@ -102,19 +102,22 @@ class DemLW(object):
def latlon2demlw(self, longitudes, latitudes):
# # First fill in with 30 arc sec data
# lw = self._map_subgrids(longitudes, latitudes, self.DEM_30_DICT)
#
# # Get a mask of the fill values
# fills = (lw == 221)
#
# # Now replace those fill values with values from 30 arc file
# lw[fills] = self._map_subgrids(longitudes[fills], latitudes[fills], self.DEM_15_DICT)
# FIXME: fills seem to have changed, just use ARC15 for now as speedup seems negligable
# First fill in with 30 arc sec data
lw = self._map_subgrids(longitudes, latitudes, self.DEM_15_DICT)
# Get a mask of the fill values
fills = (lw == 221)
# Now replace those fill values with values from 30 arc file
lw[fills] = self._map_subgrids(longitudes[fills], latitudes[fills], self.DEM_30_DICT)
return lw
if np.any(lw > 8):
raise RuntimeError, "Invalid LW value (>8)"
if np.any(lw < 0):
raise RuntimeError, "Invalid LW value (<0)"
return lw.astype(np.uint8)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment