Skip to content

Commit

Permalink
feat: updated notebook to use mogpr_s1_s2 service
Browse files Browse the repository at this point in the history
  • Loading branch information
JanssenBrm committed Feb 19, 2024
1 parent e526a0b commit 329eacd
Showing 1 changed file with 82 additions and 54 deletions.
136 changes: 82 additions & 54 deletions notebooks/OpenEO/FuseTS - MOGPR Full Workflow-.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"id": "3d58e2f2"
},
"source": [
"# FuseTS - MOGPR / Phenology openEO Workflow\n",
"# FuseTS - MOGPR S1 S2 / Phenology openEO Workflow\n",
"\n",
"In this notebook, we'll demonstrate how to use openEO's diverse capabilities to build a workflow for fusing data and executing time series analysis. In this particular case, we'll integrate both FuseTS's MOGPR service and the Phenology service into a single workflow to compute phenology metrics for a specific field. The end product of this process will be a NetCDF file containing the final phenology metrics.\n",
"\n",
Expand Down Expand Up @@ -52,22 +52,22 @@
"Requirement already satisfied: openeo in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (0.22.0)\n",
"Requirement already satisfied: xarray>=0.12.3 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from openeo) (2023.1.0)\n",
"Requirement already satisfied: numpy>=1.17.0 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from openeo) (1.23.5)\n",
"Requirement already satisfied: shapely>=1.6.4 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from openeo) (2.0.1)\n",
"Requirement already satisfied: deprecated>=1.2.12 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from openeo) (1.2.14)\n",
"Requirement already satisfied: requests>=2.26.0 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from openeo) (2.31.0)\n",
"Requirement already satisfied: pandas>0.20.0 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from openeo) (2.0.3)\n",
"Requirement already satisfied: deprecated>=1.2.12 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from openeo) (1.2.14)\n",
"Requirement already satisfied: shapely>=1.6.4 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from openeo) (2.0.1)\n",
"Requirement already satisfied: wrapt<2,>=1.10 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from deprecated>=1.2.12->openeo) (1.15.0)\n",
"Requirement already satisfied: tzdata>=2022.1 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from pandas>0.20.0->openeo) (2023.3)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from pandas>0.20.0->openeo) (2.8.2)\n",
"Requirement already satisfied: pytz>=2020.1 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from pandas>0.20.0->openeo) (2023.3)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from requests>=2.26.0->openeo) (3.2.0)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from requests>=2.26.0->openeo) (2.0.4)\n",
"Requirement already satisfied: tzdata>=2022.1 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from pandas>0.20.0->openeo) (2023.3)\n",
"Requirement already satisfied: idna<4,>=2.5 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from requests>=2.26.0->openeo) (3.4)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from requests>=2.26.0->openeo) (2.0.4)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from requests>=2.26.0->openeo) (2023.7.22)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from requests>=2.26.0->openeo) (3.2.0)\n",
"Requirement already satisfied: packaging>=21.3 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from xarray>=0.12.3->openeo) (23.1)\n",
"Requirement already satisfied: six>=1.5 in /Users/bramjanssen/projects/vito/FuseTS/venv_clean_v2/lib/python3.8/site-packages (from python-dateutil>=2.8.2->pandas>0.20.0->openeo) (1.16.0)\n",
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.1\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
]
}
Expand All @@ -78,7 +78,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 32,
"id": "35b24fd9",
"metadata": {
"id": "35b24fd9",
Expand All @@ -92,6 +92,7 @@
"\n",
"import numpy as np\n",
"import openeo\n",
"from openeo.metadata import CollectionMetadata, BandDimension, Band\n",
"from ipyleaflet import GeoJSON, Map, basemaps\n",
"\n",
"warnings.filterwarnings(\"ignore\")"
Expand Down Expand Up @@ -161,7 +162,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "162e09e71bc545fd9722fba32776af89",
"model_id": "c03a5e97fca942e6bd2130e4050bd8e2",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -230,37 +231,23 @@
"source": [
"# Creating the fused data set using MOGPR\n",
"\n",
"In the following section, we will leverage the capabilities of openEO to generate a fused dataset using MOGPR. We start by creating an NDVI data cube that will delivered as input for the MOGPR algorithm."
"In the following section, we will leverage the capabilities of openEO to generate a fused dataset using MOGPR."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "dbd5f5dd-69e6-4d16-ad76-51827f262d2f",
"metadata": {},
"outputs": [],
"source": [
"base = connection.load_collection('SENTINEL2_L2A',\n",
" spatial_extent=spat_ext,\n",
" temporal_extent=temp_ext,\n",
" bands=[\"B04\", \"B08\", \"SCL\"])\n",
"base_cloudmasked = base.process(\"mask_scl_dilation\", data=base, scl_band_name=\"SCL\")\n",
"base_ndvi = base_cloudmasked.ndvi(red=\"B04\", nir=\"B08\")\n",
"base_ndvi = base_ndvi.mask_polygon(spat_ext)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 33,
"id": "77b3f539-b919-43fb-b7c5-31c2853c4c7c",
"metadata": {},
"outputs": [],
"source": [
"service = 'mogpr'\n",
"service = 'mogpr_s1_s2'\n",
"namespace = 'u:fusets'\n",
"mogpr = connection.datacube_from_process(service,\n",
" namespace=f'https://openeo.vito.be/openeo/1.1/processes/{namespace}/{service}',\n",
" data=base_ndvi)"
" polygon=spat_ext, date=temp_ext, s1_collection='RVI ASC', s2_collection='NDVI')\n",
"\n",
"mogpr.metadata = CollectionMetadata(metadata={},dimensions=[BandDimension(name='bands',bands=[Band('RVI ASC'),Band('NDVI')])])"
]
},
{
Expand All @@ -275,7 +262,17 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 34,
"id": "4020eb1a-61b1-4772-a8a0-956c779e7ade",
"metadata": {},
"outputs": [],
"source": [
"mogpr_ndvi = mogpr.band('NDVI')"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "e958e430-4764-40e4-a1a2-9f1de71ffcd7",
"metadata": {},
"outputs": [],
Expand All @@ -284,7 +281,7 @@
"namespace = 'u:fusets'\n",
"phenology = connection.datacube_from_process(service,\n",
" namespace=f'https://openeo.vito.be/openeo/1.1/processes/{namespace}/{service}',\n",
" data=mogpr)"
" data=mogpr_ndvi)"
]
},
{
Expand All @@ -298,35 +295,66 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 36,
"id": "db4ac328-5413-4304-b1a5-b1c6dd6710fc",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0:00:00 Job 'j-231103942daa4b16ad60d3c9967d9452': send 'start'\n",
"0:00:22 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:00:27 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:00:34 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:00:42 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:00:53 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:01:05 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:01:21 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:01:41 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:02:05 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:02:36 Job 'j-231103942daa4b16ad60d3c9967d9452': queued (progress N/A)\n",
"0:03:13 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:04:00 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:04:59 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:05:59 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:07:00 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:08:00 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:09:01 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:10:02 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:11:03 Job 'j-231103942daa4b16ad60d3c9967d9452': running (progress N/A)\n",
"0:12:04 Job 'j-231103942daa4b16ad60d3c9967d9452': finished (progress N/A)\n"
"0:00:00 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': send 'start'\n",
"0:01:19 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': queued (progress N/A)\n",
"0:01:46 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': queued (progress N/A)\n",
"0:01:52 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': queued (progress N/A)\n",
"0:02:00 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': queued (progress N/A)\n",
"0:02:10 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': queued (progress N/A)\n",
"0:02:23 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': queued (progress N/A)\n",
"0:02:39 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:02:58 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:03:23 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:03:53 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:04:31 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:05:18 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:06:17 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:07:17 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:08:17 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:09:18 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:10:18 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:11:18 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:12:19 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:13:19 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:14:19 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:15:22 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:16:22 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:17:23 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:18:23 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:19:24 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:20:25 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:21:26 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:22:27 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:23:28 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:24:28 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:25:28 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:26:29 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:27:29 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:28:30 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:29:30 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:30:31 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:31:31 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:32:31 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:33:32 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:34:32 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:35:33 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:36:33 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:37:34 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:38:35 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:39:35 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:40:35 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:41:36 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:42:36 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:43:37 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': running (progress N/A)\n",
"0:44:37 Job 'j-2402193c2fcb4fd2bf3b57a94dfd2024': finished (progress N/A)\n"
]
}
],
Expand Down Expand Up @@ -426,7 +454,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.8.17"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit 329eacd

Please sign in to comment.