Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IFF
demlw
Commits
35a1dba1
Commit
35a1dba1
authored
Jul 17, 2014
by
Nick Bearson
Browse files
fixes to demlw, now always returns a uint8 and does some basic value checking
parent
e0ce579f
Changes
1
Hide whitespace changes
Inline
Side-by-side
demlw/demlw.py
View file @
35a1dba1
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment