@@ -22,11 +22,11 @@ To get started, we will import numpy, pandas and xray:
22
22
multi-dimensional array. It has three key properties:
23
23
24
24
- ``values ``: a numpy.ndarray holding the array's values
25
- - ``dimensions ``: names for each axis, e.g., ``('x', 'y', 'z') ``
26
- - ``coordinates ``: tick labels along each dimension, e.g., 1-dimensional arrays
27
- of numbers, datetime objects or strings.
25
+ - ``dims ``: dimension names for each axis, e.g., ``('x', 'y', 'z') ``
26
+ - ``coords ``: tick labels along each dimension, e.g., 1-dimensional
27
+ arrays of numbers, datetime objects or strings.
28
28
29
- xray uses ``dimensions `` and ``coordinates `` to enable its core metadata aware
29
+ xray uses ``dims `` and ``coords `` to enable its core metadata aware
30
30
operations. Dimensions provide names that xray uses instead of the ``axis ``
31
31
argument found in many numpy functions. Coordinates enable fast label based
32
32
indexing and alignment, like the ``index `` found on a pandas
@@ -48,8 +48,7 @@ a numpy ndarray), a list of coordinates labels and a list of dimension names:
48
48
data = np.random.rand(4 , 3 )
49
49
locs = [' IA' , ' IL' , ' IN' ]
50
50
times = pd.date_range(' 2000-01-01' , periods = 4 )
51
- foo = xray.DataArray(data, coordinates = [times, locs],
52
- dimensions = [' time' , ' space' ])
51
+ foo = xray.DataArray(data, coords = [times, locs], dims = [' time' , ' space' ])
53
52
foo
54
53
55
54
All of these arguments (except for ``data ``) are optional, and will be filled
@@ -86,8 +85,8 @@ Let's take a look at the important properties on our array:
86
85
.. ipython :: python
87
86
88
87
foo.values
89
- foo.dimensions
90
- foo.coordinates
88
+ foo.dims
89
+ foo.coords
91
90
foo.attrs
92
91
print (foo.name)
93
92
@@ -99,13 +98,13 @@ Now fill in some of that missing metadata:
99
98
foo.attrs[' units' ] = ' meters'
100
99
foo
101
100
102
- The ``coordinates `` property is ``dict `` like. Individual coordinates can be
101
+ The ``coords `` property is ``dict `` like. Individual coordinates can be
103
102
accessed by name or axis number:
104
103
105
104
.. ipython :: python
106
105
107
- foo.coordinates [' time' ]
108
- foo.coordinates [0 ]
106
+ foo.coords [' time' ]
107
+ foo.coords [0 ]
109
108
110
109
These are :py:class: `xray.Coordinate ` objects, which contain tick-labels for
111
110
each dimension.
@@ -197,7 +196,7 @@ was filled with an array of ascending integers of the proper length:
197
196
198
197
Noncoordinate and coordinates are listed explicitly by the
199
198
:py:attr: `~xray.Dataset.noncoordinates ` and
200
- :py:attr: `~xray.Dataset.coordinates ` attributes.
199
+ :py:attr: `~xray.Dataset.coords ` attributes.
201
200
202
201
There are also a few derived variables based on datetime coordinates that you
203
202
can access from a dataset (e.g., "year", "month" and "day"), even if you didn't
@@ -399,7 +398,7 @@ operation over any or all non-coordinates in a dataset by using
399
398
Aggregation
400
399
~~~~~~~~~~~
401
400
402
- Aggregation methods from ndarray have been updated to take a `dimension `
401
+ Aggregation methods from ndarray have been updated to take a `dim `
403
402
argument instead of `axis `. This allows for very intuitive syntax for
404
403
aggregation methods that are applied along particular dimension(s):
405
404
@@ -453,7 +452,7 @@ arrays with different sizes aligned along different dimensions:
453
452
454
453
a = xray.DataArray([1 , 2 , 3 , 4 ], [[' a' , ' b' , ' c' , ' d' ]], [' x' ])
455
454
a
456
- b = xray.DataArray([- 1 , - 2 , - 3 ], dimensions = [' y' ])
455
+ b = xray.DataArray([- 1 , - 2 , - 3 ], dims = [' y' ])
457
456
b
458
457
459
458
With xray, we can apply binary mathematical operations to these arrays, and
@@ -1112,7 +1111,7 @@ and DataArray variables. It supports the numpy ndarray interface, but is
1112
1111
extended to support and use basic metadata (not including index values). It
1113
1112
consists of:
1114
1113
1115
- 1. ``dimensions ``: A tuple of dimension names.
1114
+ 1. ``dims ``: A tuple of dimension names.
1116
1115
2. ``values ``: The N-dimensional array (for example, of type
1117
1116
:py:class: `numpy.ndarray `) storing the array's data. It must have the same
1118
1117
number of dimensions as the length of ``dimensions ``.
0 commit comments