Skip to content
Merged
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
129 changes: 36 additions & 93 deletions examples/Sentinel_2_example_notebook/Sentinel2_example_notebook.ipynb
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "74b1ac03",
"metadata": {},
"source": [
"# Sentinel-2 example notebook"
]
},
{
"cell_type": "markdown",
"id": "79556fc6",
"metadata": {},
"source": [
"# Sentinel-2 example notebook\n",
"\n",
"This notebook showcases how to use `PASEOS` to simulate **Sentinel2-B (S2B)**. In particular, the notebook shows how to create `space_actors` orbiting as the **S2B** around Earth. In addition, it shows how to add a `power` device and demonstrates how to register activities to perform onboard data acquisition and processing to detect **volcanic eruptions** on `Sentinel-2 L1C data`. <br> **DISCLAIMER**: the notebook requires `rasterio` and `scikit-image` to run correctly, which is not included in the packets required to install `PASEOS`. To install `rasterio` you can use: <br><center> ```conda install -c conda-forge rasterio``` or alternatively ```pip install rasterio``` </center>\n",
"<br>To install `scikit-image` you can use: <br><center> ```conda install scikit-image``` or alternatively ```pip install scikit-image``` </center>"
]
Expand Down Expand Up @@ -65,15 +59,11 @@
"id": "3670f211",
"metadata": {},
"source": [
"# 1) - Instantiate Sentinel 2 space actors"
]
},
{
"cell_type": "markdown",
"id": "cd78d83a",
"metadata": {},
"source": [
"First of all, let's create the scaffolds for **S2B**. The scaffolds are objects which are not equipped with any `communication_device` nor `power_devices`. Furthermore, they neither have any `orbit`. "
"# 1) - Instantiate Sentinel 2 space actors\n",
"\n",
"First of all, let's create the scaffolds for **S2B**. The scaffolds are objects which are not equipped with any `communication_device` nor `power_devices`. Furthermore, they neither have any `orbit`. \n",
"\n",
"S2B will be the local actor, i.e. the one paseos models. In this example, we only model this one satellite."
]
},
{
Expand All @@ -92,15 +82,11 @@
"id": "ba6a533b",
"metadata": {},
"source": [
"#### 1.a) - Add an orbit for S2B"
]
},
{
"cell_type": "markdown",
"id": "9f77772e",
"metadata": {},
"source": [
"Since **S2B** is orbiting around Earth, let's define `earth` as `pykep.planet` object. "
"#### 1.a) - Add an orbit for S2B\n",
"\n",
"Since **S2B** is orbiting around Earth, let's define `earth` as `pykep.planet` object. \n",
"\n",
"Internally, paseos uses pykep.planet objects to model gravitational acceleration and Keplerian orbits."
]
},
{
Expand Down Expand Up @@ -169,14 +155,8 @@
"id": "d3cb8c32",
"metadata": {},
"source": [
"### 1.b) - Add communication and power devices"
]
},
{
"cell_type": "markdown",
"id": "c510ec67",
"metadata": {},
"source": [
"### 1.b) - Add communication and power devices\n",
"\n",
"Adding power devices. Max battery level: 102 Ah @ 28V is 2.81 kWh (effect of aging is neglected). To identify the charging rate, we are assuming to be dependent only by the power of solar panels. We are neglecting eventual charging rate limits due to battery technology. The solar-panels power is 2300 W at begin of life and 1730 W at end of life. <br> Please, refer to: [Copernicus: Sentinel-2](https://www.eoportal.org/satellite-missions/copernicus-sentinel-2#space-segment.)"
]
},
Expand All @@ -198,14 +178,8 @@
"id": "a1f00fd5",
"metadata": {},
"source": [
"# 2) - Instantiate PASEOS simulation"
]
},
{
"cell_type": "markdown",
"id": "8d7f07aa",
"metadata": {},
"source": [
"# 2) - Instantiate PASEOS simulation\n",
"\n",
"To instantiate `PASEOS`, we consider **S2B** as `local_actor`. The initial time is set to `today`."
]
},
Expand All @@ -216,28 +190,24 @@
"metadata": {},
"outputs": [],
"source": [
"cfg=load_default_cfg()\n",
"cfg=load_default_cfg() # loading cfg to modify defaults\n",
"cfg.sim.start_time=today.mjd2000 * pk.DAY2SEC # convert epoch to seconds\n",
"cfg.sim.activity_timestep = 0.5 # update rate for plots. \n",
"sim = paseos.init_sim(S2B, cfg)"
]
},
{
"cell_type": "markdown",
"id": "c0097d30",
"metadata": {},
"source": [
"## 3) - Dealing with PASEOS activities "
]
},
{
"cell_type": "markdown",
"id": "087004a9",
"metadata": {},
"source": [
"## 3) - Dealing with PASEOS activities \n",
"\n",
"Here we demonstrate how you can use `PASEOS` to perform activities. To this aim, we will use `detection of volcanic eruptions` as use case, assuming it will be possible to run it onboard `S2B`. <br>We exploit a simplified version of the algorithm `[1]`, which leverages the spectral bands `B8A`, `B11` and `B12` to create a binary-map containing pixels marked as thermal anomalies. To detect the volcanic eruptions, we cluster those pixels in bounding boxes and return their coordinates to simulate an alert creation. <br> We will assume `S2B` will acquire images and then process them by using [1]. In this notebook, we assume to be able to detect the following images regardless of their proper geographical position. We thank the `ESA` project `Sentinel2_L0` for providing images and the implementation of [1]. <br>\n",
"\n",
"**References**: <br>\n",
"`[1] Massimetti, Francesco, et al. \"\"Volcanic hot-spot detection using SENTINEL-2: a comparison with MODIS–MIROVA thermal data series.\"\" Remote Sensing 12.5 (2020): 820.`<br>\n",
"\n",
"The next cell will download the files that are needed to execute the next parts of the notebook. The files belong to the `Sentinel2_L0` dataset project (to be released soon with GPL license)."
]
},
Expand All @@ -259,19 +229,13 @@
" urllib.request.urlretrieve(\"https://actcloud.estec.esa.int/actcloud/index.php/s/e0MyilW1plYdehL/download\", \"Mayon_02.tif\")"
]
},
{
"cell_type": "markdown",
"id": "eb838004",
"metadata": {},
"source": [
"### 3.a) - PASEOS visualization "
]
},
{
"cell_type": "markdown",
"id": "105d2dcb",
"metadata": {},
"source": [
"### 3.a) - PASEOS visualization \n",
"\n",
"`PASEOS` offers a visualization tool that can be used to display the position of `S2B` around its orbit, the state of charge of the battery, and the name of the performed activity. <br>To enable the visualization, let's define a `plotter`. <br> **N.B.** `PASEOS` visualization is supported only for `Jupyter` but not for [Visual Studio Code](https://code.visualstudio.com/). "
]
},
Expand All @@ -291,14 +255,8 @@
"id": "33b8fa5f",
"metadata": {},
"source": [
"### 3.b) - Registering activities "
]
},
{
"cell_type": "markdown",
"id": "0f001501",
"metadata": {},
"source": [
"### 3.b) - Registering activities \n",
"\n",
"The next lines will show how to register an activity to simulate data acquisition on **S2B**. <Br>Each activity is bound to an `asynchronous function`. Let's define the asynchornous function `acquire_data_async()` as follow."
]
},
Expand Down Expand Up @@ -469,14 +427,8 @@
"id": "7f8b9b67",
"metadata": {},
"source": [
"### 3.c) - Performing activities."
]
},
{
"cell_type": "markdown",
"id": "b63750f7",
"metadata": {},
"source": [
"### 3.c) - Performing activities.\n",
"\n",
"We can now perform the activities. In scheduling the activities, we assume that data are acquired and stored into the mass memory to be, then, processed during the off part of the satellite duty cycle. Please, refer to: [Copernicus: Sentinel-2](https://www.eoportal.org/satellite-missions/copernicus-sentinel-2#space-segment.). <br> **N.B.** Notice that, when `sim.perform_activity(...)` is called, the keyword `await` is needed **only for Jupyter notebooks** to ensure the correct management of asynchronous functions. **Remove it otherwise**. "
]
},
Expand Down Expand Up @@ -524,14 +476,8 @@
"id": "08173794",
"metadata": {},
"source": [
"### 3.d) - Showing detected volcanic eruptions"
]
},
{
"cell_type": "markdown",
"id": "71073cdb",
"metadata": {},
"source": [
"### 3.d) - Showing detected volcanic eruptions\n",
"\n",
"The next plot will show an example of onboard coarse volcanic eruptions detection on some Sentinel-2 L1C tiles. The different eruptions will be surrounded a bounding box, and their coordinates will be printed to raise an alert."
]
},
Expand Down Expand Up @@ -567,21 +513,13 @@
" print(\"ALERT! Eruption found at: \\n\\t Top left corner(lon, lat): \"+str(coords[0]) +\"\\n\\t bottom right corner(lon, lat): \"+str(coords[1])+\"\\n\")\n",
" print(\"\\n\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "da80b45f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "paseos",
"display_name": "Python 3.10.6 ('paseos')",
"language": "python",
"name": "paseos"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -594,6 +532,11 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"vscode": {
"interpreter": {
"hash": "457d73575bcd07fce3b582d06bfae9446395c25f1ea618852d5f58e28a465e48"
}
}
},
"nbformat": 4,
Expand Down