Bill Ladwig 6 years ago
parent
commit
0990e3a333
  1. 21
      src/wrf/__init__.py
  2. 10
      src/wrf/g_helicity.py

21
src/wrf/__init__.py

@ -2,19 +2,24 @@ from __future__ import (absolute_import, division, print_function) @@ -2,19 +2,24 @@ from __future__ import (absolute_import, division, print_function)
import os
import pkg_resources
# For gfortran+msvc combination, extra shared libraries may exist (stored by numpy.distutils)
if os.name == "nt":
try:
try:
from . import api
from .api import *
except ImportError:
# For gfortran+msvc combination, extra shared libraries may exist
# (stored by numpy.distutils)
if os.name == "nt":
req = pkg_resources.Requirement.parse("wrf-python")
extra_dll_dir = pkg_resources.resource_filename(req,
extra_dll_dir = pkg_resources.resource_filename(req,
"wrf-python/.libs")
if os.path.isdir(extra_dll_dir):
os.environ["PATH"] += os.pathsep + extra_dll_dir
except ImportError:
pass
from . import api
from .api import *
from . import api
from .api import *
else:
raise
__all__ = []
__all__.extend(api.__all__)

10
src/wrf/g_helicity.py

@ -102,14 +102,15 @@ def get_srh(wrfin, timeidx=0, method="cat", squeeze=True, @@ -102,14 +102,15 @@ def get_srh(wrfin, timeidx=0, method="cat", squeeze=True,
z = geopt_unstag / Constants.G
# Re-ordering from high to low
u1 = np.ascontiguousarray(u[...,::-1,:,:])
v1 = np.ascontiguousarray(v[...,::-1,:,:])
z1 = np.ascontiguousarray(z[...,::-1,:,:])
u1 = np.ascontiguousarray(u[..., ::-1, :, :])
v1 = np.ascontiguousarray(v[..., ::-1, :, :])
z1 = np.ascontiguousarray(z[..., ::-1, :, :])
srh = _srhel(u1, v1, z1, ter, lats, top)
return srh
@copy_and_set_metadata(copy_varname="MAPFAC_M", name="updraft_helicity",
description="updraft helicity",
units="m2 s-2")
@ -187,7 +188,7 @@ def get_uh(wrfin, timeidx=0, method="cat", squeeze=True, @@ -187,7 +188,7 @@ def get_uh(wrfin, timeidx=0, method="cat", squeeze=True,
phb = ncvars["PHB"]
mapfct = ncvars["MAPFAC_M"]
attrs = extract_global_attrs(wrfin, attrs=("DX", "DY"))
attrs = extract_global_attrs(wrfin, attrs=("DX", "DY"))
dx = attrs["DX"]
dy = attrs["DY"]
@ -207,4 +208,3 @@ def get_uh(wrfin, timeidx=0, method="cat", squeeze=True, @@ -207,4 +208,3 @@ def get_uh(wrfin, timeidx=0, method="cat", squeeze=True,
uh = _udhel(zp, mapfct, u, v, wstag, dx, dy, bottom, top)
return uh
Loading…
Cancel
Save