Skip to content

Commit b5333a7

Browse files
authored
Merge branch 'main' into encode-decode-geometry
2 parents 745aee2 + 0db5233 commit b5333a7

10 files changed

+47
-13
lines changed

cf_xarray/accessor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,8 +2356,8 @@ def formula_terms(self) -> dict[Hashable, dict[str, str]]: # numpydoc ignore=SS
23562356
References
23572357
----------
23582358
Please refer to the CF conventions document :
2359-
1. http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#parametric-vertical-coordinate
2360-
2. http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#parametric-v-coord.
2359+
1. http://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#parametric-vertical-coordinate
2360+
2. http://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#parametric-v-coord.
23612361
23622362
Examples
23632363
--------
@@ -2633,7 +2633,7 @@ def bounds_to_vertices(
26332633
26342634
References
26352635
----------
2636-
Please refer to the CF conventions document : http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#cell-boundaries.
2636+
Please refer to the CF conventions document : http://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#cell-boundaries.
26372637
"""
26382638
if keys is None:
26392639
coords = tuple(self.keys())
@@ -2842,8 +2842,8 @@ def formula_terms(self) -> dict[str, str]: # numpydoc ignore=SS06
28422842
References
28432843
----------
28442844
Please refer to the CF conventions document :
2845-
1. http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#parametric-vertical-coordinate
2846-
2. http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#parametric-v-coord.
2845+
1. http://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#parametric-vertical-coordinate
2846+
2. http://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#parametric-v-coord.
28472847
28482848
Examples
28492849
--------

doc/bounds.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
# Bounds Variables
66

7-
See
8-
7+
```{seealso}
8+
1. [CF conventions on coordinate bounds](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html#cell-boundaries)
99
1. {py:attr}`Dataset.cf.bounds`,
1010
1. {py:func}`Dataset.cf.add_bounds`,
1111
1. {py:func}`cf_xarray.bounds_to_vertices`,
1212
1. {py:func}`cf_xarray.vertices_to_bounds`
13+
```
1314

1415
`cf_xarray` supports parsing [coordinate bounds](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html#cell-boundaries) as encoded in the CF `bounds` attribute. A useful feature for incomplete dataset is also the automatic bounds estimation possible through `cf.add_bounds`. This method will estimate the missing bounds by finding the middle points between elements of the given coordinate, but also by extrapolating to find the outer bounds of the grid. This linear estimation works well with rectilinear grids, but it is only a coarse approximation for curvilinear and simple irregular grids.
1516

doc/dsg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ xr.set_options(display_expand_data=False)
2323

2424
# Discrete Sampling Geometries
2525

26+
```{seealso}
27+
1. [CF conventions on Discrete Sampling Geometries](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.9/cf-conventions.html#discrete-sampling-geometries)
28+
1. {py:attr}`Dataset.cf.cf_roles`
29+
```
30+
2631
`cf_xarray` supports identifying variables by the [`cf_role` attribute](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.9/cf-conventions.html#discrete-sampling-geometries).
2732

2833
```{code-cell}

doc/flags.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ kernelspec:
1515

1616
# Flag Variables
1717

18+
```{seealso}
19+
1. [CF conventions on flag variables and masks](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#flags)
20+
```
21+
1822
`cf_xarray` has some support for [flag variables](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#flags), including flag masks.
1923

2024
## Flag Values

doc/geometry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ cfxr.cf_to_shapely(ds_cf)
142142
```
143143

144144
This conversion adds coordinates that aren't in the `xr.DataArray` that we started with.
145-
By default these are called `crd_x` and `crd_y` unless `grid_mapping` is specified.
145+
By default these are called `'crd_x'` and `'crd_y'` unless `grid_mapping` is specified.
146146

147147
## Gotchas
148148

doc/grid_mappings.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ kernelspec:
1313

1414
# Grid Mappings
1515

16-
See
17-
18-
1. {py:attr}`Dataset.cf.grid_mapping_names`,
16+
```{seealso}
17+
1. [CF conventions on grid mappings and projections](https://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html#grid-mappings-and-projections)
18+
1. {py:attr}`Dataset.cf.grid_mapping_names`
1919
1. {py:attr}`DataArray.cf.grid_mapping_name`
20+
```
2021

2122
`cf_xarray` understands the concept of coordinate projections using the [grid_mapping](https://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html#grid-mappings-and-projections) attribute convention. For example, the dataset might contain two sets of coordinates:
2223

doc/parametricz.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ xr.set_options(display_expand_data=False)
2222

2323
# Parametric Vertical Coordinates
2424

25+
```{seealso}
26+
1. [CF conventions on parametric vertical coordinates](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#parametric-vertical-coordinate)
27+
2. {py:meth}`Dataset.cf.decode_vertical_coords`
28+
3. {py:attr}`Dataset.cf.formula_terms`
29+
```
30+
2531
`cf_xarray` supports decoding [parametric vertical coordinates](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#parametric-vertical-coordinate) encoded in the `formula_terms` attribute using {py:meth}`Dataset.cf.decode_vertical_coords`. Right now, only the two ocean s-coordinates and `ocean_sigma_coordinate` are supported, but support for the [rest](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#parametric-v-coord) should be easy to add (Pull Requests are very welcome!).
2632

2733
## Decoding parametric coordinates

doc/selecting.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ xr.set_options(display_expand_data=False)
2222

2323
# Selecting DataArrays
2424

25-
A second powerful feature of `cf_xarray` is the ability select DataArrays using special "CF names" like the "latitude", or "longitude" coordinate names, "X" or "Y" axes names, oreven using the `standard_name` attribute if present.
25+
```{seealso}
26+
CF conventions on
27+
1. [coordinate variables](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#coordinate-types)
28+
1. [cell bounds and measures](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#_data_representative_of_cells)
29+
1. [standard name](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#standard-name)
30+
1. [ancillary data](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#ancillary-data)
31+
```
32+
33+
A powerful feature of `cf_xarray` is the ability select DataArrays using special "CF names" like the "latitude", or "longitude" coordinate names, "X" or "Y" axes names, oreven using the `standard_name` attribute if present.
2634

2735
To demonstrate this, let's load a few datasets
2836

doc/sgrid_ugrid.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ kernelspec:
99

1010
# SGRID / UGRID
1111

12+
```{seealso}
13+
1. [SGRID conventions](https://sgrid.github.io/sgrid/)
14+
1. [UGRID conventions](http://ugrid-conventions.github.io/ugrid-conventions/)
15+
```
16+
1217
## SGRID
1318

1419
`cf_xarray` can parse the attributes on the `grid_topology` variable to identify dimension names with axes names `X`, `Y`, `Z`.

doc/units.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ hide-toc: true
1010

1111
# Units
1212

13+
```{seealso}
14+
1. [CF conventions on units](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#units)
15+
```
16+
1317
The xarray ecosystem supports unit-aware arrays using [pint](https://pint.readthedocs.io) and [pint-xarray](https://pint-xarray.readthedocs.io). Some changes are required to make these packages work well with [UDUNITS format recommended by the CF conventions](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#units).
1418

15-
`cf_xarray` makes those recommended changes when you `import cf_xarray.units`. These changes allow pint to parse and format UDUNIT units strings, and add several custom units like `degrees_north`, `psu` etc.
19+
`cf_xarray` makes those recommended changes when you `import cf_xarray.units`. These changes allow pint to parse and format UDUNIT units strings, and add several custom units like `degrees_north` for latitude, `psu` for ocean salinity, etc.
1620

1721
## Formatting units
1822

0 commit comments

Comments
 (0)