Skip to content

Commit f3de6a4

Browse files
authored
More doc updates (#295)
1 parent babede6 commit f3de6a4

File tree

5 files changed

+56
-8
lines changed

5 files changed

+56
-8
lines changed

doc/bounds.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
# Bounds Variables
66

7-
See {py:attr}`Dataset.cf.bounds`, {py:func}`cf_xarray.bounds_to_vertices`, {py:func}`cf_xarray.vertices_to_bounds`
7+
See
8+
1. {py:attr}`Dataset.cf.bounds`,
9+
1. {py:func}`Dataset.cf.add_bounds`,
10+
1. {py:func}`cf_xarray.bounds_to_vertices`,
11+
1. {py:func}`cf_xarray.vertices_to_bounds`

doc/dsg.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
jupytext:
3+
text_representation:
4+
format_name: myst
5+
kernelspec:
6+
display_name: Python 3
7+
name: python3
8+
---
9+
```{eval-rst}
10+
.. currentmodule:: xarray
11+
```
12+
```{code-cell}
13+
---
14+
tags: [remove-cell]
15+
---
16+
import cf_xarray
17+
import numpy as np
18+
import xarray as xr
19+
xr.set_options(display_expand_data=False)
20+
```
21+
22+
23+
# Discrete Sampling Geometries
24+
25+
`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).
26+
27+
```{code-cell}
28+
ds = xr.Dataset(
29+
{"temp": ("x", np.arange(10))},
30+
coords={"cast": ("x", np.arange(10), {"cf_role": "profile_id"})}
31+
)
32+
ds.cf["profile_id"]
33+
```
34+

doc/index.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
.. cf_xarray documentation master file, created by
2-
sphinx-quickstart on Mon Jun 1 06:30:20 2020.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
5-
61
|
72
|
83
@@ -17,7 +12,7 @@ Welcome to ``cf_xarray``
1712
========================
1813

1914
``cf_xarray`` mainly provides an accessor (``DataArray.cf`` or ``Dataset.cf``) that allows
20-
you to interpret CF attributes present on xarray objects.
15+
you to interpret `Climate and Forecast metadata convention <http://cfconventions.org/>`_ attributes present on `xarray <https://xarray.pydata.org>`_ objects.
2116

2217
Installing
2318
----------
@@ -38,7 +33,7 @@ or using ``conda``
3833
:caption: In-depth Examples
3934

4035
examples/introduction
41-
EarthCube 2021 <https://earthcube2021.github.io/ec21_book/notebooks/ec21_cherian_etal/DC_01_cf-xarray.html>
36+
EarthCube 2021 demo <https://earthcube2021.github.io/ec21_book/notebooks/ec21_cherian_etal/DC_01_cf-xarray.html>
4237

4338

4439
.. toctree::
@@ -55,6 +50,7 @@ or using ``conda``
5550
units
5651
parametricz
5752
bounds
53+
dsg
5854
geometry
5955
plotting
6056
custom-criteria

doc/selecting.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ kernelspec:
1313
---
1414
tags: [remove-cell]
1515
---
16+
import numpy as np
1617
import xarray as xr
1718
xr.set_options(display_expand_data=False)
1819
```
@@ -45,6 +46,18 @@ The variable `airds.air` has `standard_name: "air_temperature"`, so we can use t
4546
airds.cf["air_temperature"]
4647
```
4748

49+
## By `cf_role`
50+
51+
`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).
52+
53+
```{code-cell}
54+
ds = xr.Dataset(
55+
{"temp": ("x", np.arange(10))},
56+
coords={"cast": ("x", np.arange(10), {"cf_role": "profile_id"})}
57+
)
58+
ds.cf["profile_id"]
59+
```
60+
4861
## Associated variables
4962

5063
`.cf[key]` will return a DataArray or Dataset containing all variables associated with the `key` including ancillary variables and bounds variables (if possible).

doc/whats-new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ What's New
44
----------
55
v0.6.4 (unreleased)
66
===================
7+
- Significantly expanded and improved documention. By `Deepak Cherian`_.
78
- integrate ``xclim``'s CF-compliant unit formatter. :pr:`278`. By `Justus Magin`_.
89
- Fix dropping of bad variable names. :pr:`291`. By `Tom Vo`_.
910

0 commit comments

Comments
 (0)