Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Changes from previous releases are listed below.
- Fasten up padding to 366 days _(see #54)_
- Radiometric calibration of Sentinel-1 _(see #47)_
- Downloading Sentinel-1 data and make it usable together with Sentinel-2 _(see #43)_
- Replace Sentinel-1 preprocessing with esa-snappy _(see #60)_

## 0.3.1 (2024-07-29)
- Remove country_code variable in collector downloader _(see #33)_
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,46 @@ The recommended installation method is [pip](https://pip.pypa.io/en/stable/)-ins
$ python -Im pip install eurocropsml
```

#### Installation of esa-snappy
During Sentinel-1 pre-processing, we make use of the Python plugin `esa-snappy` which enables us to use the SNAP Java API from Python.
In order to be able to import `esa-snappy` into Python, please follow the following steps:
##### 1. Download your matching `Sentinel Toolboxes` [installation file](https://step.esa.int/main/download/snap-download/).
##### 2. If you are using a VM via ssh connection, ssh into your VM using the `-X`-option to later be able to start the SNAP GUI. E.g.
```console
$ ssh -i ~/.ssh/key -X user@ip-address>
```
For MacOS users:
TODO
##### 3. Start the installation of your downloaded installation file, e.g. for Linux and SNAP version 11.0.0:
```console
$ bash esa-nap_sentinel_linux-11.0.0.sh
```
This should start the GUI. Follow the installation steps. Install all components except the "optical Toolbox" which isn't necessary.
##### 4. Install the `esa-snappy` plugin (cf. [official installation guide](https://senbox.atlassian.net/wiki/spaces/SNAP/pages/2499051521/Configure+Python+to+use+the+new+SNAP-Python+esa_snappy+interface+SNAP+version+10))
1. Run SNAP Desktop by running `$ ./snap` inside the bin folder of your esa-snap directory, e.g. `../esa-snap/bin/`
2. Open the Plugin Manager in SNAP Desktop (Tools → Plugins in the main menu bar)
3. Select tab `Available Plugins`. Among others, the plugin `ESA SNAPPY` appears in the list
4. Select `ESA SNAPPY`, click `Install`, and follow the installation steps as described in the dialogs.
5. After restart of SNAP Desktop, ‘ESA SNAPPY’ will be visible in the list of installed plugins.

##### 5. Configure the `esa-snappy` plugin (cf. [official installation guide](https://senbox.atlassian.net/wiki/spaces/SNAP/pages/2499051521/Configure+Python+to+use+the+new+SNAP-Python+esa_snappy+interface+SNAP+version+10))
With the `esa-snappy` plugin being installed, open a command line window at the bin folder of the SNAP installation directory. We recommend to directly place the plugin in your environment's site packages. In order to do so, type
Unix/MacOS:
```console
$ ./snappy-conf <python-exe> <esa_snappy-dir>
```
Windows:
```console
$ snappy-conf <python-exe> <esa_snappy-dir>
```
with `<esa_snappy-dir>` being for example the `..\lib\python3.10\site-packages` folder of your Python environment.
##### 6. `esa-snappy` can now be imported via
```python
import esa-snappy
```



### Usage Guide
The quickest way to interact with the `eurocropsml` package and get started is to use the `EuroCropsML` dataset is via the provided command-line interface (CLI).

Expand Down
2 changes: 1 addition & 1 deletion docs/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ In order to obtain the observation data for a given country and year, the follow
{any}`NUTS regions<eurocropsml.acquisition.region>`: Add NUTS1-NUTS3 regions. The shapefiles for the NUTS-regions have been obtained from [Eurostat](https://ec.europa.eu/eurostat/de/web/gisco/geodata/statistical-units/territorial-units-statistics).

:::{note}
By default, the Sentinel-1 data is acquired at processing level LEVEL1, utilizing the IW operational mode. Additionally, the observations are selected for the VH and VV polarization. The pipeline provides the median pixel value of radar backscatter in decibels (dB). For information on how to to remove thermal noise, please see {doc}`Examples<examples>`.
By default, the Sentinel-1 data is acquired at processing level LEVEL1, utilizing the IW operational mode. Additionally, the observations are selected for the VH and VV polarization. The pipeline provides the median pixel value of radar backscatter in decibels (dB).
:::

:::{note}
Expand Down
6 changes: 0 additions & 6 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ Additional settings can also be added, e.g.
```console
$ eurocropsml-cli acquisition eurocrops <COMMAND> cfg.country_config.satellite="S1" +cfg.country_config.operational_mode="EW"
```

By default, thermal noise will not be removed for Sentinel-1. If wanting to do so, please use the following command:
```console
$ eurocropsml-cli acquisition eurocrops <COMMAND> cfg.country_config.satellite="S1" +cfg.country_config.denoise=True
```

Please see {any}`config<eurocropsml.acquisition.config>` for the Sentinel-1 defaults and possible other values.

## Customizing the dataset pipeline
Expand Down
170 changes: 0 additions & 170 deletions eurocropsml/acquisition/clipping/calibration.py

This file was deleted.

12 changes: 4 additions & 8 deletions eurocropsml/acquisition/clipping/clipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,18 @@ def _filter_args(

def _process_raster_parallel(
satellite: Literal["S1", "S2"],
denoise: bool,
polygon_df: pd.DataFrame,
parcel_id_name: str,
bands: list[str],
filtered_images: gpd.GeoDataFrame,
band_tiles: list[Path],
) -> pd.DataFrame:
"""Processing one raster file.

Args:
satellite: S1 for Sentinel-1 and S2 for Sentinel-2.
denoise: Whether to perform thermal noise removal for Sentinel-1.
For Sentinel-2 this argument has no effect.
polygon_df: Dataframe containing all parcel ids. Will be merged with the clipped values.
parcel_id_name: The country's parcel ID name (varies from country to country).
filtered_images: Dataframe containing all parcel ids that lie in this raster tile.
bands: (Sub-)set of Sentinel-1 (radar) or Sentinel-2 (spectral) bands.
band_tiles: Paths to the raster's band tiles.

Returns:
Expand All @@ -197,7 +192,7 @@ def _process_raster_parallel(
filtered_geom = polygon_df[polygon_df[parcel_id_name].isin(parcel_ids)]

result = mask_polygon_raster(
satellite, band_tiles, bands, filtered_geom, parcel_id_name, product_date, denoise
satellite, band_tiles, filtered_geom, parcel_id_name, product_date
)

if result is not None:
Expand Down Expand Up @@ -255,10 +250,8 @@ def clipping(
func = partial(
_process_raster_parallel,
config.satellite,
config.denoise,
polygon_df,
cast(str, config.parcel_id_name),
config.bands,
)

polygon_df = polygon_df.drop(["geometry"], axis=1)
Expand All @@ -267,6 +260,9 @@ def clipping(

new_data: bool = False
if processed < len(args):
if config.satellite == "S1":
# needed for esa_snappy
mp_orig.set_start_method("spawn", force=True)
new_data = True
logger.info("Starting parallel raster clipping...")
te = tqdm(total=len(args) - processed, desc="Clipping raster tiles.")
Expand Down
Loading
Loading