From 04fe7539e0f0cb0cc9a29380d0584cac3f17e810 Mon Sep 17 00:00:00 2001 From: Bill Ladwig Date: Mon, 14 Jan 2019 12:24:13 -0700 Subject: [PATCH] PEP8 --- src/wrf/__init__.py | 21 +++++++++++++-------- src/wrf/g_helicity.py | 10 +++++----- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/wrf/__init__.py b/src/wrf/__init__.py index 2a60704..39cd608 100755 --- a/src/wrf/__init__.py +++ b/src/wrf/__init__.py @@ -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__) diff --git a/src/wrf/g_helicity.py b/src/wrf/g_helicity.py index 964c083..a7ef39f 100755 --- a/src/wrf/g_helicity.py +++ b/src/wrf/g_helicity.py @@ -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, 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, uh = _udhel(zp, mapfct, u, v, wstag, dx, dy, bottom, top) return uh - \ No newline at end of file