Skip to content

Commit cea1b98

Browse files
author
Bill Ladwig
committed
Renamed the geobounds function since it was confusing the autosummary tool with Sphinx. Updated documentation.
1 parent 1d877a6 commit cea1b98

16 files changed

Lines changed: 765 additions & 238 deletions

File tree

158 KB
Loading
70.2 KB
Loading
89.2 KB
Loading
189 KB
Loading
28.2 KB
Loading
2.52 KB
Loading
4.28 KB
Loading

doc/source/basic_usage.rst

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ In the example below, sea level pressure is calculated and printed.
1919

2020
.. code-block:: python
2121
22-
from __future__ import (absolute_import, division, print_function, unicode_literals)
23-
22+
from __future__ import print_function
23+
2424
from netCDF4 import Dataset
2525
from wrf import getvar
2626
@@ -78,8 +78,8 @@ NetCDF variables.
7878

7979
.. code-block:: python
8080
81-
from __future__ import (absolute_import, division, print_function, unicode_literals)
82-
81+
from __future__ import print_function
82+
8383
from netCDF4 import Dataset
8484
from wrf import getvar
8585
@@ -141,8 +141,8 @@ The example below illustrates both.
141141

142142
.. code-block:: python
143143
144-
from __future__ import (absolute_import, division, print_function, unicode_literals)
145-
144+
from __future__ import print_function
145+
146146
from netCDF4 import Dataset
147147
from wrf import getvar, disable_xarray
148148
@@ -169,27 +169,27 @@ Extracting a Numpy Array from a DataArray
169169
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170170

171171
If you need to convert an :class:`xarray.DataArray` to a :class:`numpy.ndarray`,
172-
wrf-python provides the :meth:`wrf.npvalues` function for this purpose. Although
172+
wrf-python provides the :meth:`wrf.to_np` function for this purpose. Although
173173
an :class:`xarray.DataArary` object already contains the
174174
:attr:`xarray.DataArray.values` attribute to extract the Numpy array, there is a
175175
problem when working with compiled extensions. The behavior for xarray (and pandas)
176176
is to convert missing/fill values to NaN, which may cause crashes when working
177177
with compiled extensions. Also, some existing code may be designed to work with
178178
:class:`numpy.ma.MaskedArray`, and numpy arrays with NaN may not work with it.
179179

180-
The :meth:`wrf.npvalues` function does the following:
180+
The :meth:`wrf.to_np` function does the following:
181181

182-
#. If no missing/fill values are used, :meth:`wrf.npvalues` simply returns the
182+
#. If no missing/fill values are used, :meth:`wrf.to_np` simply returns the
183183
:attr:`xarray.DataArray.values` attribute.
184184

185-
#. If missing/fill values are used, then :meth:`wrf.npvalues` replaces the NaN
185+
#. If missing/fill values are used, then :meth:`wrf.to_np` replaces the NaN
186186
values with the _FillValue found in the :attr:`xarray.DataArray.attrs`
187187
attribute (required) and a :class:`numpy.ma.MaskedArray` is returned.
188188

189189
.. code-block:: python
190190
191-
from __future__ import (absolute_import, division, print_function, unicode_literals)
192-
191+
from __future__ import print_function
192+
193193
from netCDF4 import Dataset
194194
from wrf import getvar
195195
@@ -198,7 +198,7 @@ The :meth:`wrf.npvalues` function does the following:
198198
# Get the Sea Level Pressure
199199
cape_3d = getvar(ncfile, "cape_3d")
200200
201-
cape_3d_ndarray = npvalues(cape_3d)
201+
cape_3d_ndarray = to_np(cape_3d)
202202
203203
print(type(cape_3d_ndarray))
204204
@@ -229,12 +229,11 @@ function.
229229

230230
.. code-block:: python
231231
232-
from __future__ import (absolute_import, division, print_function, unicode_literals)
232+
from __future__ import print_function
233233
234234
from netCDF4 import Dataset
235235
from wrf import getvar, ALL_TIMES
236236
237-
238237
# Creating a simple test list with three timesteps
239238
wrflist = [Dataset("wrfout_d01_2016-10-07_00_00_00"),
240239
Dataset("wrfout_d01_2016-10-07_01_00_00"),
@@ -305,8 +304,8 @@ for most cases.
305304

306305
.. code-block:: python
307306
308-
from __future__ import (absolute_import, division, print_function, unicode_literals)
309-
307+
from __future__ import print_function
308+
310309
from netCDF4 import Dataset
311310
from wrf import getvar, ALL_TIMES
312311
@@ -367,8 +366,8 @@ numpy's automatic squeezing of the single 'Time' dimension. To maintain the
367366

368367
.. code-block:: python
369368
370-
from __future__ import (absolute_import, division, print_function, unicode_literals)
371-
369+
from __future__ import print_function
370+
372371
from netCDF4 import Dataset
373372
from wrf import getvar, ALL_TIMES
374373
@@ -436,9 +435,9 @@ The *method* argument is used to describe how each sequence in the dictionary
436435
will be combined.
437436

438437
.. code-block:: python
439-
440-
from __future__ import (absolute_import, division, print_function, unicode_literals)
441438
439+
from __future__ import print_function
440+
442441
from netCDF4 import Dataset
443442
from wrf import getvar, ALL_TIMES
444443
@@ -504,7 +503,7 @@ a specific horizontal level, usually pressure or height.
504503

505504
.. code-block:: python
506505
507-
from __future__ import (absolute_import, division, print_function, unicode_literals)
506+
from __future__ import print_function
508507
509508
from netCDF4 import Dataset
510509
from wrf import getvar, interplevel
@@ -579,8 +578,8 @@ Example Using Start Point and End Point
579578

580579
.. code-block:: python
581580
582-
from __future__ import (absolute_import, division, print_function, unicode_literals)
583-
581+
from __future__ import print_function
582+
584583
from netCDF4 import Dataset
585584
from wrf import getvar, vertcross, CoordPair
586585
@@ -644,8 +643,8 @@ Example Using Pivot Point and Angle
644643

645644
.. code-block:: python
646645
647-
from __future__ import (absolute_import, division, print_function, unicode_literals)
648-
646+
from __future__ import print_function
647+
649648
from netCDF4 import Dataset
650649
from wrf import getvar, vertcross, CoordPair
651650
@@ -710,8 +709,8 @@ Example Using Lat/Lon Coordinates
710709

711710
.. code-block:: python
712711
713-
from __future__ import (absolute_import, division, print_function, unicode_literals)
714-
712+
from __future__ import print_function
713+
715714
from netCDF4 import Dataset
716715
from wrf import getvar, vertcross, CoordPair
717716
@@ -781,8 +780,8 @@ Example Using Specified Vertical Levels
781780

782781
.. code-block:: python
783782
784-
from __future__ import (absolute_import, division, print_function, unicode_literals)
785-
783+
from __future__ import print_function
784+
786785
from netCDF4 import Dataset
787786
from wrf import getvar, vertcross, CoordPair
788787
@@ -861,8 +860,8 @@ Example Using Start Point and End Point
861860

862861
.. code-block:: python
863862
864-
from __future__ import (absolute_import, division, print_function, unicode_literals)
865-
863+
from __future__ import print_function
864+
866865
from netCDF4 import Dataset
867866
from wrf import getvar, interpline, CoordPair
868867
@@ -912,8 +911,8 @@ Example Using Pivot Point and Angle
912911

913912
.. code-block:: python
914913
915-
from __future__ import (absolute_import, division, print_function, unicode_literals)
916-
914+
from __future__ import print_function
915+
917916
from netCDF4 import Dataset
918917
from wrf import getvar, interpline, CoordPair
919918
@@ -962,8 +961,8 @@ Example Using Lat/Lon Coordinates
962961

963962
.. code-block:: python
964963
965-
from __future__ import (absolute_import, division, print_function, unicode_literals)
966-
964+
from __future__ import print_function
965+
967966
from netCDF4 import Dataset
968967
from wrf import getvar, interpline, CoordPair
969968
@@ -1024,8 +1023,8 @@ The surface levels to interpolate also need to be specified.
10241023

10251024
.. code-block:: python
10261025
1027-
from __future__ import (absolute_import, division, print_function, unicode_literals)
1028-
1026+
from __future__ import print_function
1027+
10291028
from netCDF4 import Dataset
10301029
from wrf import getvar, interpline, CoordPair
10311030
@@ -1097,8 +1096,8 @@ Example With Single Coordinates
10971096

10981097
.. code-block:: python
10991098
1100-
from __future__ import (absolute_import, division, print_function, unicode_literals)
1101-
1099+
from __future__ import print_function
1100+
11021101
from netCDF4 import Dataset
11031102
from wrf import getvar, interpline, CoordPair, xy_to_ll, ll_to_xy
11041103
@@ -1137,7 +1136,7 @@ Example With Multiple Coordinates
11371136

11381137
.. code-block:: python
11391138
1140-
from __future__ import (absolute_import, division, print_function, unicode_literals)
1139+
from __future__ import print_function
11411140
11421141
from netCDF4 import Dataset
11431142
from wrf import getvar, interpline, CoordPair, xy_to_ll, ll_to_xy

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Mock(MagicMock):
2525
def __getattr__(cls, name):
2626
return Mock()
2727

28-
MOCK_MODULES = ["numpy", "numpy.ma", "xarray",
28+
MOCK_MODULES = ["numpy", "numpy.ma", "xarray", "cartopy",
2929
"pandas", "matplotlib", "netCDF4", "mpl_toolkits.basemap",
3030
"wrf._wrffortran"]
3131
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

doc/source/new.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ What's New
44
v1.0a3
55
-----------
66

7-
- Alpha release 3
8-
- Added docstrings
9-
- Now uses CoordPair for cross sections so that lat/lon can be used
10-
- Renamed some functions and or arguments
7+
- Alpha release 3.
8+
- Added docstrings.
9+
- The mapping API has changed.
10+
- The projection attributes are no longer arrays for moving domains.
11+
- Utility functions have been added for extracting geobounds. It is now
12+
easier to get map projection objects from sliced variables.
13+
- Utility functions have been added for getting cartopy, basemap, and pyngl
14+
objects.
15+
- Users should no longer need to use xarray attributes directly
16+
- Now uses CoordPair for cross sections so that lat/lon can be used instead of
17+
raw x,y grid coordinates.
18+
- Renamed npvalues to to_np which is more intuitive.
19+
- Fixed issue with generator expressions.
20+
- Renamed some functions and arguments.

0 commit comments

Comments
 (0)