Metadata-Version: 2.4
Name: xarray-sentinel
Version: 0.9.7
Summary: Easily access and explore the SAR data products of the Copernicus Sentinel-1 satellite mission
Author-email: B-Open <software@bopen.eu>
License-Expression: Apache-2.0
Project-URL: repository, https://github.com/bopen/xarray-sentinel
Keywords: copernicus,earth-observation,radar,remote-sensing,satellite-imagery,sentinel-1,sar,synthetic-aperture-radar,xarray
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dask>=2024.6
Requires-Dist: fsspec>=2024.1
Requires-Dist: numcodecs>=0.15.1
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.1
Requires-Dist: rasterio>=1.3.5
Requires-Dist: rioxarray>=0.18
Requires-Dist: scipy>=1.10
Requires-Dist: typer>=0.26.7
Requires-Dist: xarray>=2024.10
Requires-Dist: xmlschema>=3.4
Requires-Dist: zarr>=2.18.7
Provides-Extra: lab
Requires-Dist: jupyterlab-execute-time>=3.3.0; extra == "lab"
Requires-Dist: jupyterlab>=4.5.7; extra == "lab"
Requires-Dist: matplotlib>=3.10.9; extra == "lab"
Requires-Dist: s3fs>=2026.4.0; extra == "lab"
Dynamic: license-file

# xarray-sentinel

Read [Copernicus Sentinel-1](https://sentiwiki.copernicus.eu/web/sentinel-1) SAFE
products in Xarray as the new EOPF DataTrees or as the classic xarray-sentinel Datasets.
Convert them to EOPF Zarr with one command: `xarray-sentinel to-eopf-zarr`.

This Open Source project is sponsored by B-Open - <https://www.bopen.eu>.

## Features

*xarray-sentinel* is a Python library, an [*Xarray*](https://xarray.pydata.org) backend
and a command line tool with the following functionalities:

- opens a whole SAFE product in Xarray as an EOPF `DataTree`, the layout of the new ESA
  Zarr products
- converts a SAFE product to EOPF Zarr with the `xarray-sentinel` command
- opens every group of a SAFE product as a classic Xarray `Dataset` that follows the SAFE
  structure
- supports the following data products as [distributed by ESA](https://browser.dataspace.copernicus.eu/):
  - Sentinel-1 Ground Range Detected (GRD):
    - Stripmap (SM)
    - Interferometric Wide Swath (IW)
    - Extra Wide Swath (EW)
  - Sentinel-1 Single Look Complex (SLC) SM/IW/EW
- creates ready-to-use *Xarray* `DataTree`s and `Dataset`s that map the data
  lazily and efficiently in terms of both memory usage and disk / network access
- reads all SAR imagery data: GRD images, SLC swaths and SLC bursts
- reads several metadata elements:
  satellite orbit and attitude, ground control points, radiometric calibration look up tables,
  Doppler centroid estimation and more
- reads uncompressed and compressed SAFE data products on the local computer or
  on a network via [*fsspec*](https://filesystem-spec.readthedocs.io):
  metadata is read through *fsspec* on any filesystem, while measurements require a
  URL scheme that *rasterio* / *GDAL* opens natively (e.g. `http(s)`, `s3`, `gs`, `az`);
  measurements on other filesystems, such as `zip` or chained caching filesystems,
  are currently broken (see [#127](https://github.com/bopen/xarray-sentinel/issues/127))
- supports larger-than-memory and distributed data access via [*Dask*](https://dask.org) and
  [*rioxarray*](https://vylor.github.io/rioxarray/) /
  [*rasterio*](https://rasterio.readthedocs.io) / [*GDAL*](https://gdal.org)
- provides a few helpers for simple operations involving metadata like
  cropping individual bursts out of IW SLC swaths,
  applying radiometric calibration polynomials,
  converting slant to ground range for GRD products and
  computing geospatial metadata.

Overall, the software is in the **beta** phase and the usual caveats apply.

## Install

*xarray-sentinel* needs Python 3.11 or later. The easiest way to install it is via *pip*:

```shell
    pip install xarray-sentinel
```

If you have `uv` installed the simplest way to test the library is to start an `ipython` session with:

```shell
    uvx --with xarray-sentinel ipython
```

and to run the `xarray-sentinel` command without installing it:

```shell
    uvx xarray-sentinel --help
```

## Usage

The SAR data products of the Copernicus Sentinel-1 satellite mission are distributed in
the SAFE format, composed of a few raster data files in TIFF and several metadata files in XML.
*xarray-sentinel* opens them in two ways: as an EOPF `DataTree`, with the layout of
the new ESA Zarr products, or as classic `Dataset`s that follow the SAFE structure group
by group.

### EOPF DataTree (beta)

`xr.open_datatree` opens the whole product as an [`xarray.DataTree`](https://docs.xarray.dev/en/stable/user-guide/data-structures.html#datatree)
with the layout of the ESA EOPF products, the format written by the EOPF CPM 3.0
converter: one node per swath and burst for TOPS SLC, and one node for SM and GRD.
The layout is in beta and changes only to follow the EOPF format.

```python
dt = xr.open_datatree("S1A_IW_SLC__1SDV_....SAFE", engine="sentinel-1")
slc = dt["S01SIWSLC_20260731T234807_0014_C050_C079_0116E8_IW3_258176/measurements/slc"]
```

Polarisations are stacked along `polarization`. The root carries the product level
`stac_discovery` and `other_metadata` attributes, and every node its own
`stac_discovery` and `other_metadata`.
WV products are not supported yet and raise an error. See
[DATATREE.md](https://github.com/bopen/xarray-sentinel/blob/main/docs/DATATREE.md)
for the layout and the deliberate differences from EOPF.

### The `xarray-sentinel` command (beta)

`to-eopf-zarr` converts a SAFE product to an EOPF Zarr store,
replacing the target if it exists, and `info` prints the product level STAC
metadata reading only the manifest:

```shell
    xarray-sentinel to-eopf-zarr S1A_IW_SLC__1SDV_....SAFE product.zarr
    xarray-sentinel info S1A_IW_SLC__1SDV_....SAFE
```

The source may be any local or *fsspec* URL path. Reading from the Copernicus Data
Space Ecosystem S3 store needs *s3fs* and the `.env` file
with your [CDSE S3 credentials](https://eodata-s3keysmanager.dataspace.copernicus.eu/panel/s3-credentials) as described [here](https://github.com/bopen/xarray-sentinel/blob/main/.env.in):

```shell
    uvx --with s3fs --env-file .env xarray-sentinel to-eopf-zarr \
        s3://eodata/Sentinel-1/SAR/IW_SLC__1S/2026/10/22/S1C_IW_SLC__1SDV_20261022T051910_20261022T051938_009993_013EED_456A.SAFE \
        product.zarr
```

### Classic Datasets by group

Due to the inherent complexity and redundancy of the SAFE format *xarray-sentinel*
maps it to a tree of *groups* where every *group* may be opened as a `Dataset`,
but it may also contain *subgroups*, that are listed in the `subgroups` attribute.

The following sections show some examples of xarray-sentinel usage.
In the `notebooks` folder you
can also find notebooks, one for each supported product, that allow you to explore the
data in more detail using the xarray-sentinel functions.

#### The root dataset

For example, let's explore the Sentinel-1 SLC Stripmap product in the local folder
`tests/data/S1A_S3_SLC__1SDV_20210401T152855_20210401T152914_037258_04638E_6001.SAFE`.
First, we can open the SAR data product by passing the `engine="sentinel-1"` option to `xr.open_dataset`
and access the root group of the product, also known as `/`:

```python
>>> import xarray as xr
>>> slc_sm_path = "tests/data/S1A_S3_SLC__1SDV_20210401T152855_20210401T152914_037258_04638E_6001.SAFE"
>>> xr.open_dataset(slc_sm_path, engine="sentinel-1")
<xarray.Dataset> Size: 0B
Dimensions:  ()
Data variables:
    *empty*
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              A
    mode:                                SM
    swaths:                              ['S3']
    orbit_number:                        37258
    relative_orbit_number:               86
    ...
    start_time:                          2021-04-01T15:28:55.111501
    stop_time:                           2021-04-01T15:29:14.277650
    group:                               /
    subgroups:                           ['S3', 'S3/VH', 'S3/VH/orbit', 'S3/V...
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...

```

The root `Dataset` does not contain any data variable, but only attributes that provide general information
on the product and a description of the tree structure of the data.
The `group` attribute contains the name of the current group and the `subgroups` attribute shows
the names of all available groups below this one.

#### Measurements datasets

To open any subgroup, pass its name with the `group` keyword to `xr.open_dataset`.
Measurements are read by selecting the swath and polarization, for example `group="S3/VH"`:

```python
>>> slc_s3_vh = xr.open_dataset(
...     slc_sm_path, group="S3/VH", engine="sentinel-1", chunks=2048
... )
>>> slc_s3_vh
<xarray.Dataset> Size: 6GB
Dimensions:           (slant_range_time: 18998, azimuth_time: 36895)
Coordinates:
  * slant_range_time  (slant_range_time) float64 ...
    pixel             (slant_range_time) int64 ...
  * azimuth_time      (azimuth_time) datetime64[ns] ...
    line              (azimuth_time) int64 ...
Data variables:
    measurement       (azimuth_time, slant_range_time) complex64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              A
    mode:                                SM
    swaths:                              ['S3']
    orbit_number:                        37258
    relative_orbit_number:               86
    ...
    geospatial_lon_min:                  42.772483
    geospatial_lon_max:                  43.757706
    group:                               /S3/VH
    subgroups:                           ['orbit', 'attitude', 'azimuth_fm_ra...
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...

```

The `measurement` variable contains the Single Look Complex measurements as `complex64`
and has dimensions `slant_range_time` and `azimuth_time`.
The `azimuth_time` is an `np.datetime64` coordinate that contains the UTC zero-Doppler time
associated with the image line
and `slant_range_time` is an `np.float64` coordinate that contains the two-way range time interval
in seconds associated with the image pixel.

Since Sentinel-1 IPF version 3.40, a unique identifier for bursts has been added to the SLC product metadata.
For these products, the list of the burst ids is stored in the `burst_ids` dataset attribute.

#### Metadata datasets

Every swath and polarization group, such as `/S3/VH`, holds the `measurement` variable plus the
following metadata subgroups:

- product XML file
  - `orbit` from the `<orbit>` tags
  - `attitude` from the `<attitude>` tags
  - `azimuth_fm_rate` from the `<azimuthFmRate>` tags
  - `dc_estimate` from the `<dcEstimate>` tags
  - `gcp` from the `<geolocationGridPoint>` tags
  - `coordinate_conversion` from the `<coordinateConversion>` tags
- calibration XML file
  - `calibration` from the `<calibrationVector>` tags
- noise XML file
  - `noise_range` from the `<noiseRangeVector>` tags
  - `noise_azimuth` from the `<noiseAzimuthVector>` tags

For example, the image calibration metadata associated with the `S3/VH` image can be read using
`group="S3/VH/calibration"`:

```python
>>> slc_s3_vh_calibration = xr.open_dataset(
...     slc_sm_path, group="S3/VH/calibration", engine="sentinel-1"
... )
>>> slc_s3_vh_calibration
<xarray.Dataset> Size: 172kB
Dimensions:       (line: 22, pixel: 476)
Coordinates:
  * line          (line) int64 ...
  * pixel         (pixel) int64 ...
Data variables:
    azimuth_time  (line) datetime64[ns] ...
    sigmaNought   (line, pixel) float32 ...
    betaNought    (line, pixel) float32 ...
    gamma         (line, pixel) float32 ...
    dn            (line, pixel) float32 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              A
    mode:                                SM
    swaths:                              ['S3']
    orbit_number:                        37258
    relative_orbit_number:               86
    ...
    absoluteCalibrationConstant:         1.0
    group:                               /S3/VH/calibration
    Conventions:                         CF-1.11
    title:                               Calibration coefficients
    comment:                             The dataset contains calibration inf...
    history:                             created by xarray_sentinel-...

```

Note that in this case, the dimensions are `line` and `pixel` with coordinates corresponding to
the sub-grid of the original image where the calibration Look Up Table is defined.

The groups present in a typical Sentinel-1 Stripmap product are:

```
/
└─ S3
   ├─ VH
   │  ├─ orbit
   │  ├─ attitude
   │  ├─ azimuth_fm_rate
   │  ├─ dc_estimate
   │  ├─ gcp
   │  ├─ coordinate_conversion
   │  ├─ calibration
   │  ├─ noise_range
   │  └─ noise_azimuth
   └─ VV
      ├─ orbit
      ├─ attitude
      ├─ azimuth_fm_rate
      ├─ dc_estimate
      ├─ gcp
      ├─ coordinate_conversion
      ├─ calibration
      ├─ noise_range
      └─ noise_azimuth

```

## Advanced usage

### TOPS burst datasets

The IW and EW products, that use the Terrain Observation with Progressive Scan (TOPS) acquisition mode,
are more complex because they contain several swaths in the same SAFE package,
but also because the measurement array is a collage of sub-images called *bursts*.

*xarray-sentinel* provides a helper function that crops a burst out of a measurement dataset for you.

First, open the desired measurement dataset: here, the HH polarization of the first IW swath
of the `tests/data/S1A_IW_SLC__1SDH_20220414T102209_20220414T102236_042768_051AA4_E677.SAFE`
product:

```python
>>> slc_iw_v340_path = "tests/data/S1A_IW_SLC__1SDH_20220414T102209_20220414T102236_042768_051AA4_E677.SAFE"
>>> slc_iw1_v340_hh = xr.open_dataset(
...     slc_iw_v340_path, group="IW1/HH", engine="sentinel-1"
... )
>>> slc_iw1_v340_hh
<xarray.Dataset> ...
Dimensions:           (pixel: 21169, line: 13500)
Coordinates:
  * pixel             (pixel) int64 ...
    slant_range_time  (pixel) float64 ...
  * line              (line) int64 ...
    azimuth_time      (line) datetime64[ns] ...
Data variables:
    measurement       (line, pixel) complex64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              A
    mode:                                IW
    swaths:                              ['IW1', 'IW2', 'IW3']
    orbit_number:                        42768
    relative_orbit_number:               171
    ...
    geospatial_lon_min:                  -61.949491
    geospatial_lon_max:                  -60.248269
    group:                               /IW1/HH
    subgroups:                           ['orbit', 'attitude', 'azimuth_fm_ra...
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...

```

Note that the measurement data for IW and EW acquisition modes cannot be indexed by physical
coordinates because of the collage nature of the image.

Now the 9th burst out of 9 can be cropped from the swath data using `burst_index=8`, via:

```python
>>> import xarray_sentinel
>>> xarray_sentinel.crop_burst_dataset(slc_iw1_v340_hh, burst_index=8)
<xarray.Dataset> ...
Dimensions:           (slant_range_time: 21169, azimuth_time: 1500)
Coordinates:
  * slant_range_time  (slant_range_time) float64 ...
    pixel             (slant_range_time) int64 ...
  * azimuth_time      (azimuth_time) datetime64[ns] ...
    line              (azimuth_time) int64 ...
Data variables:
    measurement       (azimuth_time, slant_range_time) complex64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              A
    mode:                                IW
    swaths:                              ['IW1', 'IW2', 'IW3']
    orbit_number:                        42768
    relative_orbit_number:               171
    ...
    group:                               /IW1/HH
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...
    azimuth_anx_time:                    2136.774327
    burst_index:                         8
    burst_id:                            365923

```

If IPF processor version is 3.40 or higher, it is also possible to select the burst
to be cropped using the `burst_id` key:

```python
>>> xarray_sentinel.crop_burst_dataset(slc_iw1_v340_hh, burst_id=365923)
<xarray.Dataset> ...
Dimensions:           (slant_range_time: 21169, azimuth_time: 1500)
Coordinates:
  * slant_range_time  (slant_range_time) float64 ...
    pixel             (slant_range_time) int64 ...
  * azimuth_time      (azimuth_time) datetime64[ns] ...
    line              (azimuth_time) int64 ...
Data variables:
    measurement       (azimuth_time, slant_range_time) complex64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              A
    mode:                                IW
    swaths:                              ['IW1', 'IW2', 'IW3']
    orbit_number:                        42768
    relative_orbit_number:               171
    ...
    group:                               /IW1/HH
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...
    azimuth_anx_time:                    2136.774327
    burst_index:                         8
    burst_id:                            365923

```

The helper also returns the burst with `azimuth_time` and `slant_range_time` as dimensions,
instead of the `line` and `pixel` of the swath, and adds the `burst_index`, `burst_id` and
`azimuth_anx_time` attributes.

As a quick way to access burst data, you can add the `burst_index` to the group specification
when opening the dataset, for example, `group="IW1/VH/8"`.
The burst groups are not listed in the `subgroups` attribute because they are not structural.

```python
>>> slc_iw_v330_path = "tests/data/S1B_IW_SLC__1SDV_20210401T052622_20210401T052650_026269_032297_EFA4.SAFE"
>>> xr.open_dataset(slc_iw_v330_path, group="IW1/VH/8", engine="sentinel-1")
<xarray.Dataset> ...
Dimensions:           (slant_range_time: 21632, azimuth_time: 1501)
Coordinates:
  * slant_range_time  (slant_range_time) float64 ...
    pixel             (slant_range_time) int64 ...
  * azimuth_time      (azimuth_time) datetime64[ns] ...
    line              (azimuth_time) int64 ...
Data variables:
    measurement       (azimuth_time, slant_range_time) complex64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              B
    mode:                                IW
    swaths:                              ['IW1', 'IW2', 'IW3']
    orbit_number:                        26269
    relative_orbit_number:               168
    ...
    geospatial_lon_max:                  12.093126
    group:                               /IW1/VH
    azimuth_anx_time:                    2210.634453
    burst_index:                         8
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...

```

### Calibration

*xarray-sentinel* provides helper functions to calibrate the data using the calibration metadata.
You can compute the gamma intensity for part of the Stripmap image above with:

```python
>>> xarray_sentinel.calibrate_intensity(
...     slc_s3_vh.measurement[:2048, :2048], slc_s3_vh_calibration.gamma
... )
<xarray.DataArray (azimuth_time: 2048, slant_range_time: 2048)> ...
dask.array<pow, shape=(2048, 2048), dtype=float32, chunksize=(2048, 2048), chunktype=numpy.ndarray>
Coordinates:
  * azimuth_time      (azimuth_time) datetime64[ns] ...
    line              (azimuth_time) int64 ...
  * slant_range_time  (slant_range_time) float64 ...
    pixel             (slant_range_time) int64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              A
    mode:                                SM
    swaths:                              ['S3']
    orbit_number:                        37258
    relative_orbit_number:               86
    ...
    geospatial_lat_min:                  -12.178835
    geospatial_lat_max:                  -10.859867
    geospatial_lon_min:                  42.772483
    geospatial_lon_max:                  43.757706
    units:                               m2 m-2
    long_name:                           gamma

```

### Advanced data access via fsspec

**Metadata is read through *fsspec* on any filesystem. Measurement data, instead, can
only be read from URL schemes that *rasterio* / *GDAL* opens natively (e.g. `http(s)`,
`s3`, `gs`, `az`): this covers the common remote access cases, such as the Copernicus
Data Space S3 store, but not compressed or chained filesystems like `zip://` or
`simplecache::`. See [#127](https://github.com/bopen/xarray-sentinel/issues/127).**

*xarray-sentinel* can read data from a variety of data stores including local file
systems, network file systems and cloud object stores, and metadata also from
compressed file formats like Zip.
This is done by passing *fsspec* compatible URLs to `xr.open_dataset` and optionally
the `storage_options` keyword argument.

For example you can open a product directly from a zip file with:

```python
>>> slc_iw_zip_path = "tests/data/S1B_IW_SLC__1SDV_20210401T052622_20210401T052650_026269_032297_EFA4.zip"
>>> xr.open_dataset(
...     f"zip://*/manifest.safe::{slc_iw_zip_path}", group="IW1/VH", engine="sentinel-1"
... )  # doctest: +SKIP
<xarray.Dataset> ...
Dimensions:           (pixel: 21632, line: 13509)
Coordinates:
  * pixel             (pixel) int64 ...
  * line              (line) int64 ...
    azimuth_time      (line) datetime64[ns] ...
    slant_range_time  (pixel) float64 ...
Data variables:
    measurement       (line, pixel) complex64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              B
    mode:                                IW
    swaths:                              ['IW1', 'IW2', 'IW3']
    orbit_number:                        26269
    relative_orbit_number:               168
    ...
    number_of_bursts:                    9
    lines_per_burst:                     1501
    group:                               /IW1/VH
    subgroups:                           ['orbit', 'attitude', 'azimuth_fm_ra...
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...

```

As an example of remote access, you can open a product directly from a GitHub repo with:

```python
>>> xr.open_dataset(
...     f"github://bopen:xarray-sentinel@/{slc_iw_zip_path}",
...     group="IW1/VH",
...     engine="sentinel-1",
... )  # doctest: +SKIP
<xarray.Dataset> ...
Dimensions:           (pixel: 21632, line: 13509)
Coordinates:
  * pixel             (pixel) int64 ...
  * line              (line) int64 ...
    azimuth_time      (line) datetime64[ns] ...
    slant_range_time  (pixel) float64 ...
Data variables:
    measurement       (line, pixel) complex64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              B
    mode:                                IW
    swaths:                              ['IW1', 'IW2', 'IW3']
    orbit_number:                        26269
    relative_orbit_number:               168
    ...
    number_of_bursts:                    9
    lines_per_burst:                     1501
    group:                               /IW1/VH
    subgroups:                           ['orbit', 'attitude', 'azimuth_fm_ra...
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...

```

*fsspec* is very powerful and supports caching and chaining, for example you can open a
zip file off a GitHub repo and cache the file locally with:

```python
>>> xr.open_dataset(
...     f"zip://*/manifest.safe::simplecache::github://bopen:xarray-sentinel@/{slc_iw_zip_path}",
...     engine="sentinel-1",
...     group="IW1/VH",
...     storage_options={
...         "simplecache": {"cache_storage": "/tmp/zipfiles/"},
...     },
... )  # doctest: +SKIP
<xarray.Dataset> ...
Dimensions:           (pixel: 21632, line: 13509)
Coordinates:
  * pixel             (pixel) int64 ...
  * line              (line) int64 ...
    azimuth_time      (line) datetime64[ns] ...
    slant_range_time  (pixel) float64 ...
Data variables:
    measurement       (line, pixel) complex64 ...
Attributes: ...
    family_name:                         SENTINEL-1
    number:                              B
    mode:                                IW
    swaths:                              ['IW1', 'IW2', 'IW3']
    orbit_number:                        26269
    relative_orbit_number:               168
    ...
    number_of_bursts:                    9
    lines_per_burst:                     1501
    group:                               /IW1/VH
    subgroups:                           ['orbit', 'attitude', 'azimuth_fm_ra...
    Conventions:                         CF-1.11
    history:                             created by xarray_sentinel-...

```

## Reference documentation

This is the list of the reference documents:

- Sentinel-1 on SentiWiki:
  - [user guides](https://sentiwiki.copernicus.eu/web/sentinel-1)
  - [documents](https://sentiwiki.copernicus.eu/web/s1-documents)
- [Sentinel-1 Product Specification v3.9 07 May 2021 S1-RS-MDA-52-7441-3-9 documenting IPF 3.40](https://sentinels.copernicus.eu/documents/247904/1877131/S1-RS-MDA-52-7441-3-9-2_Sentinel-1ProductSpecification.pdf)
- [Sentinel-1 Product Specification v3.7 27 February 2020 S1-RS-MDA-52-7441 documenting IPF 3.30](https://sentinels.copernicus.eu/documents/247904/1877131/Sentinel-1-Product-Specification)
- [Radiometric Calibration of S-1 Level-1 Products Generated by the S-1 IPF v1.0 21/05/2015 ESA-EOPG-CSCOP-TN-0002](https://sentinels.copernicus.eu/documents/247904/685163/S1-Radiometric-Calibration-V1.0.pdf)

## Design decisions

- The main design choice for *xarray-sentinel* is for it to be as much as viable a pure map of
  the content of the SAFE data package, with as little interpretation as possible.
  - The tree-like structure follows the structure of the SAFE package even when information,
    like orbit and attitude, is expected to be identical for different swaths.
    We observed at least a case where the number of orbital state vectors reported
    was different between swaths.
  - Data and metadata are converted to the closest available data-type in *Python* / *numpy*.
    The most significant conversion is from `CInt16` to `np.complex64` for the SLC measurements
    that double the space requirements for the data.
    Also, *xarray-sentinel* converts UTC times to `np.datetime64` and makes no attempt to support
    *leap seconds*, acquisitions containing leap seconds may crash or silently return corrupted data.
    See the rationale for choices of the coordinates data-types below.
  - We try to keep all naming as close as possible to the original names.
    In particular, for metadata we use the names of the XML tags, only converting them
    from *camelCase* to *snake_case*.
- Whenever possible *xarray-sentinel* indexes the data with physical coordinates
  `azimuth_time` and `slant_range_time`, but keeps image `line` and `pixel` as auxiliary coordinates.
- As an exception to the metadata naming rule above we add some attributes to get
  CF-Conventions compliance.
- We aim at opening available data and metadata even for partial SAFE packages, for example,
  *xarray-sentinel* can open a measurement dataset for a swath even when the TIFF files of other
  swaths / polarizations are missing.
- Accuracy considerations and rationale for coordinates data-types:
  - `azimuth_time` can be expressed as `np.datetime64[ns]` since
    spatial resolution at LEO speed is 10km/s * 1ns ~= 0.001cm.
  - `slant_range_time` on the other hand cannot be expressed as `np.timedelta64[ns]` as
    spatial resolution at the speed of light is 300_000km/s * 1ns / 2 ~= 15cm,
    i.e. not enough for interferometric applications.
    `slant_range_time` needs a spatial resolution of 0.001cm at a 1_000km distance,
    i.e. around 1e-9, well within the 1e-15 resolution of IEEE-754 float64.

## Project badges

[![on-push](https://github.com/bopen/xarray-sentinel/actions/workflows/on-push.yml/badge.svg)](https://github.com/bopen/xarray-sentinel/actions/workflows/on-push.yml)
[![codecov](https://codecov.io/gh/bopen/xarray-sentinel/branch/main/graph/badge.svg?token=OLw9it0i18)](https://codecov.io/gh/bopen/xarray-sentinel)

## Contributing

The main repository is hosted on GitHub.
Testing, bug reports and contributions are highly welcomed and appreciated:

<https://github.com/bopen/xarray-sentinel>

Lead developers:

- [Aureliana Barghini](https://github.com/aurghs) - [B-Open](https://www.bopen.eu)
- [Alessandro Amici](https://github.com/alexamici) - [B-Open](https://www.bopen.eu)

Main contributors:

- [Corrado Avolio](https://github.com/corrado9999) - [e-GEOS](https://www.e-geos.it)

See also the list of [contributors](https://github.com/bopen/xarray-sentinel/contributors) who participated in this project.

## Sponsoring

[B-Open](https://bopen.eu) commits to maintain the project long term and we are happy to accept sponsorships to develop new features.

We wish to express our gratitude to the project sponsors:

- [Microsoft](https://microsoft.com) has sponsored the support for *GRD* products and *fsspec* data access.

## License

```
Copyright 2021-2026, B-Open Solutions srl and the xarray-sentinel authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
