Skip to content

Commit dd4a884

Browse files
committed
improve notebook
1 parent 9bc3aad commit dd4a884

1 file changed

Lines changed: 107 additions & 33 deletions

File tree

notebooks/xarray_eopf_plugin/introduction_xarray_eopf_plugin.ipynb

Lines changed: 107 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"---\n",
99
"title: Introduction to xarray-eopf backend.\n",
10-
"subtitle: A userfriendly way to open the mew EOPF Zarr products with xarray.\n",
10+
"subtitle: A userfriendly way to open the new EOPF Zarr products with Xarray.\n",
1111
"authors:\n",
1212
" - name: Konstantin Ntokas\n",
1313
" orcid: 0000-0002-0049-0690\n",
@@ -16,12 +16,22 @@
1616
" - id: Brockmann Consult GmbH\n",
1717
" institution: Brockmann Consult GmbH\n",
1818
" ror: 04r0k9g65\n",
19+
"reviewers:\n",
20+
" - name: Michele Claus\n",
21+
" orcid: 0000-0003-3680-381X\n",
22+
" github: clausmichele\n",
23+
" affiliations:\n",
24+
" - id: Eurac Research\n",
25+
" institution: Eurac Research\n",
26+
" ror: 01xt1w755\n",
1927
"date: 2025-05-19\n",
2028
"thumbnail: ../static/ESA_EOPF_logo_2025_COLOR_ESA_blue_reduced.png\n",
2129
"keywords : data access, xarray, EOPF Zarr products\n",
2230
"releaseDate: 2025-05-19\n",
2331
"datePublished: 2025-05-19\n",
24-
"dateModified: 2025-05-19\n",
32+
"dateModified: 2025-05-27\n",
33+
"github: https://github.com/EOPF-Sample-Service/eopf-sample-notebooks\n",
34+
"license: Apache-2.0\n",
2535
"---"
2636
]
2737
},
@@ -43,21 +53,22 @@
4353
"metadata": {},
4454
"source": [
4555
"## Table of Contents\n",
46-
"1. [Introduction](#Introduction)\n",
47-
"2. [Install the xarray-eopf Backend](#Install-the-xarray-eopf-Backend)\n",
48-
"3. [Import modules](#Import-Modules)\n",
49-
"4. [Main Features of the xarray-eopf Backend](#Main-Features-of-the-xarray-eopf-Backend)\n",
50-
"5. [Open the Product in Native Mode](#Open-the-Product-in-Native-Mode)\n",
51-
"7. [Open the Product in Analysis Mode](#Open-the-Product-in-Analysis-Mode)\n",
52-
"8. [Integration with the STAC Item](#Integration-with-the-STAC-Item)\n",
53-
"9. [Conclusion](#Conclusion)"
56+
"1. [Introduction](#Introduction_XEOPF)\n",
57+
"2. [Install the xarray-eopf Backend](#Install_XEOPF)\n",
58+
"3. [Import modules](#Import_XEOPF)\n",
59+
"4. [Main Features of the xarray-eopf Backend](#Main_Features_XEOPF)\n",
60+
"5. [Open the Product in Native Mode](#Native_XEOPF)\n",
61+
"7. [Open the Product in Analysis Mode](#Analysis_XEOPF)\n",
62+
"8. [Integration with the STAC Item](#STAC_XEOPF)\n",
63+
"9. [Conclusion](#Conclusion_XEOPF)"
5464
]
5565
},
5666
{
5767
"cell_type": "markdown",
5868
"id": "a4a7eeac-9aa1-42cc-8540-28146c52899e",
5969
"metadata": {},
6070
"source": [
71+
"(Introduction_XEOPF)=\n",
6172
"## Introduction\n",
6273
"\n",
6374
"**xarray-eopf** is a Python package that extends **xarray** with a custom backend called `\"eopf-zarr\"`. This backend enables **seamless access to ESA EOPF data products** stored in the **Zarr** format, presenting them as analysis-ready data structures.\n",
@@ -86,29 +97,44 @@
8697
":::"
8798
]
8899
},
100+
{
101+
"cell_type": "markdown",
102+
"id": "9d672493-d21c-489e-a97f-0457063adb31",
103+
"metadata": {},
104+
"source": [
105+
"---"
106+
]
107+
},
89108
{
90109
"cell_type": "markdown",
91110
"id": "85bf0184-91d1-4174-8dab-756b1822a455",
92111
"metadata": {},
93112
"source": [
94-
"---\n",
113+
"(Install_XEOPF)=\n",
95114
"## Install the xarray-eopf Backend\n",
96115
"\n",
97116
"The backend is implemented as an **xarray plugin** and can be installed using either `pip` or `conda/mamba` from the conda-forge channel.\n",
98117
"\n",
99118
"- 📦 **PyPI:** [xarray-eopf on PyPI](https://pypi.org/project/xarray-eopf/) `pip install xarray-eopf`\n",
100119
"- 🐍 **Conda (conda-forge):** [xarray-eopf on Anaconda](https://anaconda.org/conda-forge/xarray-eopf) `conda install -c conda-forge xarray-eopf`\n",
101120
"\n",
102-
" You can also use **Mamba** as a faster alternative to Conda: `mamba install -c conda-forge xarray-eopf`\n",
103-
" ```"
121+
" You can also use **Mamba** as a faster alternative to Conda: `mamba install -c conda-forge xarray-eopf`"
122+
]
123+
},
124+
{
125+
"cell_type": "markdown",
126+
"id": "7c680c3f-55c0-46b4-9c47-f00843d95779",
127+
"metadata": {},
128+
"source": [
129+
"---"
104130
]
105131
},
106132
{
107133
"cell_type": "markdown",
108134
"id": "9354864c-046e-4713-8c85-b09cd322c2f6",
109135
"metadata": {},
110136
"source": [
111-
"---\n",
137+
"(Import_XEOPF)=\n",
112138
"## Import Modules\n",
113139
"\n",
114140
"The `xarray-eopf` backend is implemented as a plugin for `xarray`. Once installed, it registers automatically and requires no additional import. You can simply import `xarray` as usual:"
@@ -151,25 +177,44 @@
151177
},
152178
{
153179
"cell_type": "markdown",
154-
"id": "56d4bd4f-1787-47ed-b21e-13c0dcca0ec5",
180+
"id": "0be643b1-55e6-412f-84c4-d6d90e87010b",
155181
"metadata": {},
156182
"source": [
157-
"---\n",
183+
"---"
184+
]
185+
},
186+
{
187+
"cell_type": "markdown",
188+
"id": "c4c6b46d-563a-4263-b861-e77fef90b779",
189+
"metadata": {},
190+
"source": [
191+
"(Main_Features_XEOPF)=\n",
158192
"## Main Features of the xarray-eopf Backend\n",
159193
"\n",
160194
"The xarray-eopf backend for EOPF data products can be selecterd by setting `engine=\"eopf-zarr\"` in `xarray.open_dataset(..)` and `xarray.open_datatree(..)` method. It supports two modes of operation:\n",
161195
"\n",
162196
"- **Analysis Mode** *(default)*\n",
163-
"- **Native Mode**\n",
164-
"\n",
165-
"\n",
197+
"- **Native Mode**"
198+
]
199+
},
200+
{
201+
"cell_type": "markdown",
202+
"id": "fca3d4d5-74b5-4534-ac2e-97132fb4bfde",
203+
"metadata": {},
204+
"source": [
166205
"### Native Mode\n",
167206
"\n",
168207
"Represents EOPF products without modification using `xarray`'s `DataTree` and `Dataset`.\n",
169208
"\n",
170209
"- `open_dataset(..)` — Returns a *flattened* version of the data tree \n",
171-
"- `open_datatree(..)` — Returns the full `DataTree`, same as `xr.open_datatree(.., engine=\"zarr\")`\n",
172-
"\n",
210+
"- `open_datatree(..)` — Returns the full `DataTree`, same as `xr.open_datatree(.., engine=\"zarr\")`"
211+
]
212+
},
213+
{
214+
"cell_type": "markdown",
215+
"id": "464f10a2-32eb-4077-bb51-0d733d0d0554",
216+
"metadata": {},
217+
"source": [
173218
"### Analysis Mode\n",
174219
"\n",
175220
"Provides an analysis-ready, resampled view of the data (currently for **Sentinel-2** only).\n",
@@ -178,16 +223,26 @@
178223
"- `open_datatree(..)` — Not implemented in this mode (`NotImplementedError`)\n",
179224
" \n",
180225
"\n",
181-
"📚 **More info:** [xarray-eopf Guide](https://eopf-sample-service.github.io/xarray-eopf/guide/)\n"
226+
"📚 **More info:** [xarray-eopf Guide](https://eopf-sample-service.github.io/xarray-eopf/guide/)"
182227
]
183228
},
184229
{
185230
"cell_type": "markdown",
186-
"id": "dba06fac-af26-4ae0-97c0-e12a7821ae1c",
231+
"id": "20a1c12a-6363-4582-8049-e5b3a69c9f9a",
187232
"metadata": {},
188233
"source": [
189-
"---\n",
190-
"## Open the Product in Native Mode\n"
234+
"---"
235+
]
236+
},
237+
{
238+
"cell_type": "markdown",
239+
"id": "ffca9ec6-9a49-40cc-93e9-fad3ef653331",
240+
"metadata": {
241+
"jp-MarkdownHeadingCollapsed": true
242+
},
243+
"source": [
244+
"(Native_XEOPF)=\n",
245+
"## Open the Product in Native Mode"
191246
]
192247
},
193248
{
@@ -43211,10 +43266,20 @@
4321143266
},
4321243267
{
4321343268
"cell_type": "markdown",
43214-
"id": "9852d954-15ce-44d4-b351-25c2d5c34625",
43269+
"id": "746022e4-54f5-4258-897b-d9b7d9a680cd",
4321543270
"metadata": {},
4321643271
"source": [
43217-
"---\n",
43272+
"---"
43273+
]
43274+
},
43275+
{
43276+
"cell_type": "markdown",
43277+
"id": "9852d954-15ce-44d4-b351-25c2d5c34625",
43278+
"metadata": {
43279+
"jp-MarkdownHeadingCollapsed": true
43280+
},
43281+
"source": [
43282+
"(Analysis_XEOPF)=\n",
4321843283
"## Open the Product in Analysis Mode\n",
4321943284
"\n",
4322043285
"Currently, analysis mode is available only for Sentinel-2 products. Support for Sentinel-3 and Sentinel-1 will be added in upcoming releases.\n",
@@ -49572,18 +49637,26 @@
4957249637
"plt.tight_layout()"
4957349638
]
4957449639
},
49640+
{
49641+
"cell_type": "markdown",
49642+
"id": "2b00eed6-0374-405f-b27f-9b6ec5646337",
49643+
"metadata": {},
49644+
"source": [
49645+
"---"
49646+
]
49647+
},
4957549648
{
4957649649
"cell_type": "markdown",
4957749650
"id": "c5f67756-ce35-4ebc-9ff7-93c0b7cc2e29",
4957849651
"metadata": {},
4957949652
"source": [
49580-
"---\n",
49653+
"(STAC_XEOPF)=\n",
4958149654
"## Integration with the STAC Item\n",
4958249655
"\n",
4958349656
"- The STAC API at `https://stac.core.eopf.eodc.eu` allows searching for tiles by bounding box and time range.\n",
4958449657
"- The `\"product\"` asset can be used to open an EOPF Zarr product.\n",
4958549658
"- Additional fields in the asset provide the parameters required to open the dataset.\n",
49586-
"- Assets representing individual bands are also available; xarray integration for these is still a work in progress.\n"
49659+
"- Assets representing individual bands are also available; Xarray integration for these is still a work in progress."
4958749660
]
4958849661
},
4958949662
{
@@ -49628,7 +49701,7 @@
4962849701
"id": "ac537572-d51a-40ba-a550-cb5bbaa68855",
4962949702
"metadata": {},
4963049703
"source": [
49631-
"Next, we can inspect the item’s contents, including the additional field `xarray:open_datatree_kwargs`, which provides the arguments needed to open the product using xarray’s `eopf-zarr` engine."
49704+
"Next, we can inspect the item’s contents, including the additional field `xarray:open_datatree_kwargs`, which provides the arguments needed to open the product using Xarray’s `eopf-zarr` engine."
4963249705
]
4963349706
},
4963449707
{
@@ -75540,13 +75613,14 @@
7554075613
"id": "d9d9b7c1-a090-4d56-b633-bd58f5344d09",
7554175614
"metadata": {},
7554275615
"source": [
75616+
"(Conclusion_XEOPF)=\n",
7554375617
"## Conclusion\n",
7554475618
"\n",
75545-
"This notebook presents the current development state of the **xarray-eopf** backend, which enables seamless access to EOPF Zarr products using familiar xarray methods such as `xr.open_dataset` and `xr.open_datatree` by specifying `engine=\"eopf-zarr\"`. The key takeaways are summarized below:\n",
75619+
"This notebook presents the current development state of the **xarray-eopf** backend, which enables seamless access to EOPF Zarr products using familiar Xarray methods such as `xr.open_dataset` and `xr.open_datatree` by specifying `engine=\"eopf-zarr\"`. The key takeaways are summarized below:\n",
7554675620
"\n",
7554775621
"- Two operation modes are available:\n",
7554875622
" - `op_mode=\"native\"`: \n",
75549-
" Represents EOPF products without modification using xarray's `DataTree` and `Dataset` structures. \n",
75623+
" Represents EOPF products without modification using Xarray's `DataTree` and `Dataset` structures. \n",
7555075624
" Example: `xr.open_dataset(path, engine=\"eopf-zarr\", op_mode=\"native\")` returns the data tree as a *flattened* `xr.Dataset`.\n",
7555175625
" - `op_mode=\"analysis\"`: \n",
7555275626
" Provides an analysis-ready, resampled view of the data (currently supported for Sentinel-2 only). Features include:\n",
@@ -75587,7 +75661,7 @@
7558775661
"name": "python",
7558875662
"nbconvert_exporter": "python",
7558975663
"pygments_lexer": "ipython3",
75590-
"version": "3.13.3"
75664+
"version": "3.12.10"
7559175665
}
7559275666
},
7559375667
"nbformat": 4,

0 commit comments

Comments
 (0)