From a4e82844abe1344afbad31757bdddc267aeaddbf Mon Sep 17 00:00:00 2001 From: DEGERICJ Date: Wed, 16 Oct 2024 12:48:47 +0200 Subject: [PATCH 1/5] fix visualization logger messages in terrascope notebooks --- src/worldcereal/utils/map.py | 60 +++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/src/worldcereal/utils/map.py b/src/worldcereal/utils/map.py index 68e59de2..5263f895 100644 --- a/src/worldcereal/utils/map.py +++ b/src/worldcereal/utils/map.py @@ -1,42 +1,46 @@ import geopandas as gpd from ipyleaflet import DrawControl, LayersControl, Map, SearchControl, basemaps +from IPython.display import display +from ipywidgets import widgets from loguru import logger from openeo_gfmap import BoundingBoxExtent from shapely import geometry from shapely.geometry import Polygon, shape -def handle_draw(instance, action, geo_json, area_limit=250): - if action == "created": - poly = Polygon(shape(geo_json.get("geometry"))) - bbox = poly.bounds - logger.info(f"Your processing extent: {bbox}") - - # We convert our bounding box to local UTM projection - # for further processing - bbox_utm, epsg = _latlon_to_utm(bbox) - area = (bbox_utm[2] - bbox_utm[0]) * (bbox_utm[3] - bbox_utm[1]) / 1000000 - logger.info(f"Area of processing extent: {area:.2f} km²") - - if area_limit is not None and area > area_limit: - logger.error( - f"Area of processing extent is too large. " - f"Please select an area smaller than {area_limit} km²." - ) +def handle_draw(instance, action, geo_json, output, area_limit=250): + with output: + if action == "created": + poly = Polygon(shape(geo_json.get("geometry"))) + bbox = poly.bounds + logger.info(f"Your processing extent: {bbox}") + + # We convert our bounding box to local UTM projection + # for further processing + bbox_utm, epsg = _latlon_to_utm(bbox) + area = (bbox_utm[2] - bbox_utm[0]) * (bbox_utm[3] - bbox_utm[1]) / 1000000 + logger.info(f"Area of processing extent: {area:.2f} km²") + + if area_limit is not None and area > area_limit: + logger.error( + f"Area of processing extent is too large. " + f"Please select an area smaller than {area_limit} km²." + ) + instance.last_draw = {"type": "Feature", "geometry": None} + + elif action == "deleted": + instance.clear() instance.last_draw = {"type": "Feature", "geometry": None} - elif action == "deleted": - instance.clear() - instance.last_draw = {"type": "Feature", "geometry": None} - - else: - raise ValueError(f"Unknown action: {action}") + else: + raise ValueError(f"Unknown action: {action}") class ui_map: def __init__(self, area_limit=250): from ipyleaflet import basemap_to_tiles + self.output = widgets.Output() self.area_limit = area_limit osm = basemap_to_tiles(basemaps.OpenStreetMap.Mapnik) osm.base = True @@ -70,7 +74,9 @@ def __init__(self, area_limit=250): # Wrapper to pass additional arguments def draw_handler(instance, action, geo_json): - handle_draw(instance, action, geo_json, area_limit=self.area_limit) + handle_draw( + instance, action, geo_json, self.output, area_limit=self.area_limit + ) # Attach the event listener to the draw control self.draw_control.on_draw(draw_handler) @@ -89,7 +95,11 @@ def draw_handler(instance, action, geo_json): self.poly = None def show_map(self): - return self.map + vbox = widgets.VBox( + [self.map, self.output], + layout={"height": "600px"}, + ) + return display(vbox) def get_processing_extent(self): From 290b8fcbbefbaf1ac81d45b1b0358da530f16b8e Mon Sep 17 00:00:00 2001 From: DEGERICJ Date: Wed, 16 Oct 2024 12:57:40 +0200 Subject: [PATCH 2/5] hard-code area limit of 750, also set default to 750 --- src/worldcereal/utils/map.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/worldcereal/utils/map.py b/src/worldcereal/utils/map.py index 5263f895..08eaea04 100644 --- a/src/worldcereal/utils/map.py +++ b/src/worldcereal/utils/map.py @@ -8,7 +8,7 @@ from shapely.geometry import Polygon, shape -def handle_draw(instance, action, geo_json, output, area_limit=250): +def handle_draw(instance, action, geo_json, output, area_limit): with output: if action == "created": poly = Polygon(shape(geo_json.get("geometry"))) @@ -21,7 +21,7 @@ def handle_draw(instance, action, geo_json, output, area_limit=250): area = (bbox_utm[2] - bbox_utm[0]) * (bbox_utm[3] - bbox_utm[1]) / 1000000 logger.info(f"Area of processing extent: {area:.2f} km²") - if area_limit is not None and area > area_limit: + if (area > area_limit) or (area > 750): logger.error( f"Area of processing extent is too large. " f"Please select an area smaller than {area_limit} km²." @@ -37,7 +37,7 @@ def handle_draw(instance, action, geo_json, output, area_limit=250): class ui_map: - def __init__(self, area_limit=250): + def __init__(self, area_limit=750): from ipyleaflet import basemap_to_tiles self.output = widgets.Output() From 789c02721e0bfecf063253144d4a4a0f30bcf9ae Mon Sep 17 00:00:00 2001 From: DEGERICJ Date: Wed, 16 Oct 2024 14:02:32 +0200 Subject: [PATCH 3/5] update processing area and credit consumption in notebooks --- .../worldcereal_v1_demo_custom_cropland.ipynb | 18 ++++++++++-------- ...real_v1_demo_custom_cropland_extended.ipynb | 18 ++++++++++-------- .../worldcereal_v1_demo_custom_croptype.ipynb | 18 ++++++++++-------- ...real_v1_demo_custom_croptype_extended.ipynb | 18 ++++++++++-------- .../worldcereal_v1_demo_default_cropland.ipynb | 18 ++++++++++-------- ...eal_v1_demo_default_cropland_extended.ipynb | 17 ++++++++++------- 6 files changed, 60 insertions(+), 47 deletions(-) diff --git a/notebooks/worldcereal_v1_demo_custom_cropland.ipynb b/notebooks/worldcereal_v1_demo_custom_cropland.ipynb index 55f98fab..0f74aa2e 100644 --- a/notebooks/worldcereal_v1_demo_custom_cropland.ipynb +++ b/notebooks/worldcereal_v1_demo_custom_cropland.ipynb @@ -13,9 +13,7 @@ "source": [ "### Introduction\n", "\n", - "This notebook guides you through the process of training a custom cropland classification model using publicly available and harmonized in-situ reference data for your area of interest. Afterwards, the model can be applied to your area and season of interest to generate a cropland extent map.\n", - "\n", - "Please note that for the purpose of this demo, the processing area is currently limited to 250 km² per model run. On average, one such run consumes 35 credits on the Copernicus Data Space Ecosystem." + "This notebook guides you through the process of training a custom cropland classification model using publicly available and harmonized in-situ reference data for your area of interest. Afterwards, the model can be applied to your area and season of interest to generate a cropland extent map." ] }, { @@ -51,14 +49,18 @@ "\n", "When running the code snippet below, an interactive map will be visualized.\n", "Click the Rectangle button on the left hand side of the map to start drawing your region of interest.\n", + "The widget will automatically store the coordinates of the last rectangle you drew on the map.\n", "\n", - "Currently, there is a maximum size of 250 km² for your area within this demo. Upon exceeding this limit, an error will be shown.\n", - "You can bypass this limit by altering the code below to:
\n", - "*map = ui_map(area_limit=750)*
\n", + "
\n", + "Processing area limitation:
\n", + "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage and long processing times.
\n", + "Upon exceeding this limit, an error will be shown, and you will need to draw a new rectangle.\n", "\n", - "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage (roughly 120 credits will be consumed for this size of a processing extent).\n", + "For testing purposes, we recommend you to select a small area (< 250 km²) in order to limit processing time and credit usage.\n", "\n", - "The widget will automatically store the coordinates of the last rectangle you drew on the map." + "A run of 250 km² will typically consume 35 credits and last between 15 and 20 mins.
\n", + "A run of 750 km² will typically consume 85 credits and last around 40 mins.\n", + "
" ] }, { diff --git a/notebooks/worldcereal_v1_demo_custom_cropland_extended.ipynb b/notebooks/worldcereal_v1_demo_custom_cropland_extended.ipynb index eaf6490c..70476ac7 100644 --- a/notebooks/worldcereal_v1_demo_custom_cropland_extended.ipynb +++ b/notebooks/worldcereal_v1_demo_custom_cropland_extended.ipynb @@ -13,9 +13,7 @@ "source": [ "### Introduction\n", "\n", - "This notebook guides you through the process of training a custom cropland classification model using publicly available and harmonized in-situ reference data for your area of interest. Afterwards, the model can be applied to your area and season of interest to generate a cropland extent map.\n", - "\n", - "Please note that for the purpose of this demo, the processing area is currently limited to 250 km² per model run. On average, one such run consumes 35 credits on the Copernicus Data Space Ecosystem." + "This notebook guides you through the process of training a custom cropland classification model using publicly available and harmonized in-situ reference data for your area of interest. Afterwards, the model can be applied to your area and season of interest to generate a cropland extent map." ] }, { @@ -51,14 +49,18 @@ "\n", "When running the code snippet below, an interactive map will be visualized.\n", "Click the Rectangle button on the left hand side of the map to start drawing your region of interest.\n", + "The widget will automatically store the coordinates of the last rectangle you drew on the map.\n", "\n", - "Currently, there is a maximum size of 250 km² for your area within this demo. Upon exceeding this limit, an error will be shown.\n", - "You can bypass this limit by altering the code below to:
\n", - "*map = ui_map(area_limit=750)*
\n", + "
\n", + "Processing area limitation:
\n", + "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage and long processing times.
\n", + "Upon exceeding this limit, an error will be shown, and you will need to draw a new rectangle.\n", "\n", - "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage (roughly 120 credits will be consumed for this size of a processing extent).\n", + "For testing purposes, we recommend you to select a small area (< 250 km²) in order to limit processing time and credit usage.\n", "\n", - "The widget will automatically store the coordinates of the last rectangle you drew on the map." + "A run of 250 km² will typically consume 35 credits and last between 15 and 20 mins.
\n", + "A run of 750 km² will typically consume 85 credits and last around 40 mins.\n", + "
" ] }, { diff --git a/notebooks/worldcereal_v1_demo_custom_croptype.ipynb b/notebooks/worldcereal_v1_demo_custom_croptype.ipynb index 14f2b6f8..2b273642 100644 --- a/notebooks/worldcereal_v1_demo_custom_croptype.ipynb +++ b/notebooks/worldcereal_v1_demo_custom_croptype.ipynb @@ -13,9 +13,7 @@ "source": [ "### Introduction\n", "\n", - "This notebook guides you through the process of training a custom crop type classification model using publicly available and harmonized in-situ reference data for your area and crop types of interest. Afterwards, the model can be applied to your season of interest to generate a crop type map.\n", - "\n", - "Please note that for the purpose of this demo, the processing area is limited to 250 km² per model run. On average, one such run consumes xxx credits on the Copernicus Data Space Ecosystem." + "This notebook guides you through the process of training a custom crop type classification model using publicly available and harmonized in-situ reference data for your area and crop types of interest. Afterwards, the model can be applied to your season of interest to generate a crop type map." ] }, { @@ -51,14 +49,18 @@ "\n", "When running the code snippet below, an interactive map will be visualized.\n", "Click the Rectangle button on the left hand side of the map to start drawing your region of interest.\n", + "The widget will automatically store the coordinates of the last rectangle you drew on the map.\n", "\n", - "Currently, there is a maximum size of 250 km² for your area within this demo. Upon exceeding this limit, an error will be shown.\n", - "You can bypass this limit by altering the code below to:
\n", - "*map = ui_map(area_limit=750)*
\n", + "
\n", + "Processing area limitation:
\n", + "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage and long processing times.
\n", + "Upon exceeding this limit, an error will be shown, and you will need to draw a new rectangle.\n", "\n", - "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage (roughly 120 credits will be consumed for this size of a processing extent).\n", + "For testing purposes, we recommend you to select a small area (< 250 km²) in order to limit processing time and credit usage.\n", "\n", - "The widget will automatically store the coordinates of the last rectangle you drew on the map." + "A run of 250 km² will typically consume 35 credits and last between 15 and 20 mins.
\n", + "A run of 750 km² will typically consume 120 credits and last up to 30 mins.\n", + "
" ] }, { diff --git a/notebooks/worldcereal_v1_demo_custom_croptype_extended.ipynb b/notebooks/worldcereal_v1_demo_custom_croptype_extended.ipynb index 1fff3dcf..6a8abd52 100644 --- a/notebooks/worldcereal_v1_demo_custom_croptype_extended.ipynb +++ b/notebooks/worldcereal_v1_demo_custom_croptype_extended.ipynb @@ -13,9 +13,7 @@ "source": [ "### Introduction\n", "\n", - "This notebook guides you through the process of training a custom crop type classification model using publicly available and harmonized in-situ reference data for your area and crop types of interest. Afterwards, the model can be applied to your season of interest to generate a crop type map.\n", - "\n", - "Please note that for the purpose of this demo, the processing area is limited to 250 km² per model run. On average, one such run consumes xxx credits on the Copernicus Data Space Ecosystem." + "This notebook guides you through the process of training a custom crop type classification model using publicly available and harmonized in-situ reference data for your area and crop types of interest. Afterwards, the model can be applied to your season of interest to generate a crop type map." ] }, { @@ -51,14 +49,18 @@ "\n", "When running the code snippet below, an interactive map will be visualized.\n", "Click the Rectangle button on the left hand side of the map to start drawing your region of interest.\n", + "The widget will automatically store the coordinates of the last rectangle you drew on the map.\n", "\n", - "Currently, there is a maximum size of 250 km² for your area within this demo. Upon exceeding this limit, an error will be shown.\n", - "You can bypass this limit by altering the code below to:
\n", - "*map = ui_map(area_limit=750)*
\n", + "
\n", + "Processing area limitation:
\n", + "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage and long processing times.
\n", + "Upon exceeding this limit, an error will be shown, and you will need to draw a new rectangle.\n", "\n", - "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage (roughly 120 credits will be consumed for this size of a processing extent).\n", + "For testing purposes, we recommend you to select a small area (< 250 km²) in order to limit processing time and credit usage.\n", "\n", - "The widget will automatically store the coordinates of the last rectangle you drew on the map." + "A run of 250 km² will typically consume 35 credits and last between 15 and 20 mins.
\n", + "A run of 750 km² will typically consume 120 credits and last up to 30 mins.\n", + "
" ] }, { diff --git a/notebooks/worldcereal_v1_demo_default_cropland.ipynb b/notebooks/worldcereal_v1_demo_default_cropland.ipynb index 569e0ba3..12efed1a 100644 --- a/notebooks/worldcereal_v1_demo_default_cropland.ipynb +++ b/notebooks/worldcereal_v1_demo_default_cropland.ipynb @@ -16,11 +16,9 @@ "This notebook contains a short demo on how to use the WorldCereal system to generate a cropland extent map for your area and season of interest.
\n", "The map is generated using a default model trained by the WorldCereal consortium to distinguish cropland from all other land use.\n", "\n", - "Please note that for the purpose of this demo, the processing area is currently limited to 250 km² per model run. On average, one such run consumes 35 credits on the Copernicus Data Space Ecosystem.\n", - "\n", "\n", "
\n", - "Cropland definition: \n", + "Cropland definition:
\n", "Cropland is defined here as land used for temporary crops, i.e. crops with a less-than-1-year growing cycle which must be newly sown or planted for further production after the harvest. Sugar cane, asparagus, and cassava are also considered temporary crops, even though they remain in the field for more than 1 year. This cropland definition thus excludes perennial crops as well as (temporary) pastures.\n", "
" ] @@ -58,14 +56,18 @@ "\n", "When running the code snippet below, an interactive map will be visualized.\n", "Click the Rectangle button on the left hand side of the map to start drawing your region of interest.\n", + "The widget will automatically store the coordinates of the last rectangle you drew on the map.\n", "\n", - "Currently, there is a maximum size of 250 km² for your area within this demo. Upon exceeding this limit, an error will be shown.\n", - "You can bypass this limit by altering the code below to:
\n", - "*map = ui_map(area_limit=750)*
\n", + "
\n", + "Processing area limitation:
\n", + "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage and long processing times.
\n", + "Upon exceeding this limit, an error will be shown, and you will need to draw a new rectangle.\n", "\n", - "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage (roughly 120 credits will be consumed for this size of a processing extent).\n", + "For testing purposes, we recommend you to select a small area (< 250 km²) in order to limit processing time and credit usage.\n", "\n", - "The widget will automatically store the coordinates of the last rectangle you drew on the map." + "A run of 250 km² will typically consume 35 credits and last between 15 and 20 mins.
\n", + "A run of 750 km² will typically consume 85 credits and last up to 40 mins.\n", + "
" ] }, { diff --git a/notebooks/worldcereal_v1_demo_default_cropland_extended.ipynb b/notebooks/worldcereal_v1_demo_default_cropland_extended.ipynb index 0e62d718..bec5f800 100644 --- a/notebooks/worldcereal_v1_demo_default_cropland_extended.ipynb +++ b/notebooks/worldcereal_v1_demo_default_cropland_extended.ipynb @@ -16,10 +16,9 @@ "This notebook contains a short demo on how to use the WorldCereal system to generate a cropland extent map for your area and season of interest.
\n", "The map is generated using a default model trained by the WorldCereal consortium to distinguish cropland from all other land use.\n", "\n", - "Please note that for the purpose of this demo, the processing area is currently limited to 250 km² per model run. On average, one such run consumes 35 credits on the Copernicus Data Space Ecosystem.\n", "\n", "
\n", - "Cropland definition: \n", + "Cropland definition:
\n", "Cropland is defined here as land used for temporary crops, i.e. crops with a less-than-1-year growing cycle which must be newly sown or planted for further production after the harvest. Sugar cane, asparagus, and cassava are also considered temporary crops, even though they remain in the field for more than 1 year. This cropland definition thus excludes perennial crops as well as (temporary) pastures.\n", "
" ] @@ -57,14 +56,18 @@ "\n", "When running the code snippet below, an interactive map will be visualized.\n", "Click the Rectangle button on the left hand side of the map to start drawing your region of interest.\n", + "The widget will automatically store the coordinates of the last rectangle you drew on the map.\n", "\n", - "Currently, there is a maximum size of 250 km² for your area within this demo. Upon exceeding this limit, an error will be shown.\n", - "You can bypass this limit by altering the code below to:
\n", - "*map = ui_map(area_limit=750)*
\n", + "
\n", + "Processing area limitation:
\n", + "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage and long processing times.
\n", + "Upon exceeding this limit, an error will be shown, and you will need to draw a new rectangle.\n", "\n", - "Processing areas beyond 750 km² are currently not supported to avoid excessive credit usage (roughly 120 credits will be consumed for this size of a processing extent).\n", + "For testing purposes, we recommend you to select a small area (< 250 km²) in order to limit processing time and credit usage.\n", "\n", - "The widget will automatically store the coordinates of the last rectangle you drew on the map." + "A run of 250 km² will typically consume 35 credits and last between 15 and 20 mins.
\n", + "A run of 750 km² will typically consume 85 credits and last around 40 mins.\n", + "
" ] }, { From 40ab443a259c5437fcf0464e88d0f70ae60ac69f Mon Sep 17 00:00:00 2001 From: DEGERICJ Date: Wed, 16 Oct 2024 14:59:02 +0200 Subject: [PATCH 4/5] added warning regarding file download on terrascope --- notebooks/worldcereal_v1_demo_custom_cropland.ipynb | 8 +++++++- .../worldcereal_v1_demo_custom_cropland_extended.ipynb | 6 ++++++ notebooks/worldcereal_v1_demo_custom_croptype.ipynb | 8 +++++++- .../worldcereal_v1_demo_custom_croptype_extended.ipynb | 6 ++++++ notebooks/worldcereal_v1_demo_default_cropland.ipynb | 8 +++++++- .../worldcereal_v1_demo_default_cropland_extended.ipynb | 6 ++++++ 6 files changed, 39 insertions(+), 3 deletions(-) diff --git a/notebooks/worldcereal_v1_demo_custom_cropland.ipynb b/notebooks/worldcereal_v1_demo_custom_cropland.ipynb index 0f74aa2e..9c43627a 100644 --- a/notebooks/worldcereal_v1_demo_custom_cropland.ipynb +++ b/notebooks/worldcereal_v1_demo_custom_cropland.ipynb @@ -358,7 +358,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The resulting raster files can be visualized in QGIS." + "The resulting raster files can be visualized in QGIS.\n", + "\n", + "
\n", + "WARNING:
\n", + "In case you run this notebook through the Terrascope environment, ALWAYS make sure you download the resulting files to your local system!
\n", + "The Terrascope environment will be cleaned automatically upon exit!\n", + "
" ] } ], diff --git a/notebooks/worldcereal_v1_demo_custom_cropland_extended.ipynb b/notebooks/worldcereal_v1_demo_custom_cropland_extended.ipynb index 70476ac7..5ad426d6 100644 --- a/notebooks/worldcereal_v1_demo_custom_cropland_extended.ipynb +++ b/notebooks/worldcereal_v1_demo_custom_cropland_extended.ipynb @@ -385,6 +385,12 @@ "source": [ "The resulting raster files can be visualized in QGIS.\n", "\n", + "
\n", + "WARNING:
\n", + "In case you run this notebook through the Terrascope environment, ALWAYS make sure you download the resulting files to your local system!
\n", + "The Terrascope environment will be cleaned automatically upon exit!\n", + "
\n", + "\n", "In case you are running this script on your local environment, you can alternatively use the following cells to visualize the outputs directly in this notebook." ] }, diff --git a/notebooks/worldcereal_v1_demo_custom_croptype.ipynb b/notebooks/worldcereal_v1_demo_custom_croptype.ipynb index 2b273642..5e501b55 100644 --- a/notebooks/worldcereal_v1_demo_custom_croptype.ipynb +++ b/notebooks/worldcereal_v1_demo_custom_croptype.ipynb @@ -359,7 +359,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The resulting raster files can be visualized in QGIS." + "The resulting raster files can be visualized in QGIS.\n", + "\n", + "
\n", + "WARNING:
\n", + "In case you run this notebook through the Terrascope environment, ALWAYS make sure you download the resulting files to your local system!
\n", + "The Terrascope environment will be cleaned automatically upon exit!\n", + "
" ] } ], diff --git a/notebooks/worldcereal_v1_demo_custom_croptype_extended.ipynb b/notebooks/worldcereal_v1_demo_custom_croptype_extended.ipynb index 6a8abd52..0eddcf35 100644 --- a/notebooks/worldcereal_v1_demo_custom_croptype_extended.ipynb +++ b/notebooks/worldcereal_v1_demo_custom_croptype_extended.ipynb @@ -392,6 +392,12 @@ "source": [ "The resulting raster files can be visualized in QGIS.\n", "\n", + "
\n", + "WARNING:
\n", + "In case you run this notebook through the Terrascope environment, ALWAYS make sure you download the resulting files to your local system!
\n", + "The Terrascope environment will be cleaned automatically upon exit!\n", + "
\n", + "\n", "In case you are running this script on your local environment, you can alternatively use the following cells to visualize the outputs directly in this notebook." ] }, diff --git a/notebooks/worldcereal_v1_demo_default_cropland.ipynb b/notebooks/worldcereal_v1_demo_default_cropland.ipynb index 12efed1a..d0a766c3 100644 --- a/notebooks/worldcereal_v1_demo_default_cropland.ipynb +++ b/notebooks/worldcereal_v1_demo_default_cropland.ipynb @@ -225,7 +225,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The resulting raster files can be visualized in QGIS." + "The resulting raster files can be visualized in QGIS.\n", + "\n", + "
\n", + "WARNING:
\n", + "In case you run this notebook through the Terrascope environment, ALWAYS make sure you download the resulting files to your local system!
\n", + "The Terrascope environment will be cleaned automatically upon exit!\n", + "
" ] }, { diff --git a/notebooks/worldcereal_v1_demo_default_cropland_extended.ipynb b/notebooks/worldcereal_v1_demo_default_cropland_extended.ipynb index bec5f800..b589c492 100644 --- a/notebooks/worldcereal_v1_demo_default_cropland_extended.ipynb +++ b/notebooks/worldcereal_v1_demo_default_cropland_extended.ipynb @@ -253,6 +253,12 @@ "source": [ "The resulting raster files can be visualized in QGIS.\n", "\n", + "
\n", + "WARNING:
\n", + "In case you run this notebook through the Terrascope environment, ALWAYS make sure you download the resulting files to your local system!
\n", + "The Terrascope environment will be cleaned automatically upon exit!\n", + "
\n", + "\n", "In case you are running this script on your local environment, you can alternatively use the following cells to visualize the outputs directly in this notebook." ] }, From 37c7013c128a7e1cc13bbaf95de369caff6d5d68 Mon Sep 17 00:00:00 2001 From: DEGERICJ Date: Wed, 16 Oct 2024 15:07:39 +0200 Subject: [PATCH 5/5] correct error message upon too large error --- src/worldcereal/utils/map.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/worldcereal/utils/map.py b/src/worldcereal/utils/map.py index 08eaea04..89f72eaf 100644 --- a/src/worldcereal/utils/map.py +++ b/src/worldcereal/utils/map.py @@ -1,4 +1,5 @@ import geopandas as gpd +import numpy as np from ipyleaflet import DrawControl, LayersControl, Map, SearchControl, basemaps from IPython.display import display from ipywidgets import widgets @@ -24,7 +25,7 @@ def handle_draw(instance, action, geo_json, output, area_limit): if (area > area_limit) or (area > 750): logger.error( f"Area of processing extent is too large. " - f"Please select an area smaller than {area_limit} km²." + f"Please select an area smaller than {np.min([area_limit, 750])} km²." ) instance.last_draw = {"type": "Feature", "geometry": None}