Browse Source

Added checks for _key=None in extract_vars. Fix typo with updraft helicity cache key. Fixes #51.

lon0
Bill Ladwig 7 years ago
parent
commit
e6b4f7382b
  1. 2
      src/wrf/g_helicity.py
  2. 7
      src/wrf/util.py

2
src/wrf/g_helicity.py

@ -176,7 +176,7 @@ def get_uh(wrfin, timeidx=0, method="cat", squeeze=True,
""" """
ncvars = extract_vars(wrfin, timeidx, ("W", "PH", "PHB", "MAPFAC_M"), ncvars = extract_vars(wrfin, timeidx, ("W", "PH", "PHB", "MAPFAC_M"),
method, squeeze, cache, meta=False, _key=None) method, squeeze, cache, meta=False, _key=_key)
wstag = ncvars["W"] wstag = ncvars["W"]
ph = ncvars["PH"] ph = ncvars["PH"]

7
src/wrf/util.py

@ -973,10 +973,12 @@ def _combine_dict(wrfdict, varname, timeidx, method, meta, _key):
is_moving = is_moving_domain(wrfdict, varname, _key=_key) is_moving = is_moving_domain(wrfdict, varname, _key=_key)
_cache_key = _key[first_key] if _key is not None else None
first_array = _extract_var(wrfdict[first_key], varname, first_array = _extract_var(wrfdict[first_key], varname,
timeidx, is_moving=is_moving, method=method, timeidx, is_moving=is_moving, method=method,
squeeze=False, cache=None, meta=meta, squeeze=False, cache=None, meta=meta,
_key=_key[first_key]) _key=_cache_key)
# Create the output data numpy array based on the first array # Create the output data numpy array based on the first array
outdims = [numkeys] outdims = [numkeys]
@ -992,10 +994,11 @@ def _combine_dict(wrfdict, varname, timeidx, method, meta, _key):
break break
else: else:
keynames.append(key) keynames.append(key)
_cache_key = _key[key] if _key is not None else None
vardata = _extract_var(wrfdict[key], varname, timeidx, vardata = _extract_var(wrfdict[key], varname, timeidx,
is_moving=is_moving, method=method, is_moving=is_moving, method=method,
squeeze=False, cache=None, meta=meta, squeeze=False, cache=None, meta=meta,
_key=_key[key]) _key=_cache_key)
if outdata.shape[1:] != vardata.shape: if outdata.shape[1:] != vardata.shape:
raise ValueError("data sequences must have the " raise ValueError("data sequences must have the "

Loading…
Cancel
Save