Skip to content

Commit 7e5585e

Browse files
jdbcodeXee authors
authored andcommitted
Format Xee .md files to pass lint checks.
PiperOrigin-RevId: 919165905
1 parent 86aca6c commit 7e5585e

9 files changed

Lines changed: 171 additions & 126 deletions

File tree

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
>
33
> v0.1.0 includes a major refactor with breaking API changes.
44
>
5-
> - Migration steps: [docs/migration-guide-v0.1.0.md](docs/migration-guide-v0.1.0.md)
6-
> - Canonical install options (prerelease vs stable): [docs/installation.md](docs/installation.md)
5+
> - Migration steps:
6+
> [docs/migration-guide-v0.1.0.md](docs/migration-guide-v0.1.0.md)
7+
> - Canonical install options (prerelease vs stable):
8+
> [docs/installation.md](docs/installation.md)
79
810
# Xee: Xarray + Google Earth Engine
911

1012
![Xee Logo](https://raw.githubusercontent.com/google/Xee/main/docs/xee-logo.png)
1113

12-
Xee is an Xarray backend for Google Earth Engine. Open `ee.Image` / `ee.ImageCollection` objects as lazy `xarray.Dataset`s and analyze petabyte‑scale Earth data with the scientific Python stack.
14+
Xee is an Xarray backend for Google Earth Engine. Open `ee.Image` /
15+
`ee.ImageCollection` objects as lazy `xarray.Dataset`s and analyze
16+
petabyte-scale Earth data with the scientific Python stack.
1317

1418
[![image](https://img.shields.io/pypi/v/xee.svg)](https://pypi.python.org/pypi/xee)
1519
[![image](https://static.pepy.tech/badge/xee)](https://pepy.tech/project/xee)
@@ -51,25 +55,27 @@ print(ds)
5155

5256
Next steps:
5357

54-
- [Quickstart](docs/quickstart.md)
55-
- [Concepts (grid params, CRS, orientation)](docs/concepts.md)
56-
- [User Guide (workflows)](docs/guide.md)
58+
- [Quickstart](docs/quickstart.md)
59+
- [Concepts (grid params, CRS, orientation)](docs/concepts.md)
60+
- [User Guide (workflows)](docs/guide.md)
5761

5862
## Features
5963

60-
- Lazy, parallel pixel retrieval through Earth Engine
61-
- Flexible output grid definition (fixed resolution or fixed shape)
62-
- CF-friendly dimension order: `[time, y, x]`
63-
- Plays nicely with Xarray, Dask, and friends
64+
- Lazy, parallel pixel retrieval through Earth Engine
65+
- Flexible output grid definition (fixed resolution or fixed shape)
66+
- CF-friendly dimension order: `[time, y, x]`
67+
- Plays nicely with Xarray, Dask, and friends
6468

6569
## Community & Support
6670

67-
- [Discussions](https://github.com/google/Xee/discussions)
68-
- [Issues](https://github.com/google/Xee/issues)
71+
- [Discussions](https://github.com/google/Xee/discussions)
72+
- [Issues](https://github.com/google/Xee/issues)
6973

7074
## Contributing
7175

72-
See [Contributing](https://github.com/google/Xee/blob/main/docs/contributing.md) and sign the required CLA. For local development, we recommend the Pixi environments defined in this repository for reproducible test and docs runs.
76+
See [Contributing](https://github.com/google/Xee/blob/main/docs/contributing.md)
77+
and sign the required CLA. For local development, we recommend the Pixi
78+
environments defined in this repository for reproducible test and docs runs.
7379

7480
## License
7581

@@ -78,4 +84,3 @@ See [Contributing](https://github.com/google/Xee/blob/main/docs/contributing.md)
7884
`SPDX-License-Identifier: Apache-2.0`
7985

8086
This is not an official Google product.
81-

docs/api.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## User grid helpers
88

99
High-level utilities for deriving or matching pixel grid parameters passed to
10-
``xarray.open_dataset(..., engine='ee')``.
10+
`xarray.open_dataset(..., engine='ee')`.
1111

1212
```{eval-rst}
1313
.. autosummary::
@@ -21,9 +21,8 @@ High-level utilities for deriving or matching pixel grid parameters passed to
2121

2222
## Core extension backend
2323

24-
Lower-level interfaces used internally by the xarray backend. Most users do
25-
not need these directly; they're documented for advanced workflows and
26-
debugging.
24+
Lower-level interfaces used internally by the xarray backend. Most users do not
25+
need these directly; they're documented for advanced workflows and debugging.
2726

2827
```{eval-rst}
2928
.. autosummary::
@@ -41,4 +40,4 @@ debugging.
4140
:toctree: _autosummary
4241
4342
geometry_to_bounds
44-
```
43+
```

docs/code-of-conduct.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,4 @@ harassment or threats to anyone's safety, we may take action without notice.
8989
## Attribution
9090

9191
This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
92-
available at
93-
https://www.contributor-covenant.org/version/1/4/code-of-conduct/
92+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct/

docs/contributing.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ sign a new one.
2020

2121
### Review our Community Guidelines
2222

23-
This project follows [Google's Open Source Community
24-
Guidelines](https://opensource.google/conduct/).
23+
This project follows
24+
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
2525

2626
## Contribution process
2727

@@ -61,7 +61,9 @@ build with warnings treated as errors.
6161

6262
### Running tests
6363

64-
The Xee integration tests only pass on Xee branches (no forks). Please run the integration tests locally before sending a PR. To run the tests locally, authenticate using `earthengine authenticate` and run one of the following:
64+
The Xee integration tests only pass on Xee branches (no forks). Please run the
65+
integration tests locally before sending a PR. To run the tests locally,
66+
authenticate using `earthengine authenticate` and run one of the following:
6567

6668
```bash
6769
pixi run -e tests python -m unittest xee/ext_integration_test.py
@@ -87,4 +89,4 @@ pixi run -e docs docs-check
8789
```
8890

8991
If your change touches Earth Engine integration behavior and you are working on
90-
an Xee branch, also run the integration tests locally.
92+
an Xee branch, also run the integration tests locally.

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Xee v0.1.0 introduced a refactored API with breaking changes relative to the 0.0
88
If you are upgrading from 0.0.x, see the [Migration Guide](migration-guide-v0.1.0.md).
99
```
1010

11-
Xee is an Xarray extension for Google Earth Engine that lets you open `ee.Image` and `ee.ImageCollection` objects as lazy `xarray.Dataset`s.
11+
Xee is an Xarray extension for Google Earth Engine that lets you open `ee.Image`
12+
and `ee.ImageCollection` objects as lazy `xarray.Dataset`s.
1213

1314
```{toctree}
1415
:maxdepth: 2
@@ -27,4 +28,3 @@ why-xee
2728
contributing
2829
code-of-conduct
2930
```
30-

docs/installation.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Installation
22

3-
Install Xee with pip or conda. Use virtual environments (`venv`, conda envs) to avoid dependency conflicts.
3+
Install Xee with pip or conda. Use virtual environments (`venv`, conda envs) to
4+
avoid dependency conflicts.
45

5-
Xee v0.1.0 introduced a refactored API with breaking changes relative to the 0.0.x series. This page documents the v0.1.0+ install and usage path. If you are upgrading from 0.0.x, review the [Migration Guide](migration-guide-v0.1.0.md).
6+
Xee v0.1.0 introduced a refactored API with breaking changes relative to the
7+
0.0.x series. This page documents the v0.1.0+ install and usage path. If you are
8+
upgrading from 0.0.x, review the [Migration Guide](migration-guide-v0.1.0.md).
69

710
## Install
811

@@ -34,23 +37,24 @@ Prerelease builds are not published to Conda-Forge.
3437

3538
## Earth Engine setup
3639

37-
Xee makes requests to [Google Earth
38-
Engine](https://developers.google.com/earth-engine/guides) for data. To use
39-
Earth Engine, you'll need to create and register a Google Cloud project,
40-
authenticate with Google, and initialize the service.
40+
Xee makes requests to
41+
[Google Earth Engine](https://developers.google.com/earth-engine/guides) for
42+
data. To use Earth Engine, you'll need to create and register a Google Cloud
43+
project, authenticate with Google, and initialize the service.
4144

42-
If you already have a registered Earth Engine Cloud project and know the auth/initialize steps, skip to the [Quickstart](quickstart.md).
45+
If you already have a registered Earth Engine Cloud project and know the
46+
auth/initialize steps, skip to the [Quickstart](quickstart.md).
4347

4448
**Note**: the authentication and initialization steps described in the following
4549
sections cover the majority of common system configurations and access methods,
46-
if you're having trouble, refer to the Earth Engine [Authentication and
47-
Initialization guide](https://developers.google.com/earth-engine/guides/auth).
50+
if you're having trouble, refer to the Earth Engine
51+
[Authentication and Initialization guide](https://developers.google.com/earth-engine/guides/auth).
4852

4953
### 1. Create and register a Cloud project
5054

51-
Follow instructions in the [Earth Engine Access
52-
guide](https://developers.google.com/earth-engine/guides/access#get_access_to_earth_engine
53-
) to create and register a Google Cloud project.
55+
Follow instructions in the
56+
[Earth Engine Access guide](https://developers.google.com/earth-engine/guides/access#get_access_to_earth_engine)
57+
to create and register a Google Cloud project.
5458

5559
### 2. Authentication
5660

@@ -63,9 +67,8 @@ environment:
6367
#### Persistent environment (one-time)
6468

6569
If you're working from a system with a persistent environment, such as a local
66-
computer or on-premises server, you can authenticate using the [Earth Engine
67-
command line
68-
utility](https://developers.google.com/earth-engine/guides/command_line#authenticate):
70+
computer or on-premises server, you can authenticate using the
71+
[Earth Engine command line utility](https://developers.google.com/earth-engine/guides/command_line#authenticate):
6972

7073
```shell
7174
earthengine authenticate
@@ -87,25 +90,25 @@ every session. In this case, you can use the `earthengine-api` library
8790
ee.Authenticate()
8891
```
8992

90-
This method selects the most appropriate [authentication
91-
mode](https://developers.google.com/earth-engine/guides/auth#authentication_details)
93+
This method selects the most appropriate
94+
[authentication mode](https://developers.google.com/earth-engine/guides/auth#authentication_details)
9295
and guides you through steps to generate authentication credentials. Be sure to
9396
rerun the authentication process each time the environment is reset.
9497

9598
### 3. Initialization
9699

97100
Initialization checks user authentication credentials, sets the Cloud project to
98-
use for requests, and connects the client to Earth Engine's services. At the
99-
top of your script, include one of the following expressions with the `project`
101+
use for requests, and connects the client to Earth Engine's services. At the top
102+
of your script, include one of the following expressions with the `project`
100103
argument modified to match the Google Cloud project ID enabled and registered
101104
for Earth Engine use.
102105

103106
#### High-volume endpoint (stored collections)
104107

105108
If you are requesting stored data (supplying a collection ID or passing an
106109
unmodified `ee.ImageCollection()` object to `xarray.open_dataset`), connect to
107-
the [high-volume
108-
endpoint](https://developers.google.com/earth-engine/guides/processing_environments#high-volume_endpoint).
110+
the
111+
[high-volume endpoint](https://developers.google.com/earth-engine/guides/processing_environments#high-volume_endpoint).
109112

110113
```python
111114
ee.Initialize(
@@ -117,8 +120,8 @@ ee.Initialize(
117120
#### Standard endpoint (computed collections / iterative development)
118121

119122
If you are requesting computed data (applying expressions to the data), consider
120-
connecting to the [standard
121-
endpoint](https://developers.google.com/earth-engine/guides/processing_environments#standard_endpoint).
123+
connecting to the
124+
[standard endpoint](https://developers.google.com/earth-engine/guides/processing_environments#standard_endpoint).
122125
It utilizes caching, so it can be more efficient if you need to rerun or adjust
123126
something about the request.
124127

docs/why-xee.md

Lines changed: 65 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,93 @@
11
# Why Xee?
22

3-
We noticed two clusters of users working with climate and weather data at
4-
Google Research: Some were [Xarray](https://xarray.dev) (and
5-
[Zarr](https://zarr.dev/)) centric and others, Google Earth Engine centric. Xee
6-
came about as an effort to bring these two groups of developers closer together.
3+
We noticed two clusters of users working with climate and weather data at Google
4+
Research: Some were [Xarray](https://xarray.dev) (and [Zarr](https://zarr.dev/))
5+
centric and others, Google Earth Engine centric. Xee came about as an effort to
6+
bring these two groups of developers closer together.
77

88
## Goals
99

1010
Primary Goals:
1111

12-
- Make [EE-curated data](https://developers.google.com/earth-engine/datasets)
13-
accessible to users in the Xarray community and to the wider scientific Python
14-
ecosystem.
15-
- Make it trivial to avoid quota limits when computing pixels from Earth Engine.
16-
- Provide an easy way for scientists and ML practitioners to coalesce Earth data
17-
at different scales into a common resolution.
12+
- Make [EE-curated data](https://developers.google.com/earth-engine/datasets)
13+
accessible to users in the Xarray community and to the wider scientific
14+
Python ecosystem.
15+
- Make it trivial to avoid quota limits when computing pixels from Earth
16+
Engine.
17+
- Provide an easy way for scientists and ML practitioners to coalesce Earth
18+
data at different scales into a common resolution.
1819

1920
Secondary Goals:
2021

21-
- Provide a succinct interface for querying Earth Engine data at scale (i.e. via
22-
[Xarray-Beam](https://xarray-beam.readthedocs.io/)).
23-
- Make it trivial to quickly [export Earth Engine data to Zarr](https://github.com/google/xee/tree/main/examples#export-earth-engine-imagecollections-to-zarr-with-xarray-beam).
24-
- Provide compelling alternative for the need to export Zarr in the first
25-
place (e.g. during the ML training process).
22+
- Provide a succinct interface for querying Earth Engine data at scale (i.e.
23+
via [Xarray-Beam](https://xarray-beam.readthedocs.io/)).
24+
- Make it trivial to quickly
25+
[export Earth Engine data to Zarr](https://github.com/google/xee/tree/main/examples#export-earth-engine-imagecollections-to-zarr-with-xarray-beam).
26+
- Provide compelling alternative for the need to export Zarr in the first
27+
place (e.g. during the ML training process).
2628

2729
## Approach
2830

29-
With the addition of Earth Engine's [Pixel API](https://medium.com/google-earth/pixels-to-the-people-2d3c14a46da6),
31+
With the addition of Earth Engine's
32+
[Pixel API](https://medium.com/google-earth/pixels-to-the-people-2d3c14a46da6),
3033
it became possible to easily get NumPy array data from `ee.Image`s. In building
3134
tools atop of this, we noticed that the best practices for managing data were
3235
Xarray-shaped. For example:
3336

34-
- Our codebases involved many similar LOC to translate between Earth Engine and
35-
arrays: Users typically thought in NumPy and molded EE's Python client to fit
36-
those idioms.
37-
- We often needed to page `computePixel()` requests in a way that's strikingly
38-
similar to Dask/Xarray's concept of [`chunks`](https://docs.xarray.dev/en/stable/user-guide/dask.html#what-is-a-dask-array).
39-
- Users were wrapping NumPy arrays within dataclasses to associate metadata and
40-
labels with data.
37+
- Our codebases involved many similar LOC to translate between Earth Engine
38+
and arrays: Users typically thought in NumPy and molded EE's Python client
39+
to fit those idioms.
40+
- We often needed to page `computePixel()` requests in a way that's strikingly
41+
similar to Dask/Xarray's concept of
42+
[`chunks`](https://docs.xarray.dev/en/stable/user-guide/dask.html#what-is-a-dask-array).
43+
- Users were wrapping NumPy arrays within dataclasses to associate metadata
44+
and labels with data.
4145

4246
In an attempt to group these disparate solutions into a singular interface, we
4347
experimented with wrapping `computePixels()` into
44-
[Xarray's standard mechanism for defining backends](https://docs.xarray.dev/en/stable/internals/how-to-add-new-backend.html). The result of this effort is Xee.
45-
48+
[Xarray's standard mechanism for defining backends](https://docs.xarray.dev/en/stable/internals/how-to-add-new-backend.html).
49+
The result of this effort is Xee.
4650

4751
## An array by any other name? (Xee vs Zarr)
4852

49-
[Zarr](https://zarr.dev/) has been growing in relevance to the world of [cloud-based scientific data](https://doi.org/10.1109/MCSE.2021.3059437).
50-
Members of the open source community have [demonstrated](https://www.youtube.com/watch?v=0bqpxX3Nn_A)
51-
that Zarr is more of a data protocol rather than a data format. In many ways,
52-
Xee is inspired by this work. To this end, we'd like to point out some
53-
similarities and differences between Zarr backed and Earth Engine backed data in
54-
Xarray.
53+
[Zarr](https://zarr.dev/) has been growing in relevance to the world of
54+
[cloud-based scientific data](https://doi.org/10.1109/MCSE.2021.3059437).
55+
Members of the open source community have
56+
[demonstrated](https://www.youtube.com/watch?v=0bqpxX3Nn_A) that Zarr is more of
57+
a data protocol rather than a data format. In many ways, Xee is inspired by this
58+
work. To this end, we'd like to point out some similarities and differences
59+
between Zarr backed and Earth Engine backed data in Xarray.
5560

5661
Similarities:
57-
- **Xarray-compatible**: Of course, this library proves that both types of data
58-
stores can be compatible with Xarray. [Zarr](https://docs.xarray.dev/en/stable/user-guide/io.html#zarr)
59-
reading and writing is deeply integrated into Xarray as well.
60-
- **Optimal IO Chunks**: Ultimately, cloud-based data stores will inherently
61-
involve networking overhead. There are similarities in the best way to page
62-
data across a network into a local context: the optimal Zarr chunk
63-
size is around [10-100 MBs](https://esipfed.github.io/cloud-computing-cluster/optimization-practices.html#chunk-size). With Earth Engine's backend, the maximum chunk size possible
64-
is 48 MBs.
62+
63+
- **Xarray-compatible**: Of course, this library proves that both types of
64+
data stores can be compatible with Xarray.
65+
[Zarr](https://docs.xarray.dev/en/stable/user-guide/io.html#zarr) reading
66+
and writing is deeply integrated into Xarray as well.
67+
- **Optimal IO Chunks**: Ultimately, cloud-based data stores will inherently
68+
involve networking overhead. There are similarities in the best way to page
69+
data across a network into a local context: the optimal Zarr chunk size is
70+
around
71+
[10-100 MBs](https://esipfed.github.io/cloud-computing-cluster/optimization-practices.html#chunk-size).
72+
With Earth Engine's backend, the maximum chunk size possible is 48 MBs.
6573

6674
Differences:
67-
- **Quota vs No Quota**: Since Earth Engine is API based, there are quota
68-
restrictions that limit IO, namely a 100 QPS limit on data requests. Readers
69-
all need to be authenticated and tied to a GCP project quota. Zarr, on the
70-
other hand, has a lower level access pattern. Reading is delegating to basic
71-
permissions on cloud buckets.
72-
- **On the fly vs up-front data shaping**: In Zarr, the representation of data
73-
at rest fundamentally influences performance at query time. For this reason,
74-
[rechunking](https://xarray-beam.readthedocs.io/en/latest/rechunking.html) and
75-
projecting is a common routine performed up front on Zarr when data does not
76-
quite fit the problem at hand. Earth Engine provides a more flexible interface
77-
than this. Since datasets are pyramided (either at ingestion or server-side),
78-
users are free to request the resolution and projection of the data
79-
during dataset open. Similarly, while Earth Engine's internal dataset
80-
does fit an internal chunking scheme, chunking schemes are a lot more
81-
fungibile.
82-
83-
We hope that this comparison provides the user of a set of useful precedents
84-
for working with cloud-based datasets.
8575

76+
- **Quota vs No Quota**: Since Earth Engine is API based, there are quota
77+
restrictions that limit IO, namely a 100 QPS limit on data requests. Readers
78+
all need to be authenticated and tied to a GCP project quota. Zarr, on the
79+
other hand, has a lower level access pattern. Reading is delegating to basic
80+
permissions on cloud buckets.
81+
- **On the fly vs up-front data shaping**: In Zarr, the representation of data
82+
at rest fundamentally influences performance at query time. For this reason,
83+
[rechunking](https://xarray-beam.readthedocs.io/en/latest/rechunking.html)
84+
and projecting is a common routine performed up front on Zarr when data does
85+
not quite fit the problem at hand. Earth Engine provides a more flexible
86+
interface than this. Since datasets are pyramided (either at ingestion or
87+
server-side), users are free to request the resolution and projection of the
88+
data during dataset open. Similarly, while Earth Engine's internal dataset
89+
does fit an internal chunking scheme, chunking schemes are a lot more
90+
fungibile.
91+
92+
We hope that this comparison provides the user of a set of useful precedents for
93+
working with cloud-based datasets.

0 commit comments

Comments
 (0)