Skip to content

Commit 1c5a5e3

Browse files
authored
Merge pull request #68 from EOPF-Sample-Service/konstntokas-xxx-allow_subsetting
Subsetting added
2 parents 5f424a6 + 5416650 commit 1c5a5e3

File tree

14 files changed

+123668
-10949
lines changed

14 files changed

+123668
-10949
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Changes in 0.2.5 (under development)
2+
3+
* Added subsetting and reprojection in analysis mode via parameters `crs`,
4+
`resolution`, and `bbox`.
5+
16
## Changes in 0.2.4 (from 2025-11-17)
27

38
* Added support for **common band names** from the [STAC EO extension](https://github.com/stac-extensions/eo?tab=readme-ov-file#common-band-names)

docs/guide.md

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,30 @@ form. All bands and quality flags are resampled to a unified, user-provided reso
3636
Parameters `**kwargs`:
3737

3838
- `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+
- `bbox`: Bounding box `[west, south, east, north]` used for spatial subsetting;
42+
coordinates must be in the same CRS as `crs`.
3943
- `interp_methods`: for upsampling / interpolating
40-
spatial data variables. Can be a single interpolation method for all
41-
variables or a dictionary mapping variable names or dtypes to
42-
interpolation method. Supported methods include:
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:
4347

4448
- `0` (nearest neighbor)
4549
- `1` (linear / bilinear)
4650
- `"nearest"`
4751
- `"triangular"`
4852
- `"bilinear"`
4953

50-
The default is `0` for integer arrays (e.g. Sentinel-2 L2A SCL),
51-
else `1`.
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).
5256
- `agg_methods`: Optional aggregation methods to be used for downsampling
5357
spatial data variables / bands. Can be a single method for all variables or
5458
a dictionary mapping variable names or dtypes to methods. Supported methods include:
5559
`"center"`, `"count"`, `"first"`, `"last"`, `"max"`, `"mean"`, `"median"`,
5660
`"mode"`, `"min"`, `"prod"`, `"std"`, `"sum"`, and `"var"`.
5761
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).
5863
- `variables`: Variables to include in the dataset. Can be a name or regex pattern
5964
or iterable of the latter.
6065
- `product_type`: Product type name, such as `"MSIL1C"`.
@@ -88,12 +93,22 @@ bands from multiple resolutions onto the same grid using [affine transformation
8893
- [Sentinel-2 Level-1C](https://stac.browser.user.eopf.eodc.eu/collections/sentinel-2-l1c)
8994
- [Sentinel-2 Level-2A](https://stac.browser.user.eopf.eodc.eu/collections/sentinel-2-l2a)
9095

96+
**Supported Variables**
97+
98+
- **Surface reflectance bands**:
99+
`b01`, `b02`, `b03`, `b04`, `b05`, `b06`, `b07`, `b08`, `b8a`, `b09`, `b11`, `b12`
100+
- **Classification/Quality layers** (L2A only):
101+
`cld`, `scl`, `snw`
102+
91103
**Specific Sentinel-2 parameters `**kwargs`:**
92104

93-
- `variables`: The common spectral band names specified in the [STAC EO extension](https://github.com/stac-extensions/eo?tab=readme-ov-file#common-band-names)
94-
are supported for the Sentinel-2 analysis mode.
95-
- `resolution`: Target resolution for all spatial data variables / bands.
96-
Must be one of `10`, `20`, or `60`.
105+
- `variables`: Select specific spectral bands using the names listed above in
106+
*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.
108+
If not specified, the UTM grid of the native data is used.
109+
- `resolution`: Target resolution for all spatial variables/bands.
110+
Choose 10, 20, or 60 meters to minimize resampling and retain some of the native
111+
data resolution.
97112

98113
Examples:
99114
- [Example notebook - open-sen2.ipynb](https://github.com/EOPF-Sample-Service/xarray-eopf/blob/main/examples/open-sen2.ipynb)
@@ -128,6 +143,41 @@ for details.
128143
- [Sentinel-3 SLSTR Level-1 RBT](https://stac.browser.user.eopf.eodc.eu/collections/sentinel-3-slstr-l1-rbt)
129144
- [Sentinel-3 SLSTR Level-2 LST](https://stac.browser.user.eopf.eodc.eu/collections/sentinel-3-slstr-l2-lst)
130145

146+
147+
**Supported Variables:**
148+
- `sentinel-3-olci-l1-efr`:
149+
`oa01_radiance`, `oa02_radiance`, `oa03_radiance`, `oa04_radiance`, `oa05_radiance`,
150+
`oa06_radiance`, `oa07_radiance`, `oa08_radiance`, `oa09_radiance`, `oa10_radiance`,
151+
`oa11_radiance`, `oa12_radiance`, `oa13_radiance`, `oa14_radiance`, `oa15_radiance`,
152+
`oa16_radiance`, `oa17_radiance`, `oa18_radiance`, `oa19_radiance`, `oa20_radiance`,
153+
`oa21_radiance`
154+
- `sentinel-3-olci-l2-lfr`:
155+
`gifapar`, `iwv`, `otci`, `rc681`, `rc865`
156+
- `sentinel-3-slstr-l1-rbt`:
157+
`s1_radiance_an`, `s2_radiance_an`, `s3_radiance_an`, `s4_radiance_an`,
158+
`s5_radiance_an`, `s6_radiance_an`, `s1_radiance_ao`, `s2_radiance_ao`,
159+
`s3_radiance_ao`, `s4_radiance_ao`, `s5_radiance_ao`, `s6_radiance_ao`,
160+
`s4_radiance_bn`, `s5_radiance_bn`, `s6_radiance_bn`, `s4_radiance_bo`,
161+
`s5_radiance_bo`, `s6_radiance_bo`, `f1_bt_fn`, `f1_bt_fo`, `f2_bt_in`,
162+
`f2_bt_io`, `s7_bt_in`, `s8_bt_in`, `s9_bt_in`, `s7_bt_io`, `s8_bt_io`,
163+
`s9_bt_io`
164+
- `sentinel-3-slstr-l2-lst`:
165+
`lst`
166+
167+
**Specific Sentinel-2 parameters `**kwargs`:**
168+
169+
- `variables`: Select variables using the names listed above in *Supported Variables*.
170+
- `crs`: Coordinate reference system of the output dataset.
171+
If not specified, [EPSG:4326](https://epsg.io/4326) is used.
172+
- `resolution`: Target resolution for all spatial variables/bands.
173+
If not specified, the default is set per product:
174+
175+
- Sentinel-3 OLCI Level-1 EFR: 300 meter
176+
- Sentinel-3 OLCI Level-1 ERR: 1200 meter
177+
- Sentinel-3 OLCI Level-2 LFR: 300 meter
178+
- Sentinel-3 SLSTR Level-1 RBT: 500 meter (1000 meter if selected variables come from F- or I-stripe)
179+
- Sentinel-3 SLSTR Level-2 LST: 1000 meter
180+
131181
Example:
132182
- [Example notebook (open-sen3.ipynb)](https://github.com/EOPF-Sample-Service/xarray-eopf/blob/main/examples/open-sen3.ipynb)
133183

0 commit comments

Comments
 (0)