Browse Source

Documentation updates. Added more packaging boilerplate. Updated version to 1.0b.

main
Bill Ladwig 8 years ago
parent
commit
5b01084a87
  1. 32
      LICENSE
  2. 6
      MANIFEST.in
  3. 0
      README
  4. 2
      README.md
  5. 2
      conda_recipe/bld.bat
  6. 10
      conda_recipe/meta.yaml
  7. 490
      doc/source/basic_usage.rst
  8. 1
      doc/source/index.rst
  9. 1
      doc/source/installation.rst
  10. 35
      doc/source/license.rst
  11. 8
      doc/source/new.rst
  12. 22
      setup.py
  13. 2
      src/wrf/version.py
  14. 194
      test/ipynb/Doc_Examples.ipynb
  15. 18876
      test/ipynb/WRF_python_demo.ipynb

32
LICENSE

@ -0,0 +1,32 @@
PLEASE READ THIS SOFTWARE LICENSE ("LICENSE") CAREFULLY BEFORE USING THE
SOFTWARE. BY USING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY ALL OF THE
TERMS OF THIS LICENSE. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE,
DO NOT USE THE SOFTWARE.
Copyright © 2016 the University Corporation for Atmospheric Research ("UCAR").
All rights reserved. Developed by NCAR's Computational and Information Systems
Laboratory, UCAR, www2.cisl.ucar.edu.
Redistribution and use of the Software in source and binary forms, with or
without modification, is permitted provided that the following conditions
are met:
- Neither the names of NCAR's Computational and Information Systems Laboratory,
the University Corporation for Atmospheric Research, nor the names of its
sponsors or contributors may be used to endorse or promote products derived
from this Software without specific prior written permission.
- Redistributions of source code must retain the above copyright notices, this
list of conditions, and the disclaimer below.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions, and the disclaimer below in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.

6
MANIFEST.in

@ -1,10 +1,12 @@
include README include README.md
include LICENSE
include requirements.txt
include fortran/*.f90 include fortran/*.f90
include fortran/*.pyf include fortran/*.pyf
include setup.py include setup.py
recursive-include doc * recursive-include doc/source/*
include doc/make.bat include doc/make.bat
include doc/Makefile include doc/Makefile

2
README.md

@ -1,6 +1,6 @@
# wrf-python # wrf-python
A package for users of the Weather Research and Forecasting (WRF) Model. This package contains over 30 diagnostics calculations, interpolation routines, and utilities to help with plotting. A collection of diagnostic and interpolation routines for use with output from the Weather Research and Forecasting (WRF-ARW) Model.
Documentation is available at: Documentation is available at:

2
conda_recipe/bld.bat

@ -1 +1 @@
pip install --global-option build --global-option --compiler=mingw32 --global-option --fcompiler=gnu95 . pip install .

10
conda_recipe/meta.yaml

@ -15,12 +15,19 @@ build:
requirements: requirements:
build: build:
features:
- vc9 # [win and py27]
- vc10 # [win and py34]
- vc14 # [win and py>=35]
- numpy x.x - numpy x.x
- wrapt - wrapt
- m2w64-toolchain # [win] - m2w64-toolchain # [win]
- gcc # [unix] - gcc # [unix]
- libgcc # [unix] - libgcc # [unix]
- python - python
- vc 9 # [win and py27]
- vc 10 # [win and py34]
- vc 14 # [win and py>=35]
run: run:
- numpy x.x - numpy x.x
@ -29,6 +36,9 @@ requirements:
- m2w64-toolchain # [win] - m2w64-toolchain # [win]
- libgcc # [unix] - libgcc # [unix]
- xarray - xarray
- vc 9 # [win and py27]
- vc 10 # [win and py34]
- vc 14 # [win and py>=35]
test: test:
requires: requires:

490
doc/source/basic_usage.rst

@ -195,9 +195,10 @@ The :meth:`wrf.to_np` function does the following:
ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00") ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00")
# Get the Sea Level Pressure # Get the 3D CAPE, which contains missing values
cape_3d = getvar(ncfile, "cape_3d") cape_3d = getvar(ncfile, "cape_3d")
# Since there are missing values, this should return a MaskedArray
cape_3d_ndarray = to_np(cape_3d) cape_3d_ndarray = to_np(cape_3d)
print(type(cape_3d_ndarray)) print(type(cape_3d_ndarray))
@ -578,7 +579,7 @@ Example Using Start Point and End Point
.. code-block:: python .. code-block:: python
from __future__ import print_function from __future__ import print_function, division
from netCDF4 import Dataset from netCDF4 import Dataset
from wrf import getvar, vertcross, CoordPair from wrf import getvar, vertcross, CoordPair
@ -643,7 +644,7 @@ Example Using Pivot Point and Angle
.. code-block:: python .. code-block:: python
from __future__ import print_function from __future__ import print_function, division
from netCDF4 import Dataset from netCDF4 import Dataset
from wrf import getvar, vertcross, CoordPair from wrf import getvar, vertcross, CoordPair
@ -709,7 +710,7 @@ Example Using Lat/Lon Coordinates
.. code-block:: python .. code-block:: python
from __future__ import print_function from __future__ import print_function, division
from netCDF4 import Dataset from netCDF4 import Dataset
from wrf import getvar, vertcross, CoordPair from wrf import getvar, vertcross, CoordPair
@ -780,7 +781,7 @@ Example Using Specified Vertical Levels
.. code-block:: python .. code-block:: python
from __future__ import print_function from __future__ import print_function, division
from netCDF4 import Dataset from netCDF4 import Dataset
from wrf import getvar, vertcross, CoordPair from wrf import getvar, vertcross, CoordPair
@ -860,7 +861,7 @@ Example Using Start Point and End Point
.. code-block:: python .. code-block:: python
from __future__ import print_function from __future__ import print_function, division
from netCDF4 import Dataset from netCDF4 import Dataset
from wrf import getvar, interpline, CoordPair from wrf import getvar, interpline, CoordPair
@ -911,7 +912,7 @@ Example Using Pivot Point and Angle
.. code-block:: python .. code-block:: python
from __future__ import print_function from __future__ import print_function, division
from netCDF4 import Dataset from netCDF4 import Dataset
from wrf import getvar, interpline, CoordPair from wrf import getvar, interpline, CoordPair
@ -961,7 +962,7 @@ Example Using Lat/Lon Coordinates
.. code-block:: python .. code-block:: python
from __future__ import print_function from __future__ import print_function, division
from netCDF4 import Dataset from netCDF4 import Dataset
from wrf import getvar, interpline, CoordPair from wrf import getvar, interpline, CoordPair
@ -1173,3 +1174,476 @@ Result:
* idx (idx) int64 0 1 * idx (idx) int64 0 1
Mapping Helper Routines
-------------------------
wrf-python includes several routines to assist with plotting, primarily for
obtaining the mapping object used for cartopy, basemap, and PyNGL. For all
three plotting systems, the mapping object can be determined directly from
a variable when using xarray, or can be obtained from the WRF output file(s)
if xarray is turned off.
Also included are utilities for extracting the geographic boundaries
directly from xarray variables. This can be useful in situations where you
only want to work with subsets (slices) of a large domain, but don't want to
define the map projection over the subset region.
Cartopy Example Using a Variable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In this example, we're going to extract the cartopy mapping object from a
diagnostic variable (slp), the lat,lon coordinates, and the geographic
boundaries. Next, we're going to take a subset of the diagnostic variable
and extract the geographic boundaries. Some of the variables
will be printed for demonstration.
.. code-block:: python
from __future__ import print_function
from netCDF4 import Dataset
from wrf import getvar, get_cartopy, latlon_coords, geo_bounds
ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00")
# Use SLP for the example variable
slp = getvar(ncfile, "slp")
# Get the cartopy mapping object
cart_proj = get_cartopy(slp)
print (cart_proj)
# Get the latitude and longitude coordinate. This is usually needed for plotting.
lats, lons = latlon_coords(slp)
# Get the geobounds for the SLP variable
bounds = geo_bounds(slp)
print (bounds)
# Get the geographic boundaries for a subset of the domain
slp_subset = slp[150:250, 150:250]
slp_subset_bounds = geo_bounds(slp_subset)
print (slp_subset_bounds)
Result:
.. code-block:: none
<cartopy.crs.LambertConformal object at 0x115374290>
GeoBounds(CoordPair(lat=25.9246292114, lon=-119.675048828), CoordPair(lat=29.0761833191, lon=-117.46484375))
GeoBounds(CoordPair(lat=25.9246292114, lon=-119.675048828), CoordPair(lat=29.0761833191, lon=-117.46484375))
Cartopy Example Using WRF Output Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In this example, the cartopy mapping object and geographic boundaries
will be extracted directly from the netcdf variable.
.. code-block:: python
from __future__ import print_function
from netCDF4 import Dataset
from wrf import get_cartopy, geo_bounds
ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00")
# Get the cartopy mapping object from the netcdf file
cart_proj = get_cartopy(wrfin=ncfile)
print (cart_proj)
# Get the geobounds from the netcdf file (by default, uses XLAT, XLONG)
# You can supply a variable name to get the staggered boundaries
bounds = geo_bounds(wrfin=ncfile)
print (bounds)
Result:
.. code-block:: none
<cartopy.crs.LambertConformal object at 0x11d3be650>
GeoBounds(CoordPair(lat=21.1381225586, lon=-122.719528198), CoordPair(lat=47.8436355591, lon=-60.9013671875))
Basemap Example Using a Variable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In this example, we're going to extract the basemap mapping object from a
diagnostic variable (slp), the lat,lon coordinates, and the geographic
boundaries. Next, we're going to take a subset of the diagnostic variable
and extract the geographic boundaries. Some of the variables will be
printed for demonstration.
.. code-block:: python
from __future__ import print_function
from netCDF4 import Dataset
from wrf import getvar, get_basemap, latlon_coords, geo_bounds
ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00")
slp = getvar(ncfile, "slp")
# Get the basemap mapping object
bm = get_basemap(slp)
print (bm)
# Get the latitude and longitude coordinate. This is usually needed for plotting.
lats, lons = latlon_coords(slp)
# Get the geobounds for the SLP variable
bounds = geo_bounds(slp)
print(bounds)
# Get the geographic boundaries for a subset of the domain
slp_subset = slp[150:250, 150:250]
slp_subset_bounds = geo_bounds(slp_subset)
print (slp_subset_bounds)
Result:
.. code-block:: none
<mpl_toolkits.basemap.Basemap object at 0x114d65650>
GeoBounds(CoordPair(lat=21.1381225586, lon=-122.719528198), CoordPair(lat=47.8436355591, lon=-60.9013671875))
GeoBounds(CoordPair(lat=25.9246292114, lon=-119.675048828), CoordPair(lat=29.0761833191, lon=-117.46484375)
Basemap Example Using WRF Output Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In this example, the basemap mapping object and geographic boundaries
will be extracted directly from the netcdf variable.
.. code-block:: python
from __future__ import print_function
from netCDF4 import Dataset
from wrf import get_basemap, geo_bounds
ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00")
# Get the basemap object from the netcdf file
bm = get_basemap(wrfin=ncfile)
print (bm)
# Get the geographic boundaries from the netcdf file
bounds = geo_bounds(wrfin=ncfile)
print (bounds)
Result:
.. code-block:: none
<mpl_toolkits.basemap.Basemap object at 0x125bb4750>
GeoBounds(CoordPair(lat=21.1381225586, lon=-122.719528198), CoordPair(lat=47.8436355591, lon=-60.9013671875))
PyNGL Example Using a Variable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In this example, we're going to extract the basemap mapping object from a
diagnostic variable (slp), the lat,lon coordinates, and the geographic
boundaries. Next, we're going to take a subset of the diagnostic variable
and extract the geographic boundaries. Some of the variables will be
printed for demonstration.
.. code-block:: python
from __future__ import print_function
from netCDF4 import Dataset
from wrf import getvar, get_pyngl, latlon_coords, geo_bounds
ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00")
# Use SLP as the example variable
slp = getvar(ncfile, "slp")
# Get the pyngl resources from the variable
pyngl_resources = get_pyngl(slp)
print (pyngl_resources)
# Get the latitude and longitude coordinate. This is needed for plotting.
lats, lons = latlon_coords(slp)
# Get the geobounds from the SLP variable
bounds = geo_bounds(slp)
print(bounds)
# Get the geographic boundaries for a subset of the domain
slp_subset = slp[150:250, 150:250]
slp_subset_bounds = geo_bounds(slp_subset)
print (slp_subset_bounds)
Result:
.. code-block:: none
<Ngl.Resources instance at 0x114cabbd8>
GeoBounds(CoordPair(lat=21.1381225586, lon=-122.719528198), CoordPair(lat=47.8436355591, lon=-60.9013671875))
GeoBounds(CoordPair(lat=25.9246292114, lon=-119.675048828), CoordPair(lat=29.0761833191, lon=-117.46484375))
PyNGL Example Using WRF Output Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In this example, the basemap mapping object and geographic boundaries
will be extracted directly from the netcdf variable.
.. code-block:: python
from __future__ import print_function
from netCDF4 import Dataset
from wrf import get_pyngl, geo_bounds
ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00")
# Get the pyngl resources from the netcdf file
pyngl_resources = get_pyngl(wrfin=ncfile)
print (pyngl_resources)
# Get the geographic boundaries from the netcdf file
bounds = geo_bounds(wrfin=ncfile)
print (bounds)
Result:
.. code-block:: none
<Ngl.Resources instance at 0x115391f80>
GeoBounds(CoordPair(lat=21.1381225586, lon=-122.719528198), CoordPair(lat=47.8436355591, lon=-60.9013671875))
Moving Nests
^^^^^^^^^^^^^^^^^^^^
When a domain nest is moving, the domain boundaries become a function of time when
combining the files using the 'cat' method. When using 'join', the domain boundaries
become a function of both file and time. As a result, the methods that
depend on geographic boundaries (:meth:`wrf.geo_bounds`, :meth:`wrf.get_basemap`, etc)
will return arrays of objects rather than a single object when multiple times
and/or files are detected in the underlying coordinate variables.
An exception is :meth:`wrf.get_cartopy`, which contains no geographic
boundary information in the mapping object. Instead, the
:meth:`wrf.cartopy_xlim` and :meth:`wrf.cartopy_ylim` methods can be used to
get the array of matplotlib axes boundaries (returned in the axes projection
coordinates).
Geographic Boundaries with Moving Nest Example
***************************************************
In this example, the geographic boundaries are extracted from a sequence
of files that use a moving nest. The result will be an array of
:class:`wrf.GeoBounds` objects.
.. code-block:: python
from __future__ import print_function
from glob import glob
from netCDF4 import Dataset as nc
from wrf import getvar, ALL_TIMES, geo_bounds
# Get all the domain 02 files
wrf_filenames = glob("wrf_files/wrf_vortex_multi/wrfout_d02_*")
ncfiles = [nc(x) for x in wrf_filenames]
# SLP is the example variable and includes all times
slp = getvar(ncfiles, "slp", timeidx=ALL_TIMES)
# Get the geographic boundaries
bounds = geo_bounds(slp)
print (bounds)
Result:
.. code-block:: none
[ GeoBounds(CoordPair(lat=21.3020038605, lon=-90.5740585327), CoordPair(lat=29.0274410248, lon=-82.0291671753))
GeoBounds(CoordPair(lat=21.3020038605, lon=-90.3042221069), CoordPair(lat=29.0274410248, lon=-81.7593231201))
GeoBounds(CoordPair(lat=21.3020038605, lon=-90.8438949585), CoordPair(lat=29.0274410248, lon=-82.2990036011))
GeoBounds(CoordPair(lat=21.3020038605, lon=-91.1137390137), CoordPair(lat=29.0274410248, lon=-82.5688400269))
GeoBounds(CoordPair(lat=21.8039493561, lon=-91.6534042358), CoordPair(lat=29.4982528687, lon=-83.1085205078))
GeoBounds(CoordPair(lat=22.0542640686, lon=-92.193107605), CoordPair(lat=29.7328338623, lon=-83.6481933594))
GeoBounds(CoordPair(lat=22.5535621643, lon=-92.7327728271), CoordPair(lat=30.2003688812, lon=-84.1878738403))
GeoBounds(CoordPair(lat=22.8025398254, lon=-93.0026092529), CoordPair(lat=30.4333114624, lon=-84.4577102661))
GeoBounds(CoordPair(lat=23.0510597229, lon=-93.2724456787), CoordPair(lat=30.665681839, lon=-84.7275543213))]
Cartopy Mapping with Moving Nest Example
********************************************
In this example, a cartopy mapping object is extracted from a variable
that uses a moving nest. Since cartopy objects do not include geographic
boundary information, only a single cartopy object is returned. However,
if the axes xlimits and ylimits are desired, the :meth:`wrf.cartopy_xlim` and
:meth:`wrf.cartopy_ylim` functions can be used to obtain the array of
moving boundaries in the axes projected coordinate space.
.. code-block:: python
from __future__ import print_function
from glob import glob
from netCDF4 import Dataset as nc
from wrf import getvar, ALL_TIMES, get_cartopy, cartopy_xlim, cartopy_ylim
# Get all of the domain 02 WRF output files
wrf_filenames = glob("wrf_files/wrf_vortex_multi/wrfout_d02_*")
ncfiles = [nc(x) for x in wrf_filenames]
# Use SLP as the example variable and include all times
slp = getvar(ncfiles, "slp", timeidx=ALL_TIMES)
# Get the cartopy mapping object
cart_proj = get_cartopy(slp)
print (cart_proj)
print ("\n")
# Get the array of axes x-limits
xlims = cartopy_xlim(slp)
print (xlims)
print ("\n")
# Get the array of axes y-limits
ylims = cartopy_ylim(slp)
print (ylims)
Result:
.. code-block:: none
<wrf.projection.MercatorWithLatTS object at 0x13893c9b0>
[[-174999.8505754546, 774999.5806103835]
[-145000.11853874932, 805000.1608638937]
[-204999.58261215844, 744999.8485736783]
[-235000.16286567, 715000.1165369744]
[-294998.77872227144, 654999.804246759]
[-355001.6356629085, 595000.34017335]
[-415000.25151950994, 535000.0278831345]
[-444999.98355621524, 505000.29584642925]
[-474999.7155929191, 474999.7155929177]]
[[2424828.507236154, 3374828.14098255]
[2424828.507236154, 3374828.14098255]
[2424828.507236154, 3374828.14098255]
[2424828.507236154, 3374828.14098255]
[2484829.1182174017, 3434828.972518358]
[2514829.1041871575, 3464828.196283651]
[2574829.0041584675, 3524828.8880928173]
[2604829.1786526926, 3554829.5610342724]
[2634828.9016262344, 3584828.016406863]]
Basemap Mapping with Moving Nest Example
*******************************************
In this example, basemap objects are extracted from a variable that uses a moving
nest. An array of basemap objects is returned because the
basemap object includes geographic boundary information.
.. code-block:: python
from __future__ import print_function
from glob import glob
from netCDF4 import Dataset as nc
from wrf import getvar, ALL_TIMES, get_basemap
# Get all of the domain 02 WRF output files
wrf_filenames = glob("wrf_files/wrf_vortex_multi/wrfout_d02_*")
ncfiles = [nc(x) for x in wrf_filenames]
# Use SLP as the reference variable and include all times
slp = getvar(ncfiles, "slp", timeidx=ALL_TIMES)
# Get the array of basemap objects
bm = get_basemap(slp)
print (bm)
print ("\n")
Result:
.. code-block:: none
[<mpl_toolkits.basemap.Basemap object at 0x1327bc510>
<mpl_toolkits.basemap.Basemap object at 0x115a9a790>
<mpl_toolkits.basemap.Basemap object at 0x115a9a750>
<mpl_toolkits.basemap.Basemap object at 0x115a9a7d0>
<mpl_toolkits.basemap.Basemap object at 0x115a9a850>
<mpl_toolkits.basemap.Basemap object at 0x115a9a8d0>
<mpl_toolkits.basemap.Basemap object at 0x115a9a950>
<mpl_toolkits.basemap.Basemap object at 0x115a9a9d0>
<mpl_toolkits.basemap.Basemap object at 0x115a9aa50>]
PyNGL Mapping with Moving Nest Example
*****************************************
In this example, pyngl resource objects are extracted from a variable that uses
a moving nest. An array of pyngl resource objects is returned because the
pyngl object includes geographic boundary information.
.. code-block:: python
from __future__ import print_function
from glob import glob
from netCDF4 import Dataset as nc
from wrf import getvar, ALL_TIMES, get_pyngl
# Get the domain 02 WRF output files
wrf_filenames = glob("wrf_files/wrf_vortex_multi/wrfout_d02_*")
ncfiles = [nc(x) for x in wrf_filenames]
# Use SLP as the example variable and include all times
slp = getvar(ncfiles, "slp", timeidx=ALL_TIMES)
# Get the array of pyngl resource objects
bm = get_pyngl(slp)
print (bm)
print ("\n")
Result:
.. code-block:: none
[<Ngl.Resources instance at 0x140cd30e0>
<Ngl.Resources instance at 0x11d3187a0>
<Ngl.Resources instance at 0x11d3185a8>
<Ngl.Resources instance at 0x11d3188c0>
<Ngl.Resources instance at 0x11d318878>
<Ngl.Resources instance at 0x11d3183f8>
<Ngl.Resources instance at 0x11d318950>
<Ngl.Resources instance at 0x11d318a70>
<Ngl.Resources instance at 0x11d318710>]

1
doc/source/index.rst

@ -30,6 +30,7 @@ Documentation
./basic_usage ./basic_usage
./plot ./plot
./api ./api
./license

1
doc/source/installation.rst

@ -17,7 +17,6 @@ Highly Recommended Packages
- netCDF4-python (1.2.0 or later) - netCDF4-python (1.2.0 or later)
Plotting Packages Plotting Packages
------------------------- -------------------------

35
doc/source/license.rst

@ -0,0 +1,35 @@
License
==========
PLEASE READ THIS SOFTWARE LICENSE ("LICENSE") CAREFULLY BEFORE USING THE
SOFTWARE. BY USING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY ALL OF THE
TERMS OF THIS LICENSE. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE,
DO NOT USE THE SOFTWARE.
Copyright © 2016 the University Corporation for Atmospheric Research ("UCAR").
All rights reserved. Developed by NCAR's Computational and Information Systems
Laboratory, UCAR, www2.cisl.ucar.edu.
Redistribution and use of the Software in source and binary forms, with or
without modification, is permitted provided that the following conditions
are met:
- Neither the names of NCAR's Computational and Information Systems Laboratory,
the University Corporation for Atmospheric Research, nor the names of its
sponsors or contributors may be used to endorse or promote products derived
from this Software without specific prior written permission.
- Redistributions of source code must retain the above copyright notices, this
list of conditions, and the disclaimer below.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions, and the disclaimer below in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.

8
doc/source/new.rst

@ -18,3 +18,11 @@ v1.0a3
- Renamed npvalues to to_np which is more intuitive. - Renamed npvalues to to_np which is more intuitive.
- Fixed issue with generator expressions. - Fixed issue with generator expressions.
- Renamed some functions and arguments. - Renamed some functions and arguments.
v1.0b1
----------
- Beta release 1.
- Added more packaging boilerplate.

22
setup.py

@ -49,18 +49,21 @@ else:
numpy.distutils.core.setup( numpy.distutils.core.setup(
author = "Bill Ladwig", author = "Bill Ladwig",
author_email = "ladwig@ucar.edu", author_email = "ladwig@ucar.edu",
description = "Diagnostic and interpolation routines for WRF-ARW data", description = "Diagnostic and interpolation routines for WRF-ARW data.",
long_description = """ long_description = ("A collection of diagnostic and interpolation routines "
A collection of diagnostics and interpolation routines to be used with "to be used with WRF-ARW data.\n\n"
WRF-ARW data. "GitHub Repository:\n\n"
""", "https://github.com/NCAR/wrf-python\n\n"
"Documentation:\n\n"
"https://wrf-python.readthedocs.io\n"),
url = "https://github.com/NCAR/wrf-python", url = "https://github.com/NCAR/wrf-python",
keywords = ["python", "wrf-python", "wrf", "forecast", "model", keywords = ["python", "wrf-python", "wrf", "forecast", "model",
"weather research and forecasting", "interpolation", "weather research and forecasting", "interpolation",
"plotting", "plots", "meteorology", "nwp", "plotting", "plots", "meteorology", "nwp",
"numerical weather predication", "diagnostic"], "numerical weather prediction", "diagnostic",
"science", "numpy"],
install_requires = requirements, install_requires = requirements,
classifiers = ["Development Status :: 3 - Alpha", classifiers = ["Development Status :: 4 - Beta",
"Intended Audience :: Science/Research", "Intended Audience :: Science/Research",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"License :: OSI Approved", "License :: OSI Approved",
@ -74,11 +77,14 @@ numpy.distutils.core.setup(
"Operating System :: Unix", "Operating System :: Unix",
"Operating System :: MacOS", "Operating System :: MacOS",
"Operating System :: Microsoft :: Windows"], "Operating System :: Microsoft :: Windows"],
name = "wrf", name = "wrf-python",
platforms = ["any"],
license = "OSI Approved",
version = __version__, version = __version__,
packages = setuptools.find_packages("src"), packages = setuptools.find_packages("src"),
ext_modules = ext_modules, ext_modules = ext_modules,
package_dir = {"" : "src"}, package_dir = {"" : "src"},
download_url = "http://python.org/pypi/wrf-python",
#namespace_packages=["wrf"], #namespace_packages=["wrf"],
# Note: If this doesn't work, you need to add the file to MANIFEST # Note: If this doesn't work, you need to add the file to MANIFEST
package_data={"wrf" : ["data/psadilookup.dat"]}, package_data={"wrf" : ["data/psadilookup.dat"]},

2
src/wrf/version.py

@ -1,2 +1,2 @@
__version__ = "1.0a3" __version__ = "1.0b1"

194
test/ipynb/Doc_Examples.ipynb

@ -558,6 +558,75 @@
"plt.show()" "plt.show()"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from __future__ import print_function\n",
" \n",
"from netCDF4 import Dataset\n",
"from wrf import getvar, get_cartopy, latlon_coords, geo_bounds\n",
"\n",
"ncfile = Dataset(\"/Users/ladwig/Documents/wrf_files/wrfout_d01_2016-10-07_00_00_00\")\n",
"\n",
"slp = getvar(ncfile, \"slp\")\n",
"\n",
"# Get the cartopy mapping object\n",
"cart_proj = get_cartopy(slp)\n",
"\n",
"print (cart_proj)\n",
"\n",
"# Get the latitude and longitude coordinate. This is needed for plotting.\n",
"lats, lons = latlon_coords(slp)\n",
"\n",
"# Get the geobounds for the full domain\n",
"bounds = geo_bounds(slp)\n",
"print (bounds)\n",
"\n",
"# Get the geographic boundaries for a subset of the domain\n",
"slp_subset = slp[150:250, 150:250]\n",
"slp_subset_bounds = geo_bounds(slp_subset)\n",
"\n",
"print (slp_subset_bounds)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<cartopy.crs.LambertConformal object at 0x115374290>\n",
"GeoBounds(CoordPair(lat=21.1381225586, lon=-122.719528198), CoordPair(lat=47.8436355591, lon=-60.9013671875))\n"
]
}
],
"source": [
"from __future__ import print_function\n",
" \n",
"from netCDF4 import Dataset\n",
"from wrf import get_cartopy, geo_bounds\n",
"\n",
"ncfile = Dataset(\"/Users/ladwig/Documents/wrf_files/wrfout_d01_2016-10-07_00_00_00\")\n",
"\n",
"cart_proj = get_cartopy(wrfin=ncfile)\n",
"\n",
"print (cart_proj)\n",
"\n",
"bounds = geo_bounds(wrfin=ncfile)\n",
"\n",
"print (bounds)"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
@ -840,6 +909,67 @@
"plt.show()" "plt.show()"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from __future__ import print_function\n",
" \n",
"from netCDF4 import Dataset\n",
"from wrf import getvar, get_basemap, latlon_coords, geo_bounds\n",
"\n",
"ncfile = Dataset(\"/Users/ladwig/Documents/wrf_files/wrfout_d01_2016-10-07_00_00_00\")\n",
"\n",
"slp = getvar(ncfile, \"slp\")\n",
"\n",
"# Get the basemap mapping object\n",
"basemap_proj = get_basemap(slp)\n",
"\n",
"print (basemap_proj)\n",
"\n",
"# Get the latitude and longitude coordinate. This is needed for plotting.\n",
"lats, lons = latlon_coords(slp)\n",
"\n",
"# Get the geobounds for the full domain\n",
"bounds = geo_bounds(slp)\n",
"\n",
"print(bounds)\n",
"\n",
"# Get the geographic boundaries for a subset of the domain\n",
"slp_subset = slp[150:250, 150:250]\n",
"slp_subset_bounds = geo_bounds(slp_subset)\n",
"\n",
"print (slp_subset_bounds)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from __future__ import print_function\n",
" \n",
"from netCDF4 import Dataset\n",
"from wrf import get_basemap, geo_bounds\n",
"\n",
"ncfile = Dataset(\"/Users/ladwig/Documents/wrf_files/wrfout_d01_2016-10-07_00_00_00\")\n",
"\n",
"cart_proj = get_basemap(wrfin=ncfile)\n",
"\n",
"print (cart_proj)\n",
"\n",
"bounds = geo_bounds(wrfin=ncfile)\n",
"\n",
"print (bounds)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -897,10 +1027,70 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": true "collapsed": false
}, },
"outputs": [], "outputs": [],
"source": [] "source": [
"from __future__ import print_function\n",
" \n",
"from netCDF4 import Dataset\n",
"from wrf import getvar, get_pyngl, latlon_coords, geo_bounds\n",
"\n",
"ncfile = Dataset(\"/Users/ladwig/Documents/wrf_files/wrfout_d01_2016-10-07_00_00_00\")\n",
"\n",
"slp = getvar(ncfile, \"slp\")\n",
"\n",
"# Get the pyngl mapping object\n",
"pyngl_resources = get_pyngl(slp)\n",
"\n",
"print (pyngl_resources)\n",
"\n",
"# Get the latitude and longitude coordinate. This is needed for plotting.\n",
"lats, lons = latlon_coords(slp)\n",
"\n",
"# Get the geobounds for the full domain\n",
"bounds = geo_bounds(slp)\n",
"print(bounds)\n",
"\n",
"# Get the geographic boundaries for a subset of the domain\n",
"slp_subset = slp[150:250, 150:250]\n",
"slp_subset_bounds = geo_bounds(slp_subset)\n",
"\n",
"print (slp_subset_bounds)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<Ngl.Resources instance at 0x115391f80>\n",
"GeoBounds(CoordPair(lat=21.1381225586, lon=-122.719528198), CoordPair(lat=47.8436355591, lon=-60.9013671875))\n"
]
}
],
"source": [
"from __future__ import print_function\n",
" \n",
"from netCDF4 import Dataset\n",
"from wrf import get_pyngl, geo_bounds\n",
"\n",
"ncfile = Dataset(\"/Users/ladwig/Documents/wrf_files/wrfout_d01_2016-10-07_00_00_00\")\n",
"\n",
"pyngl_resources = get_pyngl(wrfin=ncfile)\n",
"\n",
"print (pyngl_resources)\n",
"\n",
"bounds = geo_bounds(wrfin=ncfile)\n",
"\n",
"print (bounds)"
]
} }
], ],
"metadata": { "metadata": {

18876
test/ipynb/WRF_python_demo.ipynb

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save