Browse Source

Fix issue with vinterp and heavily cropped datasets in the vertical. Added continuous integration tests for conda-forge. Changed some documentation wording.

main
Bill Ladwig 8 years ago
parent
commit
ee7ca7c3ad
  1. 25
      doc/source/new.rst
  2. 2
      fortran/wrf_vinterp.f90
  3. 4
      src/wrf/cape.py
  4. 2
      src/wrf/cloudfrac.py
  5. 2
      src/wrf/ctt.py
  6. 4
      src/wrf/dbz.py
  7. 4
      src/wrf/dewpoint.py
  8. 6
      src/wrf/geoht.py
  9. 4
      src/wrf/helicity.py
  10. 6
      src/wrf/interp.py
  11. 2
      src/wrf/interputils.py
  12. 8
      src/wrf/latlon.py
  13. 12
      src/wrf/latlonutils.py
  14. 10
      src/wrf/metadecorators.py
  15. 2
      src/wrf/omega.py
  16. 4
      src/wrf/pressure.py
  17. 2
      src/wrf/pw.py
  18. 4
      src/wrf/rh.py
  19. 2
      src/wrf/routines.py
  20. 2
      src/wrf/slp.py
  21. 14
      src/wrf/temp.py
  22. 2
      src/wrf/terrain.py
  23. 4
      src/wrf/times.py
  24. 42
      src/wrf/util.py
  25. 10
      src/wrf/uvmet.py
  26. 2
      src/wrf/version.py
  27. 4
      src/wrf/vorticity.py
  28. 10
      src/wrf/wind.py
  29. BIN
      test/ci_tests/ci_result_file.nc
  30. BIN
      test/ci_tests/ci_test_file.nc
  31. 174
      test/ci_tests/make_test_file.py
  32. 246
      test/ci_tests/utests.py

25
doc/source/new.rst

@ -1,6 +1,16 @@ @@ -1,6 +1,16 @@
What's New
===========
v1.0b3
----------
- Beta release 3.
- This is an internal release for conda-forge integration testing.
- Fixed an incorrectly initialized variable issue with vinterp. This issue
mainly impacts the unit tests for continuous integration testing with
conda-forge, since the data set used for these tests is heavily cropped.
v1.0b2
----------
@ -40,6 +50,21 @@ v1.0a3 @@ -40,6 +50,21 @@ v1.0a3
- Renamed some functions and arguments.
-------------
Known Issues
--------------
v1.0b3
^^^^^^^^^^^^^^^
- Currently unable to build on Windows with Python 3.5+ using open source
mingw compiler. The mingwpy project is working on resolving the
incompatibilities between mingw and Visual Studio 2015 that was used to
build Python 3.5+.
- Numpy distutils compiler options for win64 are hard-coded to turn
optimizations off. Will work on a patch before 1.0.0 is released, as
part of the v1.0b3 continuous integration changes.

2
fortran/wrf_vinterp.f90

@ -21,7 +21,7 @@ SUBROUTINE wrf_monotonic(out, in, lvprs, cor, idir, delta, ew, ns, nz, icorsw) @@ -21,7 +21,7 @@ SUBROUTINE wrf_monotonic(out, in, lvprs, cor, idir, delta, ew, ns, nz, icorsw)
INTEGER :: i, j, k, ripk, k300
k300 = 0 ! removes the warning
k300 = 1 ! removes the warning
DO j=1,ns
DO i=1,ew

4
src/wrf/cape.py

@ -29,7 +29,7 @@ def get_2dcape(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -29,7 +29,7 @@ def get_2dcape(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -145,7 +145,7 @@ def get_3dcape(wrfin, timeidx=0, method="cat", @@ -145,7 +145,7 @@ def get_3dcape(wrfin, timeidx=0, method="cat",
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

2
src/wrf/cloudfrac.py

@ -24,7 +24,7 @@ def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True, @@ -24,7 +24,7 @@ def get_cloudfrac(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

2
src/wrf/ctt.py

@ -28,7 +28,7 @@ def get_ctt(wrfin, timeidx=0, method="cat", @@ -28,7 +28,7 @@ def get_ctt(wrfin, timeidx=0, method="cat",
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

4
src/wrf/dbz.py

@ -24,7 +24,7 @@ def get_dbz(wrfin, timeidx=0, method="cat", @@ -24,7 +24,7 @@ def get_dbz(wrfin, timeidx=0, method="cat",
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -138,7 +138,7 @@ def get_max_dbz(wrfin, timeidx=0, method="cat", @@ -138,7 +138,7 @@ def get_max_dbz(wrfin, timeidx=0, method="cat",
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

4
src/wrf/dewpoint.py

@ -21,7 +21,7 @@ def get_dp(wrfin, timeidx=0, method="cat", squeeze=True, @@ -21,7 +21,7 @@ def get_dp(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -98,7 +98,7 @@ def get_dp_2m(wrfin, timeidx=0, method="cat", squeeze=True, @@ -98,7 +98,7 @@ def get_dp_2m(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

6
src/wrf/geoht.py

@ -24,7 +24,7 @@ def _get_geoht(wrfin, timeidx, method="cat", squeeze=True, @@ -24,7 +24,7 @@ def _get_geoht(wrfin, timeidx, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -123,7 +123,7 @@ def get_geopt(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -123,7 +123,7 @@ def get_geopt(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -188,7 +188,7 @@ def get_height(wrfin, timeidx=0, method="cat", squeeze=True, @@ -188,7 +188,7 @@ def get_height(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

4
src/wrf/helicity.py

@ -24,7 +24,7 @@ def get_srh(wrfin, timeidx=0, method="cat", squeeze=True, @@ -24,7 +24,7 @@ def get_srh(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -124,7 +124,7 @@ def get_uh(wrfin, timeidx=0, method="cat", squeeze=True, @@ -124,7 +124,7 @@ def get_uh(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

6
src/wrf/interp.py

@ -136,7 +136,7 @@ def vertcross(field3d, vert, levels=None, missing=Constants.DEFAULT_FILL, @@ -136,7 +136,7 @@ def vertcross(field3d, vert, levels=None, missing=Constants.DEFAULT_FILL,
Default is :data:`wrf.Constants.DEFAULT_FILL`.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. This is used
to obtain the map projection when using latitude,longitude
@ -300,7 +300,7 @@ def interpline(field2d, pivot_point=None, @@ -300,7 +300,7 @@ def interpline(field2d, pivot_point=None,
A two-dimensional field.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. This is used
to obtain the map projection when using latitude,longitude
@ -438,7 +438,7 @@ def vinterp(wrfin, field, vert_coord, interp_levels, extrapolate=False, @@ -438,7 +438,7 @@ def vinterp(wrfin, field, vert_coord, interp_levels, extrapolate=False,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`,\
or an iterable):
Input WRF ARW NetCDF data as a :class:`netCDF4.Dataset`,
WRF-ARW NetCDF data as a :class:`netCDF4.Dataset`,
:class:`Nio.NioFile` or an iterable sequence of the
aforementioned types.

2
src/wrf/interputils.py

@ -340,7 +340,7 @@ def to_xy_coords(pairs, wrfin=None, timeidx=0, stagger=None, projection=None): @@ -340,7 +340,7 @@ def to_xy_coords(pairs, wrfin=None, timeidx=0, stagger=None, projection=None):
a sequence of coordinate pairs to be converted.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. This is used
to obtain the map projection when using latitude,longitude

8
src/wrf/latlon.py

@ -17,7 +17,7 @@ def get_lat(wrfin, timeidx=0, method="cat", squeeze=True, @@ -17,7 +17,7 @@ def get_lat(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -90,7 +90,7 @@ def get_lon(wrfin, timeidx=0, method="cat", squeeze=True, @@ -90,7 +90,7 @@ def get_lon(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -170,7 +170,7 @@ def ll_to_xy(wrfin, latitude, longitude, timeidx=0, @@ -170,7 +170,7 @@ def ll_to_xy(wrfin, latitude, longitude, timeidx=0,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -336,7 +336,7 @@ def xy_to_ll(wrfin, x, y, timeidx=0, stagger=None, squeeze=True, meta=True): @@ -336,7 +336,7 @@ def xy_to_ll(wrfin, x, y, timeidx=0, stagger=None, squeeze=True, meta=True):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

12
src/wrf/latlonutils.py

@ -20,7 +20,7 @@ def _lat_varname(wrfin, stagger): @@ -20,7 +20,7 @@ def _lat_varname(wrfin, stagger):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -53,7 +53,7 @@ def _lon_varname(wrfin, stagger): @@ -53,7 +53,7 @@ def _lon_varname(wrfin, stagger):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -86,7 +86,7 @@ def _get_proj_params(wrfin, timeidx, stagger, method, squeeze, cache, _key): @@ -86,7 +86,7 @@ def _get_proj_params(wrfin, timeidx, stagger, method, squeeze, cache, _key):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -302,7 +302,7 @@ def _ll_to_xy(latitude, longitude, wrfin=None, timeidx=0, @@ -302,7 +302,7 @@ def _ll_to_xy(latitude, longitude, wrfin=None, timeidx=0,
of latitude values to be converted.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -456,7 +456,7 @@ def _xy_to_ll(x, y, wrfin=None, timeidx=0, stagger=None, @@ -456,7 +456,7 @@ def _xy_to_ll(x, y, wrfin=None, timeidx=0, stagger=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -467,7 +467,7 @@ def _xy_to_ll(x, y, wrfin=None, timeidx=0, stagger=None, @@ -467,7 +467,7 @@ def _xy_to_ll(x, y, wrfin=None, timeidx=0, stagger=None,
of y-coordinate values to be converted.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

10
src/wrf/metadecorators.py

@ -938,7 +938,7 @@ def _set_cross_meta(wrapped, instance, args, kwargs): @@ -938,7 +938,7 @@ def _set_cross_meta(wrapped, instance, args, kwargs):
del outcoords[key]
outdimnames.append("vertical")
outdimnames.append("idx")
outdimnames.append("cross_line_idx")
outattrs.update(field3d.attrs)
outname = "{0}_cross".format(field3d.name)
@ -961,7 +961,7 @@ def _set_cross_meta(wrapped, instance, args, kwargs): @@ -961,7 +961,7 @@ def _set_cross_meta(wrapped, instance, args, kwargs):
lats = _interpline(latcoord, xy)
lons = _interpline(loncoord, xy)
outcoords["xy_loc"] = ("idx",
outcoords["xy_loc"] = ("cross_line_idx",
np.asarray(tuple(
CoordPair(x=xy[i,0], y=xy[i,1],
lat=lats[i], lon=lons[i])
@ -986,16 +986,16 @@ def _set_cross_meta(wrapped, instance, args, kwargs): @@ -986,16 +986,16 @@ def _set_cross_meta(wrapped, instance, args, kwargs):
extra_dimnames = latcoord.dims[0:-2]
loc_dimnames = extra_dimnames + ("idx",)
loc_dimnames = extra_dimnames + ("cross_line_idx",)
outcoords["xy_loc"] = (loc_dimnames, latlon_loc)
else:
outcoords["xy_loc"] = ("idx", np.asarray(tuple(
outcoords["xy_loc"] = ("cross_line_idx", np.asarray(tuple(
CoordPair(xy[i,0], xy[i,1])
for i in py3range(xy.shape[-2]))))
else:
outcoords["xy_loc"] = ("idx", np.asarray(tuple(
outcoords["xy_loc"] = ("cross_line_idx", np.asarray(tuple(
CoordPair(xy[i,0], xy[i,1])
for i in py3range(xy.shape[-2]))))

2
src/wrf/omega.py

@ -21,7 +21,7 @@ def get_omega(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -21,7 +21,7 @@ def get_omega(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

4
src/wrf/pressure.py

@ -21,7 +21,7 @@ def get_pressure(wrfin, timeidx=0, method="cat", squeeze=True, @@ -21,7 +21,7 @@ def get_pressure(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -96,7 +96,7 @@ def get_pressure_hpa(wrfin, timeidx=0, method="cat", squeeze=True, @@ -96,7 +96,7 @@ def get_pressure_hpa(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

2
src/wrf/pw.py

@ -23,7 +23,7 @@ def get_pw(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -23,7 +23,7 @@ def get_pw(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

4
src/wrf/rh.py

@ -21,7 +21,7 @@ def get_rh(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -21,7 +21,7 @@ def get_rh(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -95,7 +95,7 @@ def get_rh_2m(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -95,7 +95,7 @@ def get_rh_2m(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

2
src/wrf/routines.py

@ -169,7 +169,7 @@ def getvar(wrfin, varname, timeidx=0, @@ -169,7 +169,7 @@ def getvar(wrfin, varname, timeidx=0,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

2
src/wrf/slp.py

@ -27,7 +27,7 @@ def get_slp(wrfin, timeidx=0, method="cat", squeeze=True, @@ -27,7 +27,7 @@ def get_slp(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

14
src/wrf/temp.py

@ -22,7 +22,7 @@ def get_theta(wrfin, timeidx=0, method="cat", squeeze=True, @@ -22,7 +22,7 @@ def get_theta(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -94,7 +94,7 @@ def get_temp(wrfin, timeidx=0, method="cat", squeeze=True, @@ -94,7 +94,7 @@ def get_temp(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -171,7 +171,7 @@ def get_eth(wrfin, timeidx=0, method="cat", squeeze=True, @@ -171,7 +171,7 @@ def get_eth(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -251,7 +251,7 @@ def get_tv(wrfin, timeidx=0, method="cat", squeeze=True, @@ -251,7 +251,7 @@ def get_tv(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -332,7 +332,7 @@ def get_tw(wrfin, timeidx=0, method="cat", squeeze=True, @@ -332,7 +332,7 @@ def get_tw(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -408,7 +408,7 @@ def get_tk(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -408,7 +408,7 @@ def get_tk(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -466,7 +466,7 @@ def get_tc(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -466,7 +466,7 @@ def get_tc(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

2
src/wrf/terrain.py

@ -20,7 +20,7 @@ def get_terrain(wrfin, timeidx=0, method="cat", squeeze=True, @@ -20,7 +20,7 @@ def get_terrain(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

4
src/wrf/times.py

@ -14,7 +14,7 @@ def get_times(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -14,7 +14,7 @@ def get_times(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -70,7 +70,7 @@ def get_xtimes(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -70,7 +70,7 @@ def get_xtimes(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

42
src/wrf/util.py

@ -119,7 +119,7 @@ def is_multi_file(wrfin): @@ -119,7 +119,7 @@ def is_multi_file(wrfin):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -141,7 +141,7 @@ def has_time_coord(wrfin): @@ -141,7 +141,7 @@ def has_time_coord(wrfin):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -160,7 +160,7 @@ def is_mapping(wrfin): @@ -160,7 +160,7 @@ def is_mapping(wrfin):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -439,7 +439,7 @@ class either(object): @@ -439,7 +439,7 @@ class either(object):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -672,7 +672,7 @@ def is_moving_domain(wrfin, varname=None, latvar=either("XLAT", "XLAT_M"), @@ -672,7 +672,7 @@ def is_moving_domain(wrfin, varname=None, latvar=either("XLAT", "XLAT_M"),
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -820,7 +820,7 @@ def extract_global_attrs(wrfin, attrs): @@ -820,7 +820,7 @@ def extract_global_attrs(wrfin, attrs):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -855,7 +855,7 @@ def extract_dim(wrfin, dim): @@ -855,7 +855,7 @@ def extract_dim(wrfin, dim):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -2211,7 +2211,7 @@ def _file_times(wrfin, do_xtime): @@ -2211,7 +2211,7 @@ def _file_times(wrfin, do_xtime):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -2243,7 +2243,7 @@ def _extract_time_map(wrfin, timeidx, do_xtime, meta=False): @@ -2243,7 +2243,7 @@ def _extract_time_map(wrfin, timeidx, do_xtime, meta=False):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -2281,7 +2281,7 @@ def extract_times(wrfin, timeidx, method="cat", squeeze=True, cache=None, @@ -2281,7 +2281,7 @@ def extract_times(wrfin, timeidx, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -2388,7 +2388,7 @@ def is_standard_wrf_var(wrfin, varname): @@ -2388,7 +2388,7 @@ def is_standard_wrf_var(wrfin, varname):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -2417,7 +2417,7 @@ def is_staggered(wrfin, var): @@ -2417,7 +2417,7 @@ def is_staggered(wrfin, var):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -2529,7 +2529,7 @@ def get_proj_params(wrfin):#, timeidx=0, varname=None): @@ -2529,7 +2529,7 @@ def get_proj_params(wrfin):#, timeidx=0, varname=None):
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -2915,7 +2915,7 @@ def geo_bounds(var=None, wrfin=None, varname=None, timeidx=0, method="cat", @@ -2915,7 +2915,7 @@ def geo_bounds(var=None, wrfin=None, varname=None, timeidx=0, method="cat",
If not used, then *wrfin* must be provided.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. If not used,
then *var* must be provided.
@ -3040,7 +3040,7 @@ def _get_wrf_proj_geobnds(var, wrfin, varname, timeidx, method, squeeze, @@ -3040,7 +3040,7 @@ def _get_wrf_proj_geobnds(var, wrfin, varname, timeidx, method, squeeze,
If not used, then *wrfin* must be provided.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. If not used,
then *var* must be provided.
@ -3109,7 +3109,7 @@ def _get_proj_obj(ob_type, var, wrfin, varname, timeidx, method, squeeze, @@ -3109,7 +3109,7 @@ def _get_proj_obj(ob_type, var, wrfin, varname, timeidx, method, squeeze,
If not used, then *wrfin* must be provided.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. If not used,
then *var* must be provided.
@ -3245,7 +3245,7 @@ def get_cartopy(var=None, wrfin=None, varname=None, timeidx=0, method="cat", @@ -3245,7 +3245,7 @@ def get_cartopy(var=None, wrfin=None, varname=None, timeidx=0, method="cat",
file, then the geobounds will be taken from the native grid.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. If not used,
then *var* must be provided.
@ -3313,7 +3313,7 @@ def get_basemap(var=None, wrfin=None, varname=None, timeidx=0, method="cat", @@ -3313,7 +3313,7 @@ def get_basemap(var=None, wrfin=None, varname=None, timeidx=0, method="cat",
file, then the geobounds will be taken from the native grid.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. If not used,
then *var* must be provided.
@ -3391,7 +3391,7 @@ def get_pyngl(var=None, wrfin=None, varname=None, timeidx=0, method="cat", @@ -3391,7 +3391,7 @@ def get_pyngl(var=None, wrfin=None, varname=None, timeidx=0, method="cat",
file, then the geobounds will be taken from the native grid.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. If not used,
then *var* must be provided.
@ -3479,7 +3479,7 @@ def cartopy_xlim(var=None, geobounds=None, wrfin=None, varname=None, timeidx=0, @@ -3479,7 +3479,7 @@ def cartopy_xlim(var=None, geobounds=None, wrfin=None, varname=None, timeidx=0,
file, then the geobounds will be taken from the native grid.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. If not used,
then *var* must be provided.
@ -3565,7 +3565,7 @@ def cartopy_ylim(var=None, geobounds=None, wrfin=None, varname=None, timeidx=0, @@ -3565,7 +3565,7 @@ def cartopy_ylim(var=None, geobounds=None, wrfin=None, varname=None, timeidx=0,
file, then the geobounds will be taken from the native grid.
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable, optional): Input WRF ARW NetCDF
iterable, optional): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types. If not used,
then *var* must be provided.

10
src/wrf/uvmet.py

@ -33,7 +33,7 @@ def _get_uvmet(wrfin, timeidx=0, method="cat", squeeze=True, @@ -33,7 +33,7 @@ def _get_uvmet(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -215,7 +215,7 @@ def get_uvmet(wrfin, timeidx=0, method="cat", squeeze=True, @@ -215,7 +215,7 @@ def get_uvmet(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -293,7 +293,7 @@ def get_uvmet10(wrfin, timeidx=0, method="cat", squeeze=True, @@ -293,7 +293,7 @@ def get_uvmet10(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -374,7 +374,7 @@ def get_uvmet_wspd_wdir(wrfin, timeidx=0, method="cat", squeeze=True, @@ -374,7 +374,7 @@ def get_uvmet_wspd_wdir(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -457,7 +457,7 @@ def get_uvmet10_wspd_wdir(wrfin, timeidx=0, method="cat", squeeze=True, @@ -457,7 +457,7 @@ def get_uvmet10_wspd_wdir(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

2
src/wrf/version.py

@ -1,2 +1,2 @@ @@ -1,2 +1,2 @@
__version__ = "1.0b2"
__version__ = "1.0b3"

4
src/wrf/vorticity.py

@ -19,7 +19,7 @@ def get_avo(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -19,7 +19,7 @@ def get_avo(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -96,7 +96,7 @@ def get_pvo(wrfin, timeidx=0, method="cat", squeeze=True, cache=None, @@ -96,7 +96,7 @@ def get_pvo(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

10
src/wrf/wind.py

@ -117,7 +117,7 @@ def get_u_destag(wrfin, timeidx=0, method="cat", squeeze=True, @@ -117,7 +117,7 @@ def get_u_destag(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -189,7 +189,7 @@ def get_v_destag(wrfin, timeidx=0, method="cat", squeeze=True, @@ -189,7 +189,7 @@ def get_v_destag(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -261,7 +261,7 @@ def get_w_destag(wrfin, timeidx=0, method="cat", squeeze=True, @@ -261,7 +261,7 @@ def get_w_destag(wrfin, timeidx=0, method="cat", squeeze=True,
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -344,7 +344,7 @@ def get_destag_wspd_wdir(wrfin, timeidx=0, method="cat", @@ -344,7 +344,7 @@ def get_destag_wspd_wdir(wrfin, timeidx=0, method="cat",
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.
@ -435,7 +435,7 @@ def get_destag_wspd_wdir10(wrfin, timeidx=0, method="cat", @@ -435,7 +435,7 @@ def get_destag_wspd_wdir10(wrfin, timeidx=0, method="cat",
Args:
wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
iterable): Input WRF ARW NetCDF
iterable): WRF-ARW NetCDF
data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
or an iterable sequence of the aforementioned types.

BIN
test/ci_tests/ci_result_file.nc

Binary file not shown.

BIN
test/ci_tests/ci_test_file.nc

Binary file not shown.

174
test/ci_tests/make_test_file.py

@ -0,0 +1,174 @@ @@ -0,0 +1,174 @@
from __future__ import print_function, division
import os
import argparse
import numpy as np
from netCDF4 import Dataset
from wrf import (getvar, interplevel, interpline, vertcross, vinterp, py2round,
CoordPair, ll_to_xy, xy_to_ll)
VARS_TO_KEEP = ("XLAT", "XLONG", "XLAT_U", "XLAT_V", "XLONG_U", "XLONG_V",
"U", "V", "W", "PH", "PHB", "T", "P", "PB", "Q2", "T2",
"PSFC", "U10", "V10", "XTIME", "QVAPOR", "QCLOUD",
"QGRAUP", "QRAIN", "QSNOW", "MAPFAC_M", "MAPFAC_U",
"MAPFAC_V", "F", "HGT", "RAINC", "RAINSH", "RAINNC")
DIMS_TO_TRIM = ("west_east", "south_north", "bottom_top", "bottom_top_stag",
"west_east_stag", "south_north_stag")
WRF_DIAGS = ["avo", "eth", "cape_2d", "cape_3d", "ctt", "dbz", "mdbz",
"geopt", "helicity", "lat", "lon", "omg", "p", "pressure",
"pvo", "pw", "rh2", "rh", "slp", "ter", "td2", "td", "tc",
"theta", "tk", "tv", "twb", "updraft_helicity", "ua", "va",
"wa", "uvmet10", "uvmet", "z", "cfrac"]
INTERP_METHS = ["interplevel", "vertcross", "interpline", "vinterp"]
LATLON_METHS = ["xy", "ll"]
def copy_and_reduce(opts):
infilename = opts.filename
outfilename = os.path.expanduser(
os.path.join(opts.outdir, "ci_test_file.nc"))
with Dataset(infilename) as infile, Dataset(outfilename, "w") as outfile:
# Copy the global attributes
outfile.setncatts(infile.__dict__)
# Copy Dimensions
for name, dimension in infile.dimensions.iteritems():
if name in DIMS_TO_TRIM:
if name.find("_stag") > 0:
dimsize = (len(dimension) / 2
if len(dimension) % 2 == 0
else (len(dimension) + 1) / 2)
else:
dimsize = (len(dimension) / 2
if len(dimension) % 2 == 0
else (len(dimension) - 1) / 2)
else:
dimsize = len(dimension)
outfile.createDimension(name, dimsize)
# Copy Variables
for name, variable in infile.variables.iteritems():
if name not in VARS_TO_KEEP:
continue
outvar = outfile.createVariable(name, variable.datatype,
variable.dimensions, zlib=True)
in_slices = tuple(slice(0, dimsize) for dimsize in outvar.shape)
outvar[:] = variable[in_slices]
outvar.setncatts(infile.variables[name].__dict__)
def add_to_ncfile(outfile, var, varname):
dim_d = dict(zip(var.dims, var.shape))
for dimname, dimsize in dim_d.items():
if dimname not in outfile.dimensions:
outfile.createDimension(dimname, dimsize)
fill_value = None
if "_FillValue" in var.attrs:
fill_value = var.attrs["_FillValue"]
ncvar = outfile.createVariable(varname, var.dtype, var.dims,
zlib=True, fill_value=fill_value)
ncvar[:] = var[:]
def make_result_file(opts):
infilename = os.path.expanduser(
os.path.join(opts.outdir, "ci_test_file.nc"))
outfilename = os.path.expanduser(
os.path.join(opts.outdir, "ci_result_file.nc"))
with Dataset(infilename) as infile, Dataset(outfilename, "w") as outfile:
for varname in WRF_DIAGS:
var = getvar(infile, varname)
add_to_ncfile(outfile, var, varname)
for interptype in INTERP_METHS:
if interptype == "interpline":
hts = getvar(infile, "z")
p = getvar(infile, "pressure")
hts_850 = interplevel(hts, p, 850.)
add_to_ncfile(outfile, hts_850, "interplevel")
if interptype == "vertcross":
hts = getvar(infile, "z")
p = getvar(infile, "pressure")
pivot_point = CoordPair(hts.shape[-1] // 2, hts.shape[-2] // 2)
ht_cross = vertcross(hts, p, pivot_point=pivot_point,
angle=90.)
add_to_ncfile(outfile, ht_cross, "vertcross")
if interptype == "interpline":
t2 = getvar(infile, "T2")
pivot_point = CoordPair(t2.shape[-1] // 2, t2.shape[-2] // 2)
t2_line = interpline(t2, pivot_point=pivot_point, angle=90.0)
add_to_ncfile(outfile, t2_line, "interpline")
if interptype == "vinterp":
tk = getvar(infile, "temp", units="k")
interp_levels = [200,300,500,1000]
field = vinterp(infile,
field=tk,
vert_coord="theta",
interp_levels=interp_levels,
extrapolate=True,
field_type="tk",
log_p=True)
add_to_ncfile(outfile, field, "vinterp")
for latlonmeth in LATLON_METHS:
if latlonmeth == "xy":
# Hardcoded values from other unit tests
lats = [-55, -60, -65]
lons = [25, 30, 35]
xy = ll_to_xy(infile, lats[0], lons[0])
add_to_ncfile(outfile, xy, "xy")
else:
# Hardcoded from other unit tests
i_s = np.asarray([10, 100, 150], int) - 1
j_s = np.asarray([10, 100, 150], int) - 1
ll = xy_to_ll(infile, i_s[0], j_s[0])
add_to_ncfile(outfile, ll, "ll")
def main(opts):
copy_and_reduce(opts)
make_result_file(opts)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate conda test files "
"for unit testing.")
parser.add_argument("-f", "--filename", required=True,
help="the WRF test file")
parser.add_argument("-o", "--outdir", required=True,
help="the location for the output files")
opts = parser.parse_args()
main(opts)

246
test/ci_tests/utests.py

@ -0,0 +1,246 @@ @@ -0,0 +1,246 @@
import unittest as ut
import numpy.testing as nt
import numpy as np
import numpy.ma as ma
import os, sys
import subprocess
from wrf import (getvar, interplevel, interpline, vertcross, vinterp,
disable_xarray, xarray_enabled, to_np,
xy_to_ll, ll_to_xy, xy_to_ll_proj, ll_to_xy_proj,
extract_global_attrs, viewitems, CoordPair)
from wrf.util import is_multi_file
TEST_FILE = "ci_test_file.nc"
REF_FILE = "ci_result_file.nc"
# Python 3
if sys.version_info > (3,):
xrange = range
# Using helpful information at:
# http://eli.thegreenplace.net/2014/04/02/dynamically-generating-python-test-cases
def make_test(varname, wrf_in, referent, multi=False, repeat=3, pynio=False):
def test(self):
from netCDF4 import Dataset as NetCDF
timeidx = 0
in_wrfnc = NetCDF(wrf_in)
refnc = NetCDF(referent)
# These have a left index that defines the product type
multiproduct = varname in ("uvmet", "uvmet10", "cape_2d", "cape_3d",
"cfrac")
ref_vals = refnc.variables[varname][:]
if (varname == "tc"):
my_vals = getvar(in_wrfnc, "temp", timeidx=timeidx, units="c")
tol = 1/100.
atol = .1 # Note: NCL uses 273.16 as conversion for some reason
nt.assert_allclose(to_np(my_vals), ref_vals, tol, atol)
elif (varname == "pw"):
my_vals = getvar(in_wrfnc, "pw", timeidx=timeidx)
tol = .5/100.0
atol = 0 # NCL uses different constants and doesn't use same
# handrolled virtual temp in method
nt.assert_allclose(to_np(my_vals), ref_vals, tol, atol)
elif (varname == "cape_2d"):
cape_2d = getvar(in_wrfnc, varname, timeidx=timeidx)
tol = 0/100.
atol = 200.0
# Let's only compare CAPE values until the F90 changes are
# merged back in to NCL. The modifications to the R and CP
# changes TK enough that non-lifting parcels could lift, thus
# causing wildly different values in LCL
nt.assert_allclose(to_np(cape_2d[0,:]), ref_vals[0,:], tol, atol)
elif (varname == "cape_3d"):
cape_3d = getvar(in_wrfnc, varname, timeidx=timeidx)
# Changing the R and CP constants, while keeping TK within
# 2%, can lead to some big changes in CAPE. Tolerances
# have been set wide when comparing the with the original
# NCL. Change back when the F90 code is merged back with
# NCL
tol = 0/100.
atol = 200.0
#print np.amax(np.abs(to_np(cape_3d[0,:]) - ref_vals[0,:]))
nt.assert_allclose(to_np(cape_3d), ref_vals, tol, atol)
else:
my_vals = getvar(in_wrfnc, varname, timeidx=timeidx)
tol = 2/100.
atol = 0.1
#print (np.amax(np.abs(to_np(my_vals) - ref_vals)))
nt.assert_allclose(to_np(my_vals), ref_vals, tol, atol)
return test
def _get_refvals(referent, varname, repeat, multi):
from netCDF4 import Dataset as NetCDF
refnc = NetCDF(referent)
ref_vals = refnc.variables[varname][:]
return ref_vals
def make_interp_test(varname, wrf_in, referent, multi=False,
repeat=3, pynio=False):
def test(self):
from netCDF4 import Dataset as NetCDF
timeidx = 0
in_wrfnc = NetCDF(wrf_in)
if (varname == "interplevel"):
ref_ht_850 = _get_refvals(referent, "interplevel", repeat, multi)
hts = getvar(in_wrfnc, "z", timeidx=timeidx)
p = getvar(in_wrfnc, "pressure", timeidx=timeidx)
hts_850 = interplevel(hts, p, 850)
nt.assert_allclose(to_np(hts_850), ref_ht_850)
elif (varname == "vertcross"):
ref_ht_cross = _get_refvals(referent, "vertcross", repeat, multi)
hts = getvar(in_wrfnc, "z", timeidx=timeidx)
p = getvar(in_wrfnc, "pressure", timeidx=timeidx)
pivot_point = CoordPair(hts.shape[-1] // 2, hts.shape[-2] // 2)
ht_cross = vertcross(hts, p, pivot_point=pivot_point, angle=90.)
nt.assert_allclose(to_np(ht_cross), ref_ht_cross, rtol=.01)
elif (varname == "interpline"):
ref_t2_line = _get_refvals(referent, "interpline", repeat, multi)
t2 = getvar(in_wrfnc, "T2", timeidx=timeidx)
pivot_point = CoordPair(t2.shape[-1] // 2, t2.shape[-2] // 2)
t2_line1 = interpline(t2, pivot_point=pivot_point, angle=90.0)
nt.assert_allclose(to_np(t2_line1), ref_t2_line)
elif (varname == "vinterp"):
# Tk to theta
fld_tk_theta = _get_refvals(referent, "vinterp", repeat, multi)
fld_tk_theta = np.squeeze(fld_tk_theta)
tk = getvar(in_wrfnc, "temp", timeidx=timeidx, units="k")
interp_levels = [200,300,500,1000]
field = vinterp(in_wrfnc,
field=tk,
vert_coord="theta",
interp_levels=interp_levels,
extrapolate=True,
field_type="tk",
timeidx=timeidx,
log_p=True)
tol = 5/100.
atol = 0.0001
field = np.squeeze(field)
nt.assert_allclose(to_np(field), fld_tk_theta, tol, atol)
return test
def make_latlon_test(testid, wrf_in, referent, single, multi=False, repeat=3,
pynio=False):
def test(self):
from netCDF4 import Dataset as NetCDF
timeidx = 0
in_wrfnc = NetCDF(wrf_in)
refnc = NetCDF(referent)
if testid == "xy":
# Since this domain is not moving, the reference values are the
# same whether there are multiple or single files
ref_vals = refnc.variables["xy"][:]
# Lats/Lons taken from NCL script, just hard-coding for now
lats = [-55, -60, -65]
lons = [25, 30, 35]
xy = ll_to_xy(in_wrfnc, lats[0], lons[0])
nt.assert_allclose(to_np(xy), ref_vals)
else:
# Since this domain is not moving, the reference values are the
# same whether there are multiple or single files
ref_vals = refnc.variables["ll"][:]
# i_s, j_s taken from NCL script, just hard-coding for now
# NCL uses 1-based indexing for this, so need to subtract 1
i_s = np.asarray([10, 100, 150], int) - 1
j_s = np.asarray([10, 100, 150], int) - 1
ll = xy_to_ll(in_wrfnc, i_s[0], j_s[0])
nt.assert_allclose(to_np(ll), ref_vals)
return test
class WRFVarsTest(ut.TestCase):
longMessage = True
class WRFInterpTest(ut.TestCase):
longMessage = True
class WRFLatLonTest(ut.TestCase):
longMessage = True
if __name__ == "__main__":
ignore_vars = [] # Not testable yet
wrf_vars = ["avo", "eth", "cape_2d", "cape_3d", "ctt", "dbz", "mdbz",
"geopt", "helicity", "lat", "lon", "omg", "p", "pressure",
"pvo", "pw", "rh2", "rh", "slp", "ter", "td2", "td", "tc",
"theta", "tk", "tv", "twb", "updraft_helicity", "ua", "va",
"wa", "uvmet10", "uvmet", "z", "cfrac"]
interp_methods = ["interplevel", "vertcross", "interpline", "vinterp"]
latlon_tests = ["xy", "ll"]
import netCDF4
for var in wrf_vars:
if var in ignore_vars:
continue
test_func1 = make_test(var, TEST_FILE, REF_FILE)
setattr(WRFVarsTest, 'test_{0}'.format(var), test_func1)
for method in interp_methods:
test_interp_func1 = make_interp_test(method, TEST_FILE,
REF_FILE)
setattr(WRFInterpTest, 'test_{0}'.format(method),
test_interp_func1)
for testid in latlon_tests:
for single in (True,):
for multi in (False,):
test_ll_func = make_latlon_test(testid, TEST_FILE,
REF_FILE,
single=single, multi=multi,
repeat=3, pynio=False)
multistr = "" if not multi else "_multi"
singlestr = "_nosingle" if not single else "_single"
test_name = "test_{}{}{}".format(testid, singlestr,
multistr)
setattr(WRFLatLonTest, test_name, test_ll_func)
ut.main()
Loading…
Cancel
Save