Skip to content

Commit b05df68

Browse files
authored
Merge pull request #80 from EOPF-Sample-Service/konstntokas-xxx-add_sen1_anaylsis
Sentinel-1 GRD Analysis Mode
2 parents d144814 + 8d93a6d commit b05df68

48 files changed

Lines changed: 10087 additions & 104 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,16 @@ cython_debug/
172172

173173
# PyPI configuration file
174174
.pypirc
175+
176+
# Zarr stores (directories)
177+
*.zarr/
178+
179+
# NetCDF files
180+
*.nc
181+
*.nc4
182+
*.cdf
183+
184+
# TIFF files
185+
*.tif
186+
*.tiff
187+

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
(and its subpackages) is included in the PyPI wheel.
55
- Remove the `coarsen.py` module, as it has been moved to [xcube-resampling](https://github.com/xcube-dev/xcube-resampling)
66
and is no longer used internally.
7+
- Add support for Sentinel-1 GRD analysis mode.
8+
- Updated year in the headers.
79
- Added footprint-based subsetting for Sentinel-3 OLCI and SLSTR LST using STAC
810
metadata, improving performance by avoiding full latitude/longitude grid downloads
911
during subsetting.

docs/examples/sentinel_1_analysis.ipynb

Lines changed: 3930 additions & 0 deletions
Large diffs are not rendered by default.

docs/guide.md

Lines changed: 135 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
The xarray backend for EOPF data products `"eopf-zarr"` has two modes of operation,
22
namely _analysis mode_ (the default) and _native mode_, which are described in
3-
the following.
3+
the following.
4+
5+
An introductory example notebook is available at :
6+
- [Docs - Intoduction to the xarray EOPF backend](https://eopf-sample-service.github.io/xarray-eopf/examples/introduction/)
7+
- [Notebook Gallery - Intoduction to the xarray EOPF backend](https://eopf-sample-service.github.io/eopf-sample-notebooks/introduction/)
48

59
---
610

@@ -30,51 +34,83 @@ dataset = xr.open_dataset(
3034
)
3135
```
3236

33-
Returns a EOPF data product from Sentinel-1, -2, or -3 in a analysis-ready, convenient
34-
form. All bands and quality flags are resampled to a unified, user-provided resolution.
35-
36-
Parameters `**kwargs`:
37+
Returns an EOPF data product from Sentinel-1, -2, or -3 in an analysis-ready, convenient
38+
form. Common parameters are:
3739

3840
- `resolution`: Target resolution for all spatial data variables / bands.
39-
- `crs`: Coordinate reference system of the output dataset. If not provided, a
40-
mission-specific default CRS is used (see the respective mission sections below).
41+
- `crs`: Coordinate reference system of the output dataset. Can be provided as a
42+
`str` or a `pyproj.CRS` object. If a string is given, it will be parsed using
43+
[`pyproj.crs.CRS.from_string`](https://pyproj4.github.io/pyproj/dev/api/crs/crs.html#pyproj.crs.CRS.from_string).
44+
If not specified, a mission-specific default CRS will be applied (see the respective
45+
mission sections below).
4146
- `bbox`: Bounding box `[west, south, east, north]` used for spatial subsetting;
4247
coordinates must be in the same CRS as `crs`.
43-
- `interp_methods`: for upsampling / interpolating
44-
spatial data variables. Can be a single interpolation method for all
45-
variables or a dictionary mapping variable names or dtypes to
46-
interpolation method. Supported methods include:
47-
48-
- `0` (nearest neighbor)
49-
- `1` (linear / bilinear)
50-
- `"nearest"`
51-
- `"triangular"`
52-
- `"bilinear"`
53-
54-
The default is `0` for integer arrays (e.g. Sentinel-2 L2A SCL),
55-
else `1`. For more information view [xcube-resampling Documentation](https://xcube-dev.github.io/xcube-resampling/guide/#spatial-resampling-algorithms).
56-
- `agg_methods`: Optional aggregation methods to be used for downsampling
57-
spatial data variables / bands. Can be a single method for all variables or
58-
a dictionary mapping variable names or dtypes to methods. Supported methods include:
59-
`"center"`, `"count"`, `"first"`, `"last"`, `"max"`, `"mean"`, `"median"`,
60-
`"mode"`, `"min"`, `"prod"`, `"std"`, `"sum"`, and `"var"`.
61-
Defaults to `"center"` for integer arrays (e.g. Sentinel-2 L2A SCL), else `"mean"`.
62-
For more information view [xcube-resampling Documentation](https://xcube-dev.github.io/xcube-resampling/guide/#spatial-resampling-algorithms).
6348
- `variables`: Variables to include in the dataset. Can be a name or regex pattern
6449
or iterable of the latter.
6550
- `product_type`: Product type name, such as `"MSIL1C"`.
6651
Only required if `filename_or_obj` is not a path or URL that refers to a product
6752
path adhering to EOPF naming conventions.
6853

69-
The spatial resampling of datasets is performed using [xcube-resampling](https://xcube-dev.github.io/xcube-resampling/).
70-
Further explanation of the meaning and usage of these parameters for each Sentinel
71-
mission is provided in [Remarks on Specific Sentinel Missions](#remark-to-specific-sentinel-missions-).
54+
Additional parameters specific to each Sentinel mission are described below.
7255

7356
#### Remarks on Specific Sentinel Missions
7457

7558
##### Sentinel-1
7659

77-
Support for Sentinel-1 analysis mode will be added in a future release.
60+
> Note: Support for Sentinel-1 GRD products in analysis mode is available.
61+
> Support for SLC products is planned for a future release.
62+
63+
Sentinel-1 GRD data is provided in radar geometry, defined by the coordinates
64+
(`azimuth_time`, `ground_range`). To transform this data into an
65+
**analysis-ready dataset**, the following processing steps are applied:
66+
67+
1. **Radiometric Calibration:** Raw pixel values (DN) are converted into physically
68+
meaningful backscatter values using the `beta_nought` calibration lookup table (LUT).
69+
2. **Geometric Terrain Correction (GTC):** Using a Digital Elevation Model (DEM),
70+
the processor performs **inverse geocoding** by solving the zero-Doppler equation
71+
based on satellite orbit information and terrain elevation. This step maps the
72+
data from radar geometry to a georeferenced grid.
73+
3. **Radiometric Terrain Correction (RTC):** (Optional) RTC compensates for
74+
terrain-induced radiometric distortions such as foreshortening, layover,
75+
and slope-dependent brightness variations.
76+
77+
📖 [D. Small, *Flattening Gamma: Radiometric Terrain Correction for SAR Imagery*](https://ieeexplore.ieee.org/document/5752845)
78+
79+
80+
**Supported Products:**
81+
82+
- [Sentinel-1 GRD](https://stac.browser.user.eopf.eodc.eu/collections/sentinel-1-l1-grd)
83+
84+
**Supported Variables**
85+
86+
- **Polarization bands**:
87+
`vv`, `vh`, `hh`, `hv` *(each GRD product contains only a subset of these bands)*
88+
89+
**Specific Sentinel-1 parameters `**kwargs`:**
90+
91+
- `crs`: Coordinate reference system of the output dataset. Can be provided as a
92+
`str` or a `pyproj.CRS` object. If a string is given, it will be parsed using
93+
[`pyproj.crs.CRS.from_string`](https://pyproj4.github.io/pyproj/dev/api/crs/crs.html#pyproj.crs.CRS.from_string).
94+
If not specified, [EPSG:4326](https://epsg.io/4326) is used.
95+
- `resolution`: Target resolution for all spatial variables expressed in the units
96+
of the specified `crs`. If not specified, the resolution is derived (in degrees)
97+
from the CopDEM (30 m).
98+
- `dem`: Digital Elevation Model (DEM) as a CF-compliant `xarray.DataArray` used for
99+
terrain correction. If provided, the parameters `crs`, `bbox`, and `resolution` are
100+
ignored, and the target grid is derived from the DEM. If not provided, the
101+
[CopDEM COG (30 m)](https://browser.stac.dataspace.copernicus.eu/collections/cop-dem-glo-30-dged-cog)
102+
is automatically retrieved via the CDSE STAC API. This requires
103+
[CDSE S3 credentials](https://documentation.dataspace.copernicus.eu/APIs/S3.html#generate-secrets).
104+
- `apply_rtc`: Enable or disable radiometric terrain correction (RTC). Default is `True`.
105+
- `interp_methods`: Interpolation method used during GTC and RTC. Supported methods:
106+
`nearest`, `bilinear`.
107+
- `footprint_scale_factor`: Defines how radar pixels contribute to the output grid.
108+
Default: `(3.0, 3.0)`, accounting for resolution differences (e.g., ~10 m GRD
109+
vs. ~30 m DEM).
110+
111+
Examples:
112+
113+
- [Docs – Sentinel-1 Analysis Mode](https://eopf-sample-service.github.io/xarray-eopf/examples/sentinel_1_analysis/)
78114

79115

80116
##### Sentinel-2
@@ -104,17 +140,43 @@ bands from multiple resolutions onto the same grid using [affine transformation
104140

105141
- `variables`: Select specific spectral bands using the names listed above in
106142
*Supported Variables*. Common spectral band names from the [STAC EO extension](https://github.com/stac-extensions/eo?tab=readme-ov-file#common-band-names) are also supported for Sentinel-2 analysis mode.
107-
- `crs`: Coordinate reference system of the output dataset.
143+
- `crs`: Coordinate reference system of the output dataset. Can be provided as a
144+
`str` or a `pyproj.CRS` object. If a string is given, it will be parsed using
145+
[`pyproj.crs.CRS.from_string`](https://pyproj4.github.io/pyproj/dev/api/crs/crs.html#pyproj.crs.CRS.from_string).
108146
If not specified, the UTM grid of the native data is used.
109147
- `resolution`: Target resolution for all spatial variables/bands.
110148
Choose 10, 20, or 60 meters to minimize resampling and retain some of the native
111149
data resolution.
150+
- `interp_methods`: for upsampling / interpolating
151+
spatial data variables. Can be a single interpolation method for all
152+
variables or a dictionary mapping variable names or dtypes to
153+
interpolation method. Supported methods include:
154+
155+
- `0` (nearest neighbor)
156+
- `1` (linear / bilinear)
157+
- `"nearest"`
158+
- `"triangular"`
159+
- `"bilinear"`
160+
161+
The default is `0` for integer arrays (e.g. Sentinel-2 L2A SCL),
162+
else `1`. For more information view [xcube-resampling Documentation](https://xcube-dev.github.io/xcube-resampling/guide/#spatial-resampling-algorithms).
163+
- `agg_methods`: Optional aggregation methods to be used for downsampling
164+
spatial data variables / bands. Can be a single method for all variables or
165+
a dictionary mapping variable names or dtypes to methods. Supported methods include:
166+
`"center"`, `"count"`, `"first"`, `"last"`, `"max"`, `"mean"`, `"median"`,
167+
`"mode"`, `"min"`, `"prod"`, `"std"`, `"sum"`, and `"var"`.
168+
Defaults to `"center"` for integer arrays (e.g. Sentinel-2 L2A SCL), else `"mean"`.
169+
For more information view [xcube-resampling Documentation](https://xcube-dev.github.io/xcube-resampling/guide/#spatial-resampling-algorithms).
170+
171+
The spatial resampling of datasets is performed using [xcube-resampling](https://xcube-dev.github.io/xcube-resampling/).
172+
Further explanation of the meaning and usage of these parameters for each Sentinel
173+
mission is provided in [Remarks on Specific Sentinel Missions](#remarks-on-specific-sentinel-missions).
112174

113175
Examples:
114-
- [Example notebook - open-sen2.ipynb](https://github.com/EOPF-Sample-Service/xarray-eopf/blob/main/examples/open-sen2.ipynb)
115-
- [Notebook gallery - Introduction to xarray-eopf backend](https://eopf-sample-service.github.io/eopf-sample-notebooks/introduction-xarray-eopf-plugin/)
116-
- [Webinar 3 - Access EOPF Zarr Products with the New xarray EOPF Backend](https://zarr.eopf.copernicus.eu/webinars/webinar-3-access-eopf-zarr-products-with-the-new-xarray-eopf-backend/)
117176

177+
- [Docs - Sentinel-2 Analysis Mode](https://eopf-sample-service.github.io/xarray-eopf/examples/sentinel_2_analysis/)
178+
- [Notebook Gallery - Sentinel-2 Analysis Mode](https://eopf-sample-service.github.io/eopf-sample-notebooks/sentinel-2-analysis/)
179+
- [Webinar - Access EOPF Zarr Products with the new xarray EOPF Backend](https://www.youtube.com/watch?v=AJz2WJNdFbw)
118180

119181
##### Sentinel-3
120182

@@ -167,7 +229,9 @@ for details.
167229
**Specific Sentinel-3 parameters `**kwargs`:**
168230

169231
- `variables`: Select variables using the names listed above in *Supported Variables*.
170-
- `crs`: Coordinate reference system of the output dataset.
232+
- `crs`: Coordinate reference system of the output dataset. Can be provided as a
233+
`str` or a `pyproj.CRS` object. If a string is given, it will be parsed using
234+
[`pyproj.crs.CRS.from_string`](https://pyproj4.github.io/pyproj/dev/api/crs/crs.html#pyproj.crs.CRS.from_string).
171235
If not specified, [EPSG:4326](https://epsg.io/4326) is used.
172236
- `resolution`: Target resolution for all spatial variables/bands.
173237
If not specified, the default is set per product:
@@ -177,10 +241,35 @@ for details.
177241
- Sentinel-3 OLCI Level-2 LFR: 300 meter
178242
- Sentinel-3 SLSTR Level-1 RBT: 500 meter (1000 meter if selected variables come from F- or I-stripe)
179243
- Sentinel-3 SLSTR Level-2 LST: 1000 meter
244+
- `interp_methods`: for upsampling / interpolating
245+
spatial data variables. Can be a single interpolation method for all
246+
variables or a dictionary mapping variable names or dtypes to
247+
interpolation method. Supported methods include:
248+
249+
- `0` (nearest neighbor)
250+
- `1` (linear / bilinear)
251+
- `"nearest"`
252+
- `"triangular"`
253+
- `"bilinear"`
254+
255+
The default is `0` for integer arrays (e.g. Sentinel-2 L2A SCL),
256+
else `1`. For more information view [xcube-resampling Documentation](https://xcube-dev.github.io/xcube-resampling/guide/#spatial-resampling-algorithms).
257+
- `agg_methods`: Optional aggregation methods to be used for downsampling
258+
spatial data variables / bands. Can be a single method for all variables or
259+
a dictionary mapping variable names or dtypes to methods. Supported methods include:
260+
`"center"`, `"count"`, `"first"`, `"last"`, `"max"`, `"mean"`, `"median"`,
261+
`"mode"`, `"min"`, `"prod"`, `"std"`, `"sum"`, and `"var"`.
262+
Defaults to `"center"` for integer arrays (e.g. Sentinel-2 L2A SCL), else `"mean"`.
263+
For more information view [xcube-resampling Documentation](https://xcube-dev.github.io/xcube-resampling/guide/#spatial-resampling-algorithms).
264+
265+
The spatial resampling of datasets is performed using [xcube-resampling](https://xcube-dev.github.io/xcube-resampling/).
266+
Further explanation of the meaning and usage of these parameters for each Sentinel
267+
mission is provided in [Remarks on Specific Sentinel Missions](#remarks-on-specific-sentinel-missions).
180268

181269
Example:
182-
- [Example notebook (open-sen3.ipynb)](https://github.com/EOPF-Sample-Service/xarray-eopf/blob/main/examples/open-sen3.ipynb)
183270

271+
- [Docs - Sentinel-3 Analysis Mode](https://eopf-sample-service.github.io/xarray-eopf/examples/sentinel_3_analysis/)
272+
- [Notebook Gallery - Sentinel-3 Analysis Mode](https://eopf-sample-service.github.io/eopf-sample-notebooks/sentinel-3-analysis/)
184273

185274

186275
### Function `open_datatree()`
@@ -257,3 +346,12 @@ Opens a data product as-is including Zarr groups and returns a data tree object.
257346
This function currently returns the result of calling
258347
`xr.open_datatree(filename_or_obj, engine="zarr", **kwargs)`.
259348

349+
350+
Example:
351+
352+
- [Docs - Sentinel-1 Native Mode](https://eopf-sample-service.github.io/xarray-eopf/examples/sentinel_1_native/)
353+
- [Docs - Sentinel-2 Native Mode](https://eopf-sample-service.github.io/xarray-eopf/examples/sentinel_2_native/)
354+
- [Docs - Sentinel-3 Native Mode](https://eopf-sample-service.github.io/xarray-eopf/examples/sentinel_3_native/)
355+
- [Notebook Gallery - Sentinel-1 Native Mode](https://eopf-sample-service.github.io/eopf-sample-notebooks/sentinel-1-native/)
356+
- [Notebook Gallery - Sentinel-2 Native Mode](https://eopf-sample-service.github.io/eopf-sample-notebooks/sentinel-2-native/)
357+
- [Notebook Gallery - Sentinel-3 Native Mode](https://eopf-sample-service.github.io/eopf-sample-notebooks/sentinel-3-native/)

environment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ dependencies:
66
- aiohttp
77
- dask
88
- dask-image
9+
- flox
910
- fsspec
1011
- numpy
1112
- pyproj
1213
- python >=3.11
1314
- requests
15+
- rioxarray
1416
- s3fs
1517
- xarray >=2024.10
1618
- xcube-resampling >=0.3.2

0 commit comments

Comments
 (0)