|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 16, |
6 | | - "id": "2fa66062", |
| 5 | + "execution_count": 5, |
| 6 | + "id": "2e281cf0", |
7 | 7 | "metadata": {}, |
8 | 8 | "outputs": [], |
9 | 9 | "source": [ |
10 | | - "import geopandas as gpd\n", |
11 | | - "\n", |
12 | | - "gdf = gpd.read_file('test_area.geojson')\n", |
13 | | - "gdf = gdf.to_crs(epsg=4326)\n", |
14 | | - "area = eval(gdf.to_json())" |
| 10 | + "import openeo\n", |
| 11 | + "from openeo.processes import if_, is_nan\n", |
| 12 | + "from utils_BAP import (calculate_cloud_mask, calculate_cloud_coverage_score,\n", |
| 13 | + " calculate_date_score, calculate_distance_to_cloud_score,\n", |
| 14 | + " calculate_distance_to_cloud_score, aggregate_BAP_scores,\n", |
| 15 | + " create_rank_mask)" |
15 | 16 | ] |
16 | 17 | }, |
17 | 18 | { |
18 | 19 | "cell_type": "code", |
19 | | - "execution_count": 17, |
20 | | - "id": "initial_id", |
| 20 | + "execution_count": 6, |
| 21 | + "id": "4f6f5d9c", |
21 | 22 | "metadata": {}, |
22 | 23 | "outputs": [], |
23 | 24 | "source": [ |
24 | | - "temporal_extent = [\"2022-07-01\", \"2022-07-31\"]\n", |
25 | | - "max_cloud_cover = 70\n", |
| 25 | + "from openeo.api.process import Parameter\n", |
| 26 | + "\n", |
| 27 | + "temporal_parameter = Parameter.temporal_interval(\"temporal_extent\",description=\"Temporal extent specified as two-element array with start and end date/date-time.\")\n", |
| 28 | + "geojson_parameter = Parameter.geojson(\"geometry\",description=\"Geometries specified as GeoJSON object.\")\n", |
| 29 | + "#bands_parameter = Parameter.array(\"bands\",description=\"Sentinel-2 L2A bands to include in the composite.\",item_schema=[],default=[\"B04\",\"B03\",\"B02\"],optional=True)\n", |
| 30 | + "bands_parameter = Parameter.array(\n", |
| 31 | + " \"bands\",\n", |
| 32 | + " description=\"Sentinel-2 L2A bands to include in the composite.\",\n", |
| 33 | + " item_schema={\"type\": \"string\", \"enum\": [\n", |
| 34 | + " \"B02\",\n", |
| 35 | + " \"B03\",\n", |
| 36 | + " \"B04\",\n", |
| 37 | + " \"B05\",\n", |
| 38 | + " \"B06\",\n", |
| 39 | + " \"B07\",\n", |
| 40 | + " \"B08\",\n", |
| 41 | + " \"B8A\",\n", |
| 42 | + " \"B11\",\n", |
| 43 | + " \"B12\"\n", |
| 44 | + " ]},\n", |
| 45 | + " default=[\"B04\", \"B03\", \"B02\"],\n", |
| 46 | + " optional=True\n", |
| 47 | + ")\n", |
| 48 | + "bands_parameter.schema[\"minItems\"] = 1\n", |
| 49 | + "\n", |
| 50 | + "# Max cloud cover parameter\n", |
| 51 | + "max_cloud_cover_parameter = Parameter.integer(\n", |
| 52 | + " \"max_cloud_cover\",\n", |
| 53 | + " description=\"Maximum cloud cover percentage allowed.\",\n", |
| 54 | + " optional=True,\n", |
| 55 | + " default=75\n", |
| 56 | + ")\n", |
| 57 | + "max_cloud_cover_parameter.schema[\"minimum\"] = 0\n", |
| 58 | + "max_cloud_cover_parameter.schema[\"maximum\"] = 100\n", |
| 59 | + "\n", |
26 | 60 | "spatial_resolution = 20" |
27 | 61 | ] |
28 | 62 | }, |
|
36 | 70 | }, |
37 | 71 | { |
38 | 72 | "cell_type": "code", |
39 | | - "execution_count": 18, |
40 | | - "id": "0b7ecc8f", |
41 | | - "metadata": {}, |
42 | | - "outputs": [], |
43 | | - "source": [ |
44 | | - "import openeo\n", |
45 | | - "from openeo.processes import if_, is_nan\n", |
46 | | - "from utils_BAP import (calculate_cloud_mask, calculate_cloud_coverage_score,\n", |
47 | | - " calculate_date_score, calculate_distance_to_cloud_score,\n", |
48 | | - " calculate_distance_to_cloud_score, aggregate_BAP_scores,\n", |
49 | | - " create_rank_mask)" |
50 | | - ] |
51 | | - }, |
52 | | - { |
53 | | - "cell_type": "code", |
54 | | - "execution_count": 19, |
| 73 | + "execution_count": null, |
55 | 74 | "id": "024e8df8", |
56 | 75 | "metadata": {}, |
57 | 76 | "outputs": [ |
|
68 | 87 | ] |
69 | 88 | }, |
70 | 89 | { |
71 | | - "cell_type": "code", |
72 | | - "execution_count": null, |
| 90 | + "cell_type": "markdown", |
73 | 91 | "id": "10bee4a7", |
74 | 92 | "metadata": {}, |
75 | | - "outputs": [], |
76 | 93 | "source": [ |
77 | 94 | "Change the parameters of the datacube to be adjustable parameters." |
78 | 95 | ] |
79 | 96 | }, |
80 | 97 | { |
81 | 98 | "cell_type": "code", |
82 | | - "execution_count": 20, |
| 99 | + "execution_count": null, |
83 | 100 | "id": "02bed3d6", |
84 | 101 | "metadata": {}, |
85 | 102 | "outputs": [], |
86 | 103 | "source": [ |
87 | | - "from openeo.api.process import Parameter\n", |
88 | | - "\n", |
89 | | - "temporal_parameter = Parameter.temporal_interval(\"temporal_extent\",description=\"Temporal extent specified as two-element array with start and end date/date-time.\")\n", |
90 | | - "geojson_parameter = Parameter.geojson(\"geometry\",description=\"Geometries specified as GeoJSON object.\")\n", |
91 | | - "#bands_parameter = Parameter.array(\"bands\",description=\"Sentinel-2 L2A bands to include in the composite.\",item_schema=[],default=[\"B04\",\"B03\",\"B02\"],optional=True)\n", |
92 | | - "bands_parameter = Parameter.array(\n", |
93 | | - " \"bands\",\n", |
94 | | - " description=\"Sentinel-2 L2A bands to include in the composite.\",\n", |
95 | | - " item_schema={\"type\": \"string\", \"enum\": [\n", |
96 | | - " \"B02\",\n", |
97 | | - " \"B03\",\n", |
98 | | - " \"B04\",\n", |
99 | | - " \"B05\",\n", |
100 | | - " \"B06\",\n", |
101 | | - " \"B07\",\n", |
102 | | - " \"B08\",\n", |
103 | | - " \"B8A\",\n", |
104 | | - " \"B11\",\n", |
105 | | - " \"B12\"\n", |
106 | | - " ]},\n", |
107 | | - " default=[\"B04\", \"B03\", \"B02\"],\n", |
108 | | - " optional=True\n", |
109 | | - ")\n", |
110 | | - "bands_parameter.schema[\"minItems\"] = 1\n", |
111 | | - "\n", |
112 | | - "# Max cloud cover parameter\n", |
113 | | - "max_cloud_cover_parameter = Parameter.integer(\n", |
114 | | - " \"max_cloud_cover\",\n", |
115 | | - " description=\"Maximum cloud cover percentage allowed.\",\n", |
116 | | - " optional=True,\n", |
117 | | - " default=70\n", |
118 | | - ")\n", |
119 | | - "max_cloud_cover_parameter.schema[\"minimum\"] = 0\n", |
120 | | - "max_cloud_cover_parameter.schema[\"maximum\"] = 100\n", |
121 | | - "\n", |
122 | 104 | "scl = c.load_collection(\n", |
123 | 105 | " \"SENTINEL2_L2A\",\n", |
124 | 106 | " temporal_extent=temporal_parameter,\n", |
|
139 | 121 | }, |
140 | 122 | { |
141 | 123 | "cell_type": "code", |
142 | | - "execution_count": 21, |
| 124 | + "execution_count": null, |
143 | 125 | "id": "6917600f", |
144 | 126 | "metadata": {}, |
145 | 127 | "outputs": [], |
|
170 | 152 | }, |
171 | 153 | { |
172 | 154 | "cell_type": "code", |
173 | | - "execution_count": 22, |
| 155 | + "execution_count": null, |
174 | 156 | "id": "902b6c0b", |
175 | 157 | "metadata": {}, |
176 | 158 | "outputs": [], |
177 | 159 | "source": [ |
178 | | - "coverage_score = calculate_cloud_coverage_score(cloud_mask, area, scl)" |
| 160 | + "spatial_parameter = Parameter.spatial_extent(\"spatial_extent\",description=\"Spatial extent specified as GeoJSON object.\")\n", |
| 161 | + "\n", |
| 162 | + "coverage_score = calculate_cloud_coverage_score(cloud_mask, geojson_parameter, scl)" |
179 | 163 | ] |
180 | 164 | }, |
181 | 165 | { |
|
196 | 180 | }, |
197 | 181 | { |
198 | 182 | "cell_type": "code", |
199 | | - "execution_count": 23, |
| 183 | + "execution_count": null, |
200 | 184 | "id": "6755378a983548f4", |
201 | 185 | "metadata": {}, |
202 | 186 | "outputs": [ |
|
232 | 216 | }, |
233 | 217 | { |
234 | 218 | "cell_type": "code", |
235 | | - "execution_count": 24, |
| 219 | + "execution_count": null, |
236 | 220 | "id": "c7296546", |
237 | 221 | "metadata": {}, |
238 | 222 | "outputs": [], |
|
258 | 242 | }, |
259 | 243 | { |
260 | 244 | "cell_type": "code", |
261 | | - "execution_count": 25, |
| 245 | + "execution_count": null, |
262 | 246 | "id": "e1a5f38e07ba21b5", |
263 | 247 | "metadata": {}, |
264 | 248 | "outputs": [], |
|
286 | 270 | }, |
287 | 271 | { |
288 | 272 | "cell_type": "code", |
289 | | - "execution_count": 26, |
| 273 | + "execution_count": null, |
290 | 274 | "id": "43a33914", |
291 | 275 | "metadata": {}, |
292 | 276 | "outputs": [], |
|
304 | 288 | }, |
305 | 289 | { |
306 | 290 | "cell_type": "code", |
307 | | - "execution_count": 27, |
| 291 | + "execution_count": null, |
308 | 292 | "id": "a2933409", |
309 | 293 | "metadata": {}, |
310 | 294 | "outputs": [], |
|
329 | 313 | }, |
330 | 314 | { |
331 | 315 | "cell_type": "code", |
332 | | - "execution_count": 29, |
| 316 | + "execution_count": null, |
333 | 317 | "id": "14d62234", |
334 | 318 | "metadata": {}, |
335 | 319 | "outputs": [], |
|
0 commit comments