diff --git a/.gitignore b/.gitignore index c070e32..868dff8 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ Thumbs.db *.project *.pydevproject doc/build -doc/source/api/generated +doc/source/internal_api/generated +doc/source/user_api/generated test/ipynb/.ipynb_checkpoints diff --git a/doc/source/conf.py b/doc/source/conf.py index 4cccfc0..705b332 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -67,6 +67,9 @@ extensions = [ intersphinx_mapping = { 'matplotlib': ('http://matplotlib.org/', None), + 'basemap' : ('http://matplotlib.org/basemap/', None), + 'cartopy' : ( + 'http://scitools.org.uk/cartopy/docs/latest/index.html', None), 'python': ('http://docs.python.org/3/', None), 'numpy': ('http://docs.scipy.org/doc/numpy/', None), 'xarray': ('http://xarray.pydata.org/en/stable/', None), diff --git a/doc/source/internal_api/index.rst b/doc/source/internal_api/index.rst index cc2aed6..9bbba0f 100644 --- a/doc/source/internal_api/index.rst +++ b/doc/source/internal_api/index.rst @@ -1,8 +1,69 @@ Internal API ============= +------------- + +Routines +------------- + +Extraction and Diagnostic Routines +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The routines below are called internally by :meth:`wrf.getvar`. + +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + wrf.cape.get_2dcape + wrf.cape.get_3dcape + wrf.cloudfrac.get_cloudfrac + wrf.ctt.get_ctt + wrf.dbz.get_dbz + wrf.dbz.get_max_dbz + wrf.dewpoint.get_dp + wrf.dewpoint.get_dp_2m + wrf.geoht.get_geopt + wrf.geoht.get_height + wrf.helicity.get_srh + wrf.helicity.get_uh + wrf.omega.get_omega + wrf.pressure.get_pressure + wrf.pressure.get_pressure_hpa + wrf.pw.get_pw + wrf.rh.get_rh + wrf.rh.get_rh_2m + wrf.slp.get_slp + wrf.temp.get_theta + wrf.temp.get_temp + wrf.temp.get_eth + wrf.temp.get_tv + wrf.temp.get_tw + wrf.temp.get_tk + wrf.temp.get_tc + wrf.terrain.get_terrain + wrf.times.get_times + wrf.times.get_xtimes + wrf.uvmet.get_uvmet + wrf.uvmet.get_uvmet10 + wrf.uvmet.get_uvmet_wspd_wdir + wrf.uvmet.get_uvmet10_wspd_wdir + wrf.vorticity.get_avo + wrf.vorticity.get_pvo + wrf.wind.get_u_destag + wrf.wind.get_v_destag + wrf.wind.get_w_destag + wrf.wind.get_destag_wspd_wdir + wrf.wind.get_destag_wspd_wdir10 + +------------------------- + +Decorators +---------------- + + Algorithm Decorators --------------------- +^^^^^^^^^^^^^^^^^^^^^^^^ The decorators below are used for performing common operations related to diagnostic and interpolation calculations. @@ -11,18 +72,18 @@ diagnostic and interpolation calculations. :nosignatures: :toctree: ./generated/ - wrf.convert_units - wrf.left_iteration - wrf.cast_type - wrf.extract_and_transpose - wrf.check_args - wrf.uvmet_left_iter - wrf.cape_left_iter - wrf.cloudfrac_left_iter + wrf.decorators.convert_units + wrf.decorators.left_iteration + wrf.decorators.cast_type + wrf.decorators.extract_and_transpose + wrf.decorators.check_args + wrf.specialdec.uvmet_left_iter + wrf.specialdec.cape_left_iter + wrf.specialdec.cloudfrac_left_iter Metadata Decorators --------------------- +^^^^^^^^^^^^^^^^^^^^^^ The decorators below are used for performing common operations related to setting metadata. @@ -31,24 +92,24 @@ setting metadata. :nosignatures: :toctree: ./generated/ - wrf.copy_and_set_metadata - wrf.set_wind_metadata - wrf.set_cape_metadata - wrf.set_cloudfrac_metadata - wrf.set_latlon_metadata - wrf.set_height_metadata - wrf.set_interp_metadata - wrf.set_alg_metadata - wrf.set_uvmet_alg_metadata - wrf.set_cape_alg_metadata - wrf.set_cloudfrac_alg_metadata - wrf.set_destag_metadata + wrf.metadecorators.copy_and_set_metadata + wrf.metadecorators.set_wind_metadata + wrf.metadecorators.set_cape_metadata + wrf.metadecorators.set_cloudfrac_metadata + wrf.metadecorators.set_latlon_metadata + wrf.metadecorators.set_height_metadata + wrf.metadecorators.set_interp_metadata + wrf.metadecorators.set_alg_metadata + wrf.metadecorators.set_uvmet_alg_metadata + wrf.metadecorators.set_cape_alg_metadata + wrf.metadecorators.set_cloudfrac_alg_metadata + wrf.metadecorators.set_destag_metadata Decorator Utilities --------------------- +^^^^^^^^^^^^^^^^^^^^^^^ -The routines below are used within decorators. +The routines below are used within the decorators. .. autosummary:: :nosignatures: @@ -60,10 +121,19 @@ The routines below are used within decorators. wrf.from_args wrf.args_to_list wrf.arg_location - -Miscellaneous Classes ----------------------- + +------------------------ + +Classes +----------------------- + +Iterable Wrapper Class +^^^^^^^^^^^^^^^^^^^^^^^ + +The class below is an Iterable wrapper class and provides an __iter__ function +that always returns the beginning of the sequence, regardless of the +Iterable type. .. autosummary:: :nosignatures: diff --git a/doc/source/user_api/index.rst b/doc/source/user_api/index.rst index acf174d..d5a1ea3 100644 --- a/doc/source/user_api/index.rst +++ b/doc/source/user_api/index.rst @@ -1,8 +1,13 @@ User API ============= +----------------- + +Routines +------------------ + Diagnostic Routine -------------------- +^^^^^^^^^^^^^^^^^^^^^^^ The routine below is the primary routine for extracting variables from a WRF-ARW NetCDF file (or sequence of files) and performing diagnostic @@ -16,7 +21,7 @@ calculations. Interpolation Routines ----------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^ The routines below are the primary routines used for performing interpolation calculations. @@ -29,15 +34,29 @@ calculations. wrf.vertcross wrf.interpline wrf.vinterp + +Lat-Lon to/from XY Routines +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The routines below are used for converting back and forth between xy-grid +space and latitude-longitude space. + +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + wrf.ll_to_xy + wrf.xy_to_ll + wrf.ll_to_xy_proj + wrf.xy_to_ll_proj Numpy Extraction Routine --------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The routine below is used to extract a :class:`numpy.ndarray` from a :class:`xarray.DataArray`. This routine must be used before passing -the array object to a compiled extension. Otherwise, unusually crashes -may occur. +the array object to a compiled extension. .. autosummary:: :nosignatures: @@ -47,7 +66,7 @@ may occur. Variable Extraction Routines ------------------------------ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The routines below are primarily used internally by :meth:`wrf.getvar`, but some users may find them useful to manually extract variables from a @@ -60,13 +79,12 @@ WRF NetCDF file (or a sequence of NetCDF files). wrf.extract_vars wrf.combine_files wrf.extract_dim - wrf.extract_extract_global_attrs + wrf.extract_global_attrs wrf.extract_times - Raw Diagnostic Routines ------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^ The routines below can be used when working with variables that are not contained in a WRF-ARW NetCDF file. They can also be used with non-WRF data. @@ -78,7 +96,6 @@ may vary when working with non-WRF data. Also, the vast majority of these routines do not allow for missing values in any of the input arrays, so make sure they are removed before calling these routines. - .. autosummary:: :nosignatures: @@ -89,7 +106,6 @@ sure they are removed before calling these routines. wrf.interp2dxy wrf.interpz3d wrf.slp - wrf.temp wrf.tk wrf.td wrf.rh @@ -111,23 +127,40 @@ sure they are removed before calling these routines. wrf.pw -CoordPair Class ----------------------- +Configuration Routines +^^^^^^^^^^^^^^^^^^^^^^^^^ -The class below is used for coordinate metadata. +The routines below are used to configure wrf-python by enabling or +disabling third party packages. For the most part, these settings are +configured automatically based on the presence of a third party package. +However, disabling xarray can be useful when you want to turn off all metadata +in one place. .. autosummary:: :nosignatures: :toctree: ./generated/ - wrf.CoordPair + wrf.xarray_enabled + wrf.disable_xarray + wrf.enable_xarray + wrf.cartopy_enabled + wrf.disable_cartopy + wrf.enable_cartopy + wrf.basemap_enabled + wrf.disable_basemap + wrf.enable_basemap + wrf.pyngl_enabled + wrf.enable_pyngl + wrf.disable_pyngl + wrf.set_cache_size + wrf.get_cache_size Miscellaneous Routines ------------------------ +^^^^^^^^^^^^^^^^^^^^^^^^^^ The routines below are primarily used internally, but some users may find -them helpful. +them helpful for other purposes. .. autosummary:: :nosignatures: @@ -152,6 +185,100 @@ them helpful. wrf.get_proj_params wrf.psafilepath wrf.get_id + wrf.getproj + wrf.cache_item + wrf.get_cached_item + + +------------------------ + + +Classes +---------------------- + +Exceptions +^^^^^^^^^^^^^^ + +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + wrf.DiagnosticError + + +CoordPair Class +^^^^^^^^^^^^^^^^^^^^^^^ + +The class below is used for storing coordinate metadata from routines that +use a single point for an (x, y) or (lat, lon) location. + +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + wrf.CoordPair + +CoordPair Methods +~~~~~~~~~~~~~~~~~~~~~~~ + +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + wrf.CoordPair.latlon_str + wrf.CoordPair.xy_str + + +Projection Classes +^^^^^^^^^^^^^^^^^^^^^^^^ + +The classes below are used to hold the projection information in the +'projection' entry within a :attr:`xarray.DataArray.attrs` attribute. + +Projection Base Class +~~~~~~~~~~~~~~~~~~~~~~~~ + +The base class for all map projection types. + +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + wrf.WrfProj + +Projection Base Class Methods +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The class methods for all projection types. + +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + wrf.WrfProj.basemap + wrf.WrfProj.cartopy + wrf.WrfProj.cartopy_xlim + wrf.WrfProj.cartopy_ylim + wrf.WrfProj.pyngl + wrf.WrfProj.cf + wrf.WrfProj.proj4 + + +Projection Subclasses +~~~~~~~~~~~~~~~~~~~~~~~~ + +See :class:`wrf.WrfProj` for methods and attributes. + +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + wrf.NullProjection + wrf.LambertConformal + wrf.Mercator + wrf.PolarStereographic + wrf.LatLon + wrf.RotatedLatLon diff --git a/src/wrf/api.py b/src/wrf/api.py index b42f1ba..3ab32b4 100644 --- a/src/wrf/api.py +++ b/src/wrf/api.py @@ -1,7 +1,8 @@ from .config import (xarray_enabled, disable_xarray, enable_xarray, - cartopy_enabled, enable_cartopy, enable_cartopy, + cartopy_enabled, disable_cartopy, enable_cartopy, basemap_enabled, disable_basemap, enable_basemap, - pyngl_enabled, enable_pyngl, disable_pyngl) + pyngl_enabled, enable_pyngl, disable_pyngl, + set_cache_size, get_cache_size) from .constants import ALL_TIMES, Constants, ConversionFactors, ProjectionTypes from .destag import destagger from .routines import getvar @@ -9,6 +10,7 @@ from .computation import (xy, interp1d, interp2dxy, interpz3d, slp, tk, td, rh, uvmet, smooth2d, cape_2d, cape_3d, cloudfrac, ctt, dbz, srhel, udhel, avo, pvo, eth, wetbulb, tvirtual, omega, pw) +from .extension import DiagnosticError from .interp import (interplevel, vertcross, interpline, vinterp) from .latlon import (xy_to_ll, ll_to_xy, xy_to_ll_proj, ll_to_xy_proj) from .py3compat import (viewitems, viewkeys, viewvalues, isstr, py2round, @@ -23,23 +25,19 @@ from .util import (npvalues, extract_global_attrs, is_standard_wrf_var, IterWrapper, is_coordvar, latlon_coordvars, is_mapping, has_time_coord, is_multi_file, is_multi_time_req, get_coord_pairs, is_time_coord_var) +from .projection import (WrfProj, NullProjection, LambertConformal, Mercator, + PolarStereographic, LatLon, RotatedLatLon, + getproj) from .coordpair import CoordPair -from decorators import (convert_units, left_iteration, cast_type, - extract_and_transpose, check_args) -from specialdec import (uvmet_left_iter, cape_left_iter, cloudfrac_left_iter) -from metadecorators import (copy_and_set_metadata, set_wind_metadata, - set_cloudfrac_metadata, set_latlon_metadata, - set_height_metadata, set_interp_metadata, - set_alg_metadata, set_uvmet_alg_metadata, - set_cape_alg_metadata, set_cloudfrac_alg_metadata, - set_destag_metadata) +from cache import cache_item, get_cached_item from .version import __version__ __all__ = [] __all__ += ["xarray_enabled", "disable_xarray", "enable_xarray", - "cartopy_enabled", "enable_cartopy", "enable_cartopy", + "cartopy_enabled", "disable_cartopy", "enable_cartopy", "basemap_enabled", "disable_basemap", "enable_basemap", - "pyngl_enabled", "enable_pyngl", "disable_pyngl"] + "pyngl_enabled", "enable_pyngl", "disable_pyngl", + "set_cache_size", "get_cache_size"] __all__ += ["ALL_TIMES", "Constants", "ConversionFactors", "ProjectionTypes"] __all__ += ["destagger"] __all__ += ["getvar"] @@ -47,6 +45,7 @@ __all__ += ["xy", "interp1d", "interp2dxy", "interpz3d", "slp", "tk", "td", "rh", "uvmet", "smooth2d", "cape_2d", "cape_3d", "cloudfrac", "ctt", "dbz", "srhel", "udhel", "avo", "pvo", "eth", "wetbulb", "tvirtual", "omega", "pw"] +__all__ += ["DiagnosticError"] __all__ += ["interplevel", "vertcross", "interpline", "vinterp"] __all__ += ["xy_to_ll", "ll_to_xy", "xy_to_ll_proj", "ll_to_xy_proj"] __all__ += ["viewitems", "viewkeys", "viewvalues", "isstr", "py2round", @@ -61,15 +60,9 @@ __all__ += ["npvalues", "extract_global_attrs", "is_standard_wrf_var", "IterWrapper", "is_coordvar", "latlon_coordvars", "is_mapping", "has_time_coord", "is_multi_file", "is_multi_time_req", "get_coord_pairs", "is_time_coord_var"] -__all__ += ["convert_units", "left_iteration", "cast_type", - "extract_and_transpose", "check_args"] -__all__ += ["uvmet_left_iter", "cape_left_iter", "cloudfrac_left_iter"] -__all__ += ["copy_and_set_metadata", "set_wind_metadata", - "set_cloudfrac_metadata", "set_latlon_metadata", - "set_height_metadata", "set_interp_metadata", - "set_alg_metadata", "set_uvmet_alg_metadata", - "set_cape_alg_metadata", "set_cloudfrac_alg_metadata", - "set_destag_metadata"] +__all__ += ["WrfProj", "NullProjection", "LambertConformal", "Mercator", + "PolarStereographic", "LatLon", "RotatedLatLon", "getproj"] __all__ += ["CoordPair"] +__all__ += ["cache_item", "get_cached_item"] __all__ += ["__version__"] diff --git a/src/wrf/computation.py b/src/wrf/computation.py index 88549d2..fba53ea 100644 --- a/src/wrf/computation.py +++ b/src/wrf/computation.py @@ -334,7 +334,7 @@ def slp(height, tkel, pres, qv, meta=True, units="hPa"): Geopotential height in [m] with the rightmost dimensions being bottom_top x south_north x west_east. - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with same dimensionality as *height*. pres (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Full @@ -382,8 +382,8 @@ def slp(height, tkel, pres, qv, meta=True, units="hPa"): @set_alg_metadata(3, "pres", description="temperature") @convert_units("temp", "k") -def temp(pres, theta, meta=True, units="K"): - """Return the temperature in the specified units. +def tk(pres, theta, meta=True, units="K"): + """Return the temperature. This is the raw computational algorithm and does not extract any variables from WRF output files. Use :meth:`wrf.getvar` to both extract and compute @@ -437,59 +437,6 @@ def temp(pres, theta, meta=True, units="K"): return _tk(pres, theta) -def tk(pres, theta, meta=True): - """Return the temperature in Kelvin. - - This is an alias for *wrf.temp(pres, theta, meta, units='K')*. This - function is here for users that are familiar with NCL's wrf_tk. - - This is the raw computational algorithm and does not extract any variables - from WRF output files. Use :meth:`wrf.getvar` to both extract and compute - diagnostic variables. - - Args: - - pres (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Full - pressure (perturbation + base state pressure) in [Pa] with at least - three dimensions. The rightmost dimensions are bottom_top x - south_north x west_east. - - Note: - - This variable must be - supplied as a :class:`xarray.DataArray` in order to copy the - dimension names to the output. Otherwise, default names will - be used. - - theta (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Potential - temperature (perturbation plus reference temperature) in [K] with - the same dimensionality as *pres*. - - meta (:obj:`bool`): Set to False to disable metadata and return - :class:`numpy.ndarray` instead of - :class:`xarray.DataArray`. Default is True. - - Warning: - - The input arrays must not contain any missing/fill values or - :data:`numpy.nan` values. - - Returns: - - :class:`xarray.DataArray` or :class:`numpy.ndarray`: The - temperature in Kelvin. If xarray is enabled and - the *meta* parameter is True, then the result will be an - :class:`xarray.DataArray` object. Otherwise, the result will - be a :class:`numpy.ndarray` object with no metadata. - - See Also: - - :meth:`wrf.getvar`, :meth:`wrf.temp` - - """ - return temp(pres, theta, meta, units="K") - - @set_alg_metadata(3, "pres", description="dew point temperature") @convert_units("temp", "c") def td(pres, qv, meta=True, units="degC"): @@ -570,7 +517,7 @@ def rh(qv, pres, tkel, meta=True): dimension names to the output. Otherwise, default names will be used. - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with same dimensionality as *qv*. Note: @@ -816,7 +763,7 @@ def cape_2d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow, dimension names to the output. Otherwise, default names will be used. - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with same dimensionality as *pres_hpa*. qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor @@ -938,7 +885,7 @@ def cape_3d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow, dimension names to the output. Otherwise, default names will be used. - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with same dimensionality as *pres_hpa*. qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor @@ -1088,7 +1035,7 @@ def ctt(pres_hpa, tkel, qv, qcld, height, terrain, qice=None, meta=True, dimension names to the output. Otherwise, default names will be used. - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with same dimensionality as *pres_hpa*. qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor @@ -1177,7 +1124,7 @@ def dbz(pres, tkel, qv, qr, qs=None, qg=None, use_varint=False, dimension names to the output. Otherwise, default names will be used. - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with same dimensionality as *pres*. qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor @@ -1614,7 +1561,7 @@ def eth(qv, tkel, pres, meta=True, units="K"): mixing ratio in [kg/kg] that is at least three dimensions, with the rightmost dimensions of bottom_top x south_north x west_east. - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with same dimensionality as *qv*. Note: @@ -1682,7 +1629,7 @@ def wetbulb(pres, tkel, qv, meta=True, units="K"): dimension names to the output. Otherwise, default names will be used. - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with same dimensionality as *pres*. qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor @@ -1731,7 +1678,7 @@ def tvirtual(tkel, qv, meta=True, units="K"): Args: - tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`) Temperature + tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature in [K] with the rightmost dimensions as bottom_top x south_north x west_east. diff --git a/src/wrf/extension.py b/src/wrf/extension.py index 1a6e1ed..d1d43c5 100755 --- a/src/wrf/extension.py +++ b/src/wrf/extension.py @@ -20,10 +20,10 @@ from .py3compat import py3range from .specialdec import (uvmet_left_iter, cape_left_iter, cloudfrac_left_iter) -class FortranError(Exception): - """Raised when an error occurs in a Fortran routine.""" +class DiagnosticError(Exception): + """Raised when an error occurs in a diagnostic routine.""" def __init__(self, message=None): - """Initialize a :class:`wrf.FortranError` objection. + """Initialize a :class:`wrf.DiagnosticError` objection. Args: @@ -206,7 +206,7 @@ def _slp(z, t, p, q, outview=None): errmsg=errmsg) if int(errstat) != 0: - raise FortranError("".join(npbytes_to_str(errmsg)).strip()) + raise DiagnosticError("".join(npbytes_to_str(errmsg)).strip()) return result @@ -465,7 +465,7 @@ def _wetbulb(p, tk, qv, psafile=psafilepath(), outview=None): errmsg) if int(errstat) != 0: - raise FortranError("".join(npbytes_to_str(errmsg)).strip()) + raise DiagnosticError("".join(npbytes_to_str(errmsg)).strip()) return result @@ -613,7 +613,7 @@ def _cape(p_hpa, tk, qv, ht, ter, sfp, missing, i3dflag, ter_follow, errmsg) if int(errstat) != 0: - raise FortranError("".join(npbytes_to_str(errmsg)).strip()) + raise DiagnosticError("".join(npbytes_to_str(errmsg)).strip()) return result @@ -681,7 +681,7 @@ def _lltoxy(map_proj, truelat1, truelat2, stdlon, errmsg) if int(errstat) != 0: - raise FortranError("".join(npbytes_to_str(errmsg)).strip()) + raise DiagnosticError("".join(npbytes_to_str(errmsg)).strip()) return result @@ -721,7 +721,7 @@ def _xytoll(map_proj, truelat1, truelat2, stdlon, lat1, lon1, errmsg) if int(errstat) != 0: - raise FortranError("".join(npbytes_to_str(errmsg)).strip()) + raise DiagnosticError("".join(npbytes_to_str(errmsg)).strip()) return result @@ -855,7 +855,7 @@ def _vintrp(field, pres, tk, qvp, ght, terrain, sfp, smsfp, errmsg) if int(errstat) != 0: - raise FortranError("".join(npbytes_to_str(errmsg)).strip()) + raise DiagnosticError("".join(npbytes_to_str(errmsg)).strip()) return result diff --git a/src/wrf/interp.py b/src/wrf/interp.py index 06ff1a1..4a92b76 100755 --- a/src/wrf/interp.py +++ b/src/wrf/interp.py @@ -104,7 +104,7 @@ def vertcross(field3d, vert, levels=None, missing=Constants.DEFAULT_FILL, The vertical levels for the cross section are fixed if *levels* is not specified, and are determined by dividing the vertical coordinate in to grid boxes of roughly 1% of the maximum vertical distance from top to - bottom. Otherwise, the *levels*argument can be used to specify specific + bottom. Otherwise, the *levels* argument can be used to specify specific vertical levels. If all vertical levels are desired, use the raw :meth:`wrf.interp2dxy` function. diff --git a/src/wrf/projection.py b/src/wrf/projection.py index 95e0502..ab286a9 100644 --- a/src/wrf/projection.py +++ b/src/wrf/projection.py @@ -105,13 +105,13 @@ class WrfProj(object): Attributes: - ll_lat (:obj:`float): Lower left corner latitude. + ll_lat (:obj:`float`): Lower left corner latitude. - ll_lat (:obj:`float): Lower left corner longitude. + ll_lat (:obj:`float`): Lower left corner longitude. - ur_lat (:obj:`float): Upper right corner latitude. + ur_lat (:obj:`float`): Upper right corner latitude. - ur_lon (:obj:`float): Upper right corner longitude. + ur_lon (:obj:`float`): Upper right corner longitude. bottom_left (indexable sequence): A pair of (ll_lat, ll_lon). diff --git a/src/wrf/util.py b/src/wrf/util.py index 8f3a7ac..ce4fa5e 100644 --- a/src/wrf/util.py +++ b/src/wrf/util.py @@ -293,11 +293,6 @@ class IterWrapper(Iterable): If the wrapped object is a custom type, then the :meth:`copy.copy` is called and a new instance is returned. In both cases, the original iterable object is unchanged. - - Args: - - wrapped (an iterable object): Any iterable object that contains the - *__iter__* method. Note: @@ -305,6 +300,14 @@ class IterWrapper(Iterable): """ def __init__(self, wrapped): + """Initialize an :class:`wrf.IterWrapper` object. + + Args: + + wrapped (an iterable object): Any iterable object that contains the + *__iter__* method. + + """ self._wrapped = wrapped def __iter__(self):