Skip to content

Commit 4e35b47

Browse files
Modify where the info is stored
1 parent d2e8174 commit 4e35b47

4 files changed

Lines changed: 24 additions & 16 deletions

File tree

docs/pystac-into-xarray.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Additional Libraries
22

3-
The following examples focus on loading COG data into xarray object backed by Dask for efficient in memory reading and processing.
3+
The following examples focus on loading COG data into xarray object backed by Dask for efficient in-memory reading and processing.
44

55
!!! info
66
[Xarray] is build on NumPy and Pandas, adding capabilities for labeled and multi-dimensional arrays (e.g., climate data, satellite images). It extends NumPy arrays by attaching metadata (coordinates, labels), making it easier to work with data dimensions like time, latitude, longitude, and other variables.
@@ -16,10 +16,6 @@ The following examples focus on loading COG data into xarray object backed by Da
1616

1717
## Using Rioxarray
1818

19-
Load a single COG, using the link to the s3 object, into an xarray.
20-
21-
Rioxarray is based on rasterio, and can be used to read data into Xarray object. The developers of the rioxarray library provide additional usage examples, like this [one](https://corteva.github.io/rioxarray/stable/examples/read-locks.html).
22-
2319
``` sh
2420
--8<-- "how-to-guides/rioxarray-requirements.txt"
2521
```
@@ -31,9 +27,6 @@ Source : [rioxarray installation]
3127
members: no
3228
show_root_toc_entry: false # To remove the name of the file in the TOC
3329

34-
!!! Note
35-
When using `rioxarray.open_rasterio()` set `chunks` to enable lazy loading with Dask. This allows Dask to read data in smaller chunks, improving speed and memory usage through parallel computing. For example, a `chunk` size of 1000 for both x and y means Dask reads 100x100 boxes instead of the entire array, processing multiple chunks simultaneously.
36-
3730
``` py linenums="1" hl_lines="20-23"
3831
--8<-- "how-to-guides/rioxarray-example.py:code"
3932
```
@@ -57,12 +50,9 @@ See [pystac.Item] or [pystac-client] for more information.
5750

5851
### Using [stackstac]
5952

60-
This is a third party library based on Xarray, but not listed under the Xarray documentation.
61-
6253
``` sh
6354
--8<-- "how-to-guides/stackstac-requirements.txt"
6455
```
65-
If you have problems with the installation, please refer to [stackstac installation].
6656

6757
<!-- START: Read with stackstac-stac -->
6858
::: how-to-guides.stackstac-example
@@ -76,14 +66,12 @@ If you have problems with the installation, please refer to [stackstac installat
7666
```
7767

7868
See [working-with-xarray-object] or [community-notebook-complete-examples] section for an example on using Xarray object.
79-
### Using [odc-stac]
8069

81-
This is a third party library based on Xarray, but not listed under the Xarray documentation.
70+
### Using [odc-stac]
8271

8372
``` sh
8473
--8<-- "how-to-guides/odc-stac-requirements.txt"
8574
```
86-
If you have problems with the installation, please refer to [odc-stac installation].
8775

8876
<!-- START: Read with odc-stac -->
8977
::: how-to-guides.odc-stac-example
@@ -112,8 +100,6 @@ See `Xarray.DataArray` for details on methods : <https://docs.xarray.dev/en/stab
112100
[Xarray: Parallel Computing with Dask]: https://docs.xarray.dev/en/stable/user-guide/dask.html
113101
[STAC documentation on proj:transform]: https://github.com/stac-extensions/projection?tab=readme-ov-file#projtransform
114102
[Re-order the STAC proj:Transform]: reorder-transform-example.md
115-
[odc-stac installation]: https://odc-stac.readthedocs.io/en/latest/intro.html#installation
116-
[stackstac installation]: https://stackstac.readthedocs.io/en/latest/#installation
117103
[STAC utils]: https://github.com/stac-utils
118104
[pystac-client]: https://pystac-client.readthedocs.io/en/stable/
119105
[pystac.Item]: https://pystac.readthedocs.io/en/latest/api/pystac.html#item

how-to-guides/odc-stac-example.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
"""
2+
This is a third party library based on Xarray, but not listed under the Xarray documentation.
3+
4+
If you have problems with the installation, please refer to [odc-stac installation](https://odc-stac.readthedocs.io/en/latest/intro.html#installation).
5+
6+
27
### Load pystac items into an Xarray
38
49
In this code you will :

how-to-guides/rioxarray-example.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
"""
2+
Load a single COG, using the link to the s3 object, into an xarray.
3+
4+
Rioxarray is based on rasterio, and can be used to read data into Xarray object.
5+
The developers of the rioxarray library provide additional usage examples,
6+
like this [one](https://corteva.github.io/rioxarray/stable/examples/read-locks.html).
7+
28
## Read a portion of a remote COG into an xarray
39
410
In this code you will :
@@ -15,6 +21,12 @@
1521
By default, the bbox used for clipping data inside `rio.clip_bbox()` needs to be in
1622
the projected coordinate system.
1723
See <https://corteva.github.io/rioxarray/stable/examples/clip_box.html#Clip-using-a-bounding-box>
24+
25+
!!! Note
26+
When using `rioxarray.open_rasterio()` set `chunks` to enable lazy loading with Dask. This allows
27+
Dask to read data in smaller chunks, improving speed and memory usage through parallel computing.
28+
For example, a `chunk` size of 1000 for both x and y means Dask reads 100x100 boxes instead of the
29+
entire array, processing multiple chunks simultaneously.
1830
"""
1931
# --8<-- [start:code]
2032
import pystac_client

how-to-guides/stackstac-example.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
"""
2+
This is a third party library based on Xarray, but not listed under the Xarray documentation.
3+
4+
If you have problems with the installation, please refer to [stackstac installation](https://stackstac.readthedocs.io/en/latest/#installation).
5+
6+
27
### Load pystac items into an Xarray
38
49
In this code you will :

0 commit comments

Comments
 (0)