Skip to content

Commit 8a33e55

Browse files
committed
Add roadmap and design info.
1 parent 0c9b805 commit 8a33e55

File tree

4 files changed

+72
-1
lines changed

4 files changed

+72
-1
lines changed

cf_xarray/accessor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import xarray as xr
77
from xarray import DataArray, Dataset
88

9+
#: Classes wrapped by cf_xarray.
910
_WRAPPED_CLASSES = (
1011
xr.core.resample.Resample,
1112
xr.core.groupby.GroupBy,
@@ -14,9 +15,13 @@
1415
xr.core.weighted.Weighted,
1516
)
1617

17-
18+
#: `axis` names understood by cf_xarray
1819
_AXIS_NAMES = ("X", "Y", "Z", "T")
20+
21+
#: `coordinate` types understood by cf_xarray.
1922
_COORD_NAMES = ("longitude", "latitude", "vertical", "time")
23+
24+
#: Cell measures understood by cf_xarray.
2025
_CELL_MEASURES = ("area", "volume")
2126

2227
# Define the criteria for coordinate matches

doc/contributing.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.. currentmodule:: cf_xarray
2+
3+
Contributing
4+
--------------
5+
6+
This section will be expanded later.
7+
8+
.. autodata:: cf_xarray.accessor.coordinate_criteria
9+
.. autodata:: cf_xarray.accessor._WRAPPED_CLASSES
10+
11+
The following names are "special"
12+
13+
.. autodata:: cf_xarray.accessor._AXIS_NAMES
14+
.. autodata:: cf_xarray.accessor._COORD_NAMES
15+
.. autodata:: cf_xarray.accessor._CELL_MEASURES

doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ on xarray objects.
1313
:maxdepth: 2
1414

1515
examples/index
16+
roadmap
17+
contributing
1618

1719
Indices and tables
1820
==================

doc/roadmap.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.. currentmodule:: cf_xarray
2+
3+
Roadmap
4+
-------
5+
6+
Goals
7+
=====
8+
9+
1. Enable easy use of additional CF attributes that are not decoded by xarray.
10+
11+
2. Provide a consolidated set of public helper functions that other packages can use to avoid
12+
duplicated efforts in parsing CF attributes.
13+
14+
Scope
15+
=====
16+
17+
18+
1. This package will not provide a full implementation of the CF data model using xarray objects.
19+
This use case should be served by Iris.
20+
21+
2. Unit support is left to ``pint-xarray`` and future xarray support for ``pint`` until it is clear
22+
that there is a need for some functionality.
23+
24+
3. Projections and CRS stuff is left to ``rioxarray`` and other geo-xarray packages. Some helper
25+
functions could be folded in to ``cf-xarray`` to encourage consolidation in that sub-ecosystem.
26+
27+
Design principles
28+
=================
29+
30+
1. Be uncomplicated.
31+
32+
Avoid anything that requires saving state in accessor objects (for now).
33+
34+
2. Be friendly.
35+
36+
Users should be allowed to mix CF names and variables names from the parent xarray object e.g.
37+
``ds.cf.plot(x="X", y="model_depth")``. This allows use with "imperfectly tagged" datasets.
38+
39+
3. Be loud when wrapping to avoid confusion.
40+
41+
For e.g. the ``repr`` for ``cf.groupby("X")`` should make it clear that this is a
42+
CF-wrapped ``Resample`` instance i.e. ``cf.groupby("X").mean("T")`` is allowed. Docstrings
43+
should also clearly indicate wrapping by ``cf-xarray``; for e.g. ``ds.cf.isel``.
44+
45+
4. Allow easy debugging and help build understanding.
46+
47+
Since ``cf_xarray`` depends on ``attrs`` being present and since ``attrs`` are easily lost in xarray
48+
operations, we should allow easy diagnosis of what ``cf_xarray`` can decode for a particular
49+
object.

0 commit comments

Comments
 (0)