Browse Source

Merge tag '1.0.0' into develop

Official release 1.0.0
lon0
Bill Ladwig 8 years ago
parent
commit
39bae1a227
  1. 21
      doc/source/new.rst
  2. 53
      doc/source/plot.rst
  3. 34
      src/wrf/computation.py
  4. 4
      src/wrf/extension.py
  5. 23
      src/wrf/metadecorators.py
  6. 100
      src/wrf/specialdec.py
  7. 59
      test/comp_utest.py
  8. 288
      test/ipynb/Doc_Examples.ipynb
  9. 280
      test/ipynb/WRF_python_demo.ipynb
  10. 85
      test/ipynb/nocopy_test.ipynb

21
doc/source/new.rst

@ -1,6 +1,23 @@ @@ -1,6 +1,23 @@
What's New
===========
Releases
-------------
v1.0.0
^^^^^^^^^^^^^
- Release 1.0.0.
- Fixed issue with not being able to set the thread-local coordinate cache to
0 to disable it. Also, the cache will now correctly resize itself when
the size is reduced to less than its current setting.
- Fixed an issue with the '0000-00-00 00:00:00' time used in geo_em files
causing crashes due to the invalid time. The time is now set to
numpy.datetime64('NaT').
- Fixed issue with wrf.cape_3d not working correctly with a single
column of data.
Beta Releases
--------------
@ -67,8 +84,8 @@ v1.0a3 @@ -67,8 +84,8 @@ v1.0a3
Known Issues
--------------
v1.0b3
^^^^^^^^^^^^^^^
v1.0.0
^^^^^^^^
- Currently unable to build on Windows with Python 3.5+ using open source
mingw compiler. The mingwpy project is working on resolving the

53
doc/source/plot.rst

@ -69,8 +69,10 @@ Plotting a Two-dimensional Field @@ -69,8 +69,10 @@ Plotting a Two-dimensional Field
ax.coastlines('50m', linewidth=0.8)
# Make the contour outlines and filled contours for the smoothed sea level pressure.
plt.contour(to_np(lons), to_np(lats), to_np(smooth_slp), 10, colors="black", transform=crs.PlateCarree())
plt.contourf(to_np(lons), to_np(lats), to_np(smooth_slp), 10, transform=crs.PlateCarree(), cmap=get_cmap("jet"))
plt.contour(to_np(lons), to_np(lats), to_np(smooth_slp), 10, colors="black",
transform=crs.PlateCarree())
plt.contourf(to_np(lons), to_np(lats), to_np(smooth_slp), 10, transform=crs.PlateCarree(),
cmap=get_cmap("jet"))
# Add a color bar
plt.colorbar(ax=ax, shrink=.62)
@ -86,6 +88,7 @@ Plotting a Two-dimensional Field @@ -86,6 +88,7 @@ Plotting a Two-dimensional Field
plt.show()
Horizontal Interpolation to a Pressure Level
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -194,8 +197,8 @@ plot, see :ref:`cross_example`. @@ -194,8 +197,8 @@ plot, see :ref:`cross_example`.
slp = getvar(ncfile, "slp")
smooth_slp = smooth2d(slp, 3)
ctt = getvar(ncfile, "ctt")
z = getvar(ncfile, "z", timeidx=0)
dbz = getvar(ncfile, "dbz", timeidx=0)
z = getvar(ncfile, "z")
dbz = getvar(ncfile, "dbz")
Z = 10**(dbz/10.)
wspd = getvar(ncfile, "wspd_wdir", units="kt")[0,:]
@ -203,10 +206,12 @@ plot, see :ref:`cross_example`. @@ -203,10 +206,12 @@ plot, see :ref:`cross_example`.
start_point = CoordPair(lat=26.76, lon=-80.0)
end_point = CoordPair(lat=26.76, lon=-77.8)
# Compute the vertical cross-section interpolation. Also, include the lat/lon points along the cross-section
# in the metadata by setting latlon to True.
z_cross = vertcross(Z, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True)
wspd_cross = vertcross(wspd, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True)
# Compute the vertical cross-section interpolation. Also, include the lat/lon
# points along the cross-section in the metadata by setting latlon to True.
z_cross = vertcross(Z, z, wrfin=ncfile, start_point=start_point, end_point=end_point,
latlon=True, meta=True)
wspd_cross = vertcross(wspd, z, wrfin=ncfile, start_point=start_point, end_point=end_point,
latlon=True, meta=True)
dbz_cross = 10.0 * np.log10(z_cross)
# Get the lat/lon points
@ -236,11 +241,11 @@ plot, see :ref:`cross_example`. @@ -236,11 +241,11 @@ plot, see :ref:`cross_example`.
# Create the filled cloud top temperature contours
contour_levels = [-80.0, -70.0, -60, -50, -40, -30, -20, -10, 0, 10]
ctt_contours = ax_ctt.contourf(to_np(lons), to_np(lats), to_np(ctt), contour_levels, cmap=get_cmap("Greys"),
transform=crs.PlateCarree(), zorder=2)
ctt_contours = ax_ctt.contourf(to_np(lons), to_np(lats), to_np(ctt), contour_levels,
cmap=get_cmap("Greys"), transform=crs.PlateCarree(), zorder=2)
ax_ctt.plot([start_point.lon, end_point.lon], [start_point.lat, end_point.lat], color="yellow",
marker="o", transform=crs.PlateCarree(), zorder=3)
ax_ctt.plot([start_point.lon, end_point.lon], [start_point.lat, end_point.lat],
color="yellow", marker="o", transform=crs.PlateCarree(), zorder=3)
# Create the color bar for cloud top temperature
cb_ctt = fig.colorbar(ctt_contours, ax=ax_ctt, shrink=.60)
@ -299,6 +304,7 @@ plot, see :ref:`cross_example`. @@ -299,6 +304,7 @@ plot, see :ref:`cross_example`.
plt.show()
Matplotlib with Basemap
-----------------------
@ -306,8 +312,7 @@ Although basemap is in maintenance mode only and becoming deprecated, it is stil @@ -306,8 +312,7 @@ Although basemap is in maintenance mode only and becoming deprecated, it is stil
widely used by many programmers. Cartopy is becoming the preferred package for
mapping, however it suffers from growing pains in some areas
(can't use latitude/longitude labels for many map projections). If you
run in to these issues, basemap is likely to accomplish what you need, despite
slower performance.
run in to these issues, basemap is likely to accomplish what you need.
Plotting a Two-Dimensional Field
@ -462,8 +467,8 @@ plot, see :ref:`cross_example`. @@ -462,8 +467,8 @@ plot, see :ref:`cross_example`.
slp = getvar(ncfile, "slp")
smooth_slp = smooth2d(slp, 3)
ctt = getvar(ncfile, "ctt")
z = getvar(ncfile, "z", timeidx=0)
dbz = getvar(ncfile, "dbz", timeidx=0)
z = getvar(ncfile, "z")
dbz = getvar(ncfile, "dbz")
Z = 10**(dbz/10.)
wspd = getvar(ncfile, "wspd_wdir", units="kt")[0,:]
@ -471,10 +476,12 @@ plot, see :ref:`cross_example`. @@ -471,10 +476,12 @@ plot, see :ref:`cross_example`.
start_point = CoordPair(lat=26.76, lon=-80.0)
end_point = CoordPair(lat=26.76, lon=-77.8)
# Compute the vertical cross-section interpolation. Also, include the lat/lon points along the cross-section in
# the metadata by setting latlon to True.
z_cross = vertcross(Z, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True)
wspd_cross = vertcross(wspd, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True)
# Compute the vertical cross-section interpolation. Also, include the lat/lon points
# along the cross-section in the metadata by setting latlon to True.
z_cross = vertcross(Z, z, wrfin=ncfile, start_point=start_point, end_point=end_point,
latlon=True, meta=True)
wspd_cross = vertcross(wspd, z, wrfin=ncfile, start_point=start_point, end_point=end_point,
latlon=True, meta=True)
dbz_cross = 10.0 * np.log10(z_cross)
# Get the latitude and longitude points
@ -609,8 +616,10 @@ plotted using the standard matplotlib API. @@ -609,8 +616,10 @@ plotted using the standard matplotlib API.
start_point = CoordPair(lat=26.76, lon=-80.0)
end_point = CoordPair(lat=26.76, lon=-77.8)
# Compute the vertical cross-section interpolation. Also, include the lat/lon points along the cross-section.
wspd_cross = vertcross(wspd, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True)
# Compute the vertical cross-section interpolation. Also, include the lat/lon
# points along the cross-section.
wspd_cross = vertcross(wspd, z, wrfin=ncfile, start_point=start_point, end_point=end_point,
latlon=True, meta=True)
# Create the figure
fig = plt.figure(figsize=(12,6))

34
src/wrf/computation.py

@ -859,6 +859,11 @@ def cape_3d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow, @@ -859,6 +859,11 @@ def cape_3d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow,
- return_val[0,...] will contain CAPE [J kg-1]
- return_val[1,...] will contain CIN [J kg-1]
This function also supports computing CAPE along a single vertical
column. In this mode, the *pres_hpa*, *tkel*, *qv* and *height* arguments
must be one-dimensional vertical columns, and the *terrain* and
*psfc_hpa* arguments must be scalar values
(:obj:`float`, :class:`numpy.float32` or :class:`numpy.float64`).
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
@ -868,9 +873,12 @@ def cape_3d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow, @@ -868,9 +873,12 @@ def cape_3d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow,
pres_hpa (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Full
pressure (perturbation + base state pressure) in [hPa] with at
least three dimensions. The rightmost dimensions can be
top_bottom x south_north x west_east or bottom_top x south_north x
west_east.
least three dimensions when operating on a grid of values. The
rightmost dimensions can be top_bottom x south_north x west_east
or bottom_top x south_north x west_east.
When operating on only a single column of values, the vertical
column can be bottom_top or top_bottom. In this case, *terrain*
and *psfc_hpa* must be scalars.
Note:
@ -893,15 +901,21 @@ def cape_3d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow, @@ -893,15 +901,21 @@ def cape_3d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow,
Geopotential height in [m] with the same dimensionality as
*pres_hpa*.
terrain (:class:`xarray.DataArray` or :class:`numpy.ndarray`):
Terrain height in [m]. This is at least a two-dimensional array
terrain (:class:`xarray.DataArray`, :class:`numpy.ndarray`, \
or a scalar): Terrain height in [m]. When operating on a grid of
values, this argument is at least a two-dimensional array
with the same dimensionality as *pres_hpa*, excluding the vertical
(bottom_top/top_bottom) dimension.
(bottom_top/top_bottom) dimension. When operating on a single
vertical column, this argument must be a scalar (:obj:`float`,
:class:`numpy.float32`, or :class:`numpy.float64`).
psfc_hpa (:class:`xarray.DataArray` or :class:`numpy.ndarray`):
The surface pressure in [hPa]. This is at least a two-dimensional
array with the same dimensionality as *pres_hpa*, excluding the
vertical (bottom_top/top_bottom) dimension.
psfc_hpa (:class:`xarray.DataArray`, :class:`numpy.ndarray`, \
or a scalar): Surface pressure in [hPa]. When operating on a
grid of values, this argument is at least a two-dimensional array
with the same dimensionality as *pres_hpa*, excluding the vertical
(bottom_top/top_bottom) dimension. When operating on a single
vertical column, this argument must be a scalar (:obj:`float`,
:class:`numpy.float32`, or :class:`numpy.float64`).
Note:

4
src/wrf/extension.py

@ -18,7 +18,7 @@ from .decorators import (left_iteration, cast_type, @@ -18,7 +18,7 @@ from .decorators import (left_iteration, cast_type,
from .util import combine_dims, npbytes_to_str, psafilepath
from .py3compat import py3range
from .specialdec import (uvmet_left_iter, cape_left_iter,
cloudfrac_left_iter)
cloudfrac_left_iter, check_cape_args)
class DiagnosticError(Exception):
"""Raised when an error occurs in a diagnostic routine."""
@ -576,7 +576,7 @@ def _dbz(p, tk, qv, qr, qs, qg, sn0, ivarint, iliqskin, outview=None): @@ -576,7 +576,7 @@ def _dbz(p, tk, qv, qr, qs, qg, sn0, ivarint, iliqskin, outview=None):
return result
@check_args(0, 3, (3,3,3,3,2,2))
@check_cape_args()
@cape_left_iter()
@cast_type(arg_idxs=(0,1,2,3,4,5), outviews=("capeview", "cinview"))
@extract_and_transpose(outviews=("capeview", "cinview"))

23
src/wrf/metadecorators.py

@ -1924,6 +1924,17 @@ def set_cape_alg_metadata(is2d, copyarg="pres_hpa"): @@ -1924,6 +1924,17 @@ def set_cape_alg_metadata(is2d, copyarg="pres_hpa"):
result = wrapped(*args, **kwargs)
argvals = from_args(wrapped, (copyarg,"missing"), *args, **kwargs)
p = argvals[copyarg]
missing = argvals["missing"]
# Note: cape_3d supports using only a single column of data
is1d = p.ndim == 1
# Need to squeeze the right dimensions for 1D cape
if is1d:
result = np.squeeze(result)
# Default dimension names
outdims = ["dim_{}".format(i) for i in py3range(result.ndim)]
@ -1935,14 +1946,17 @@ def set_cape_alg_metadata(is2d, copyarg="pres_hpa"): @@ -1935,14 +1946,17 @@ def set_cape_alg_metadata(is2d, copyarg="pres_hpa"):
outattrs["units"] = "J kg-1 ; J kg-1 ; m ; m"
outattrs["MemoryOrder"] = "XY"
else:
if not is1d:
outname = "cape_3d"
outattrs["description"] = "cape; cin"
outattrs["units"] = "J kg-1 ; J kg-1"
outattrs["MemoryOrder"] = "XYZ"
else:
outname = "cape_column"
outattrs["description"] = "cape; cin"
outattrs["units"] = "J kg-1 ; J kg-1"
outattrs["MemoryOrder"] = "Z"
argvals = from_args(wrapped, (copyarg,"missing"), *args, **kwargs)
p = argvals[copyarg]
missing = argvals["missing"]
if isinstance(p, DataArray):
if is2d:
@ -1952,10 +1966,13 @@ def set_cape_alg_metadata(is2d, copyarg="pres_hpa"): @@ -1952,10 +1966,13 @@ def set_cape_alg_metadata(is2d, copyarg="pres_hpa"):
outdims[1:-2] = p.dims[0:-3]
else:
if not is1d:
# Right dims
outdims[-3:] = p.dims[-3:]
# Left dims
outdims[1:-3] = p.dims[0:-3]
else:
outdims[1] = p.dims[0]
outcoords = {}
# Left-most is always cape_cin or cape_cin_lcl_lfc

100
src/wrf/specialdec.py

@ -218,8 +218,12 @@ def cape_left_iter(alg_dtype=np.float64): @@ -218,8 +218,12 @@ def cape_left_iter(alg_dtype=np.float64):
i3dflag = args[7]
ter_follow = args[8]
is2d = False if i3dflag != 0 else True
is2d = i3dflag == 0
is1d = np.isscalar(sfp)
orig_dtype = p_hpa.dtype
if not is1d:
# Need to order in ascending pressure order
flip = False
bot_idxs = (0,) * p_hpa.ndim
@ -239,7 +243,27 @@ def cape_left_iter(alg_dtype=np.float64): @@ -239,7 +243,27 @@ def cape_left_iter(alg_dtype=np.float64):
new_args[3] = ht
num_left_dims = p_hpa.ndim - 3
orig_dtype = p_hpa.dtype
else:
# Need to order in ascending pressure order
flip = False
if p_hpa[0] > p_hpa[-1]:
flip = True
p_hpa = np.ascontiguousarray(p_hpa[::-1])
tk = np.ascontiguousarray(tk[::-1])
qv = np.ascontiguousarray(qv[::-1])
ht = np.ascontiguousarray(ht[::-1])
# Need to make 3D views for the fortran code.
new_args[0] = p_hpa[:, np.newaxis, np.newaxis]
new_args[1] = tk[:, np.newaxis, np.newaxis]
new_args[2] = qv[:, np.newaxis, np.newaxis]
new_args[3] = ht[:, np.newaxis, np.newaxis]
new_args[4] = np.full((1,1), ter, orig_dtype)
new_args[5] = np.full((1,1), sfp, orig_dtype)
num_left_dims = 0
# No special left side iteration, build the output from the cape,cin
# result
@ -247,7 +271,11 @@ def cape_left_iter(alg_dtype=np.float64): @@ -247,7 +271,11 @@ def cape_left_iter(alg_dtype=np.float64):
cape, cin = wrapped(*new_args, **new_kwargs)
output_dims = (2,)
if not is1d:
output_dims += p_hpa.shape[-3:]
else:
output_dims += (p_hpa.shape[0], 1, 1)
output = np.empty(output_dims, orig_dtype)
if flip and not is2d:
@ -259,7 +287,6 @@ def cape_left_iter(alg_dtype=np.float64): @@ -259,7 +287,6 @@ def cape_left_iter(alg_dtype=np.float64):
return output
# Initial output is ...,cape_cin,nz,ny,nx to create contiguous views
outdims = p_hpa.shape[0:num_left_dims]
extra_dims = tuple(outdims) # Copy the left-most dims for iteration
@ -433,3 +460,70 @@ def cloudfrac_left_iter(alg_dtype=np.float64): @@ -433,3 +460,70 @@ def cloudfrac_left_iter(alg_dtype=np.float64):
return func_wrapper
def check_cape_args():
"""A decorator to check that the cape_3d arguments are valid.
An exception is raised when an invalid argument is found.
Returns:
None
Raises:
:class:`ValueError`: Raised when an invalid argument is detected.
"""
@wrapt.decorator
def func_wrapper(wrapped, instance, args, kwargs):
p_hpa = args[0]
tk = args[1]
qv = args[2]
ht = args[3]
ter = args[4]
sfp = args[5]
missing = args[6]
i3dflag = args[7]
ter_follow = args[8]
is2d = False if i3dflag != 0 else True
if not (p_hpa.shape == tk.shape == qv.shape == ht.shape):
raise ValueError("arguments 0, 1, 2, 3 must be the same shape")
# 2D CAPE does not allow for scalars
if is2d:
if np.isscalar(ter) or np.isscalar(sfp):
raise ValueError("arguments 4 and 5 cannot be scalars with "
"cape_2d routine")
if ter.ndim != p_hpa.ndim-1 or sfp.ndim != p_hpa.ndim-1:
raise ValueError("arguments 4 and 5 must have "
"{} dimensions".format(p_hpa.ndim-1))
# 3D cape is allowed to be just a vertical column with scalars
# for terrain and psfc_hpa.
else:
if np.isscalar(ter) and np.isscalar(sfp):
if p_hpa.ndim != 1:
raise ValueError("arguments 0-3 "
"must be 1-dimensional when "
"arguments 4 and 5 are scalars")
if is2d:
raise ValueError("argument 7 must be 0 when using 1D data")
else:
if ((np.isscalar(ter) and not np.isscalar(sfp)) or
(not np.isscalar(ter) and np.isscalar(sfp))):
raise ValueError("arguments 4 and 5 must both be scalars")
else:
if ter.ndim != p_hpa.ndim-1 or sfp.ndim != p_hpa.ndim-1:
raise ValueError("arguments 4 and 5 "
"must have {} dimensions".format(
p_hpa.ndim-1))
return wrapped(*args, **kwargs)
return func_wrapper

59
test/comp_utest.py

@ -515,7 +515,6 @@ def get_args(varname, wrfnc, timeidx, method, squeeze): @@ -515,7 +515,6 @@ def get_args(varname, wrfnc, timeidx, method, squeeze):
return (full_p, relh)
class WRFVarsTest(ut.TestCase):
longMessage = True
@ -542,6 +541,60 @@ def make_func(varname, wrfnc, timeidx, method, squeeze, meta): @@ -542,6 +541,60 @@ def make_func(varname, wrfnc, timeidx, method, squeeze, meta):
return func
def test_cape3d_1d(wrfnc):
def func(self):
varnames = ("T", "P", "PB", "QVAPOR", "PH", "PHB", "HGT", "PSFC")
ncvars = extract_vars(wrfnc, 0, varnames, method="cat", squeeze=True,
cache=None, meta=True)
t = ncvars["T"]
p = ncvars["P"]
pb = ncvars["PB"]
qv = ncvars["QVAPOR"]
ph = ncvars["PH"]
phb = ncvars["PHB"]
ter = ncvars["HGT"]
psfc = ncvars["PSFC"]
col_idxs = (slice(None), t.shape[-2]//2, t.shape[-1]//2)
t = t[col_idxs]
p = p[col_idxs]
pb = pb[col_idxs]
qv = qv[col_idxs]
ph = ph[col_idxs]
phb = phb[col_idxs]
ter = float(ter[col_idxs[1:]])
psfc = float(psfc[col_idxs[1:]])
full_t = t + Constants.T_BASE
full_p = p + pb
tkel = tk(full_p, full_t, meta=False)
geopt = ph + phb
geopt_unstag = destagger(geopt, -1)
z = geopt_unstag/Constants.G
# Convert pressure to hPa
p_hpa = ConversionFactors.PA_TO_HPA * full_p
psfc_hpa = ConversionFactors.PA_TO_HPA * psfc
i3dflag = 1
ter_follow = 1
result = cape_3d(p_hpa, tkel, qv, z, ter, psfc_hpa, ter_follow)
ref = getvar(wrfnc, "cape_3d")
ref = ref[(slice(None),) + col_idxs]
nt.assert_allclose(to_np(result), to_np(ref))
return func
if __name__ == "__main__":
varnames = ["avo", "eth", "cape_2d", "cape_3d", "ctt", "dbz", "mdbz",
"geopt", "helicity", "lat", "lon", "omg", "p", "pressure",
@ -575,6 +628,10 @@ if __name__ == "__main__": @@ -575,6 +628,10 @@ if __name__ == "__main__":
setattr(WRFVarsTest, test_name, func)
func = test_cape3d_1d(wrfnc)
setattr(WRFVarsTest, "test_cape3d_1d", func)
ut.main()

288
test/ipynb/Doc_Examples.ipynb

File diff suppressed because one or more lines are too long

280
test/ipynb/WRF_python_demo.ipynb

@ -2,7 +2,10 @@ @@ -2,7 +2,10 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# 1.0 Basic Variable Extraction"
]
@ -11,7 +14,9 @@ @@ -11,7 +14,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -28,6 +33,8 @@ @@ -28,6 +33,8 @@
"execution_count": null,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true,
"scrolled": false
},
"outputs": [],
@ -38,7 +45,10 @@ @@ -38,7 +45,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### 1.0.1 DataArray attributes: 'dims', 'coords', 'attrs'"
]
@ -47,7 +57,9 @@ @@ -47,7 +57,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -59,7 +71,10 @@ @@ -59,7 +71,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### 1.0.2 Removing implicit 'squeeze' behavior to preserve single sized dimensions"
]
@ -68,7 +83,9 @@ @@ -68,7 +83,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -78,7 +95,10 @@ @@ -78,7 +95,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### 1.0.3 Single element metadata"
]
@ -87,7 +107,9 @@ @@ -87,7 +107,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -97,7 +119,10 @@ @@ -97,7 +119,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### 1.0.4 Disabling/Enabling xarray"
]
@ -106,7 +131,9 @@ @@ -106,7 +131,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -130,14 +157,20 @@ @@ -130,14 +157,20 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# 2.0 Sequences of Input Files "
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## 2.0.1 Combining via the 'cat' method"
]
@ -146,7 +179,9 @@ @@ -146,7 +179,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -161,7 +196,10 @@ @@ -161,7 +196,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## 2.0.2 Combining via the 'join' method"
]
@ -170,7 +208,9 @@ @@ -170,7 +208,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -180,7 +220,10 @@ @@ -180,7 +220,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"Note how the Time dimension was replaced with the file dimension, due to the 'squeezing' of the Time dimension.\n",
"\n",
@ -192,7 +235,9 @@ @@ -192,7 +235,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -204,7 +249,10 @@ @@ -204,7 +249,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## 2.0.3 Dictionary Sequences"
]
@ -213,7 +261,9 @@ @@ -213,7 +261,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -226,7 +276,10 @@ @@ -226,7 +276,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## 2.0.4 Generator Sequences"
]
@ -235,7 +288,9 @@ @@ -235,7 +288,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -251,7 +306,10 @@ @@ -251,7 +306,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## 2.0.5 Custom Iterable Classes"
]
@ -260,7 +318,9 @@ @@ -260,7 +318,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -296,7 +356,10 @@ @@ -296,7 +356,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# 3.0 WRF Variable Computational Routines"
]
@ -305,7 +368,9 @@ @@ -305,7 +368,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -324,7 +389,10 @@ @@ -324,7 +389,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"(Note all of the NaNs in the above routines which produce missing values (e.g. cape_2d). xarray always converts all masked_array missing values to NaN in order to work with pandas. To get back the original missing values in a numpy masked_array, you need to use the 'to_np' method from wrf.)"
]
@ -333,7 +401,9 @@ @@ -333,7 +401,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -347,7 +417,9 @@ @@ -347,7 +417,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -358,14 +430,20 @@ @@ -358,14 +430,20 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## 3.1 Interpolation Routines"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### 3.1.1 Horizontal Level Interpolation"
]
@ -374,7 +452,9 @@ @@ -374,7 +452,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -391,7 +471,10 @@ @@ -391,7 +471,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### 3.1.2 Vertical Cross Section Interpolation"
]
@ -400,7 +483,9 @@ @@ -400,7 +483,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -430,7 +515,9 @@ @@ -430,7 +515,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -483,7 +570,9 @@ @@ -483,7 +570,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -536,7 +625,10 @@ @@ -536,7 +625,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### 3.1.3 Interpolate 2D Variable to a Line"
]
@ -545,7 +637,9 @@ @@ -545,7 +637,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -590,7 +684,10 @@ @@ -590,7 +684,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### 3.1.4 Vertical Coordinate Interpolation"
]
@ -599,7 +696,9 @@ @@ -599,7 +696,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -682,7 +781,10 @@ @@ -682,7 +781,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## 3.2 Lat/Lon to X/Y Routines"
]
@ -691,7 +793,9 @@ @@ -691,7 +793,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -730,7 +834,9 @@ @@ -730,7 +834,9 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"source": [
"# 4.0 Plotting with Cartopy"
@ -740,7 +846,9 @@ @@ -740,7 +846,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -751,7 +859,9 @@ @@ -751,7 +859,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -795,7 +905,9 @@ @@ -795,7 +905,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -874,7 +986,9 @@ @@ -874,7 +986,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -929,6 +1043,8 @@ @@ -929,6 +1043,8 @@
"execution_count": null,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true,
"scrolled": false
},
"outputs": [],
@ -959,7 +1075,9 @@ @@ -959,7 +1075,9 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"source": [
"# Multi-time Moving Domain Files"
@ -969,7 +1087,9 @@ @@ -969,7 +1087,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -991,7 +1111,9 @@ @@ -991,7 +1111,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1002,7 +1124,9 @@ @@ -1002,7 +1124,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1014,7 +1138,9 @@ @@ -1014,7 +1138,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1025,7 +1151,9 @@ @@ -1025,7 +1151,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1036,7 +1164,9 @@ @@ -1036,7 +1164,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1047,7 +1177,9 @@ @@ -1047,7 +1177,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1058,7 +1190,9 @@ @@ -1058,7 +1190,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1069,7 +1203,9 @@ @@ -1069,7 +1203,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1084,7 +1220,9 @@ @@ -1084,7 +1220,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1110,7 +1248,9 @@ @@ -1110,7 +1248,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1149,7 +1289,9 @@ @@ -1149,7 +1289,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1192,7 +1334,9 @@ @@ -1192,7 +1334,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1203,7 +1347,9 @@ @@ -1203,7 +1347,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []
@ -1212,7 +1358,9 @@ @@ -1212,7 +1358,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1241,7 +1389,9 @@ @@ -1241,7 +1389,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -1284,7 +1434,9 @@ @@ -1284,7 +1434,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []

85
test/ipynb/nocopy_test.ipynb

@ -4,7 +4,9 @@ @@ -4,7 +4,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -15,7 +17,9 @@ @@ -15,7 +17,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -29,7 +33,9 @@ @@ -29,7 +33,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -40,7 +46,9 @@ @@ -40,7 +46,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -51,7 +59,9 @@ @@ -51,7 +59,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -62,7 +72,9 @@ @@ -62,7 +72,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -73,7 +85,9 @@ @@ -73,7 +85,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -84,7 +98,9 @@ @@ -84,7 +98,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -95,7 +111,9 @@ @@ -95,7 +111,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -106,7 +124,9 @@ @@ -106,7 +124,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -125,7 +145,9 @@ @@ -125,7 +145,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -152,14 +174,19 @@ @@ -152,14 +174,19 @@
},
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -189,7 +216,9 @@ @@ -189,7 +216,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -214,7 +243,9 @@ @@ -214,7 +243,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -235,7 +266,9 @@ @@ -235,7 +266,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -276,7 +309,9 @@ @@ -276,7 +309,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -294,7 +329,9 @@ @@ -294,7 +329,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -423,7 +460,9 @@ @@ -423,7 +460,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -488,7 +527,9 @@ @@ -488,7 +527,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
@ -549,7 +590,9 @@ @@ -549,7 +590,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []

Loading…
Cancel
Save