Skip to content

Commit

Permalink
Update notebook to match generate polygons cli
Browse files Browse the repository at this point in the history
  • Loading branch information
vikineema committed Nov 21, 2023
1 parent 4498264 commit 6fc9295
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions notebooks/GeneratePolygonsUsingTiles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@
"extent_threshold = 0.05\n",
"min_valid_observations = 60\n",
"raster_processing_plugin_name = \"ocean_filtering_using_hydrosheds\"\n",
"output_directory = \"s3://deafrica-waterbodiParameters to use when loading datasets.es-dev/waterbodies/v0.0.2\"\n",
"output_directory = \"s3://deafrica-waterbodies-dev/waterbodies/v0.0.2\"\n",
"overwrite = \"True\"\n",
"min_polygon_size = 4500\n",
"max_polygon_size = math.inf\n",
"length_threshold_km = 150\n",
"timeseries_directory = (\n",
" \"s3://deafrica-waterbodies-dev/waterbodies/v0.0.2/surface_area_change/\"\n",
")\n",
"file_name_prefix = \"waterbodies\"\n",
"land_sea_mask_fp = \"/g/data/deafrica-waterbodies/masks/af_msk_3s.tif\"\n",
"split_by_wofs_ls_regions = True"
"group_by_wofs_ls_regions = True\n",
"length_threshold_km = 150"
]
},
{
Expand Down Expand Up @@ -210,7 +210,7 @@
"metadata": {},
"outputs": [],
"source": [
"if split_by_wofs_ls_regions:\n",
"if group_by_wofs_ls_regions:\n",
" if not check_dir_exists(polygons_split_by_region_dir):\n",
" fs.mkdirs(polygons_split_by_region_dir, exist_ok=True)\n",
" _log.info(f\"Created directory {polygons_split_by_region_dir}\")"
Expand Down Expand Up @@ -463,18 +463,6 @@
"waterbodies_gdf = add_polygon_properties(polygons=waterbodies_gdf)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ff3e0a5e-0c4a-4d6a-8a07-81d105bd6130",
"metadata": {},
"outputs": [],
"source": [
"waterbodies_gdf = filter_by_length(\n",
" polygons_gdf=waterbodies_gdf, length_threshold_km=length_threshold_km\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -534,7 +522,11 @@
"metadata": {},
"outputs": [],
"source": [
"if split_by_wofs_ls_regions:\n",
"if group_by_wofs_ls_regions:\n",
" waterbodies_gdf_4326 = filter_by_length(\n",
" polygons_gdf=waterbodies_gdf_4326, length_threshold_km=length_threshold_km\n",
")\n",
" \n",
" split_by_region_fps = split_polygons_by_region(\n",
" polygons_gdf=waterbodies_gdf_4326,\n",
" output_directory=polygons_split_by_region_dir,\n",
Expand Down

0 comments on commit 6fc9295

Please sign in to comment.