From 84715069bee3ae420ec9ee62635d4f0746b55e8f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 19:49:55 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../KAZ_SCADR_UrbanizationReview/Urban_metrics_Fullness.ipynb | 2 +- .../KAZ_SCADR_UrbanizationReview/Urban_metrics_Shape.ipynb | 4 ++-- .../KAZ_SCADR_UrbanizationReview/Urban_metrics_Sprawl.ipynb | 2 +- .../Urban_metrics_Structure.ipynb | 2 +- .../Implementations/URB_SEAU1_B_A_Ka_ExtractDataUrban.ipynb | 2 +- .../WBGAPI_Extract_urbanization_GDP.ipynb | 2 +- .../URB_SEAU1_NovelUrbanization/novelUrbanization.py | 2 +- .../URB_SURDR_ZAF_Energy_Transition/Data_Preparation.ipynb | 2 +- .../URB_SURDR_ZAF_Energy_Transition/Zonal_statistics.ipynb | 2 +- src/GOSTurban/urban_helper.py | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Fullness.ipynb b/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Fullness.ipynb index 8ce2dc5..f152de7 100755 --- a/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Fullness.ipynb +++ b/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Fullness.ipynb @@ -277,7 +277,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(f\"total time to process: {time.time()-start_time}\")" + "print(f\"total time to process: {time.time() - start_time}\")" ] } ], diff --git a/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Shape.ipynb b/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Shape.ipynb index a5b7fb9..0524757 100755 --- a/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Shape.ipynb +++ b/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Shape.ipynb @@ -362,7 +362,7 @@ "\n", " # calculate detour index (circle / shape)...\n", " detourIndex = p / hullPerim\n", - " metrics[\"DispersionIndex\" \"DispersionIndex\"] = detourIndex\n", + " metrics[\"DispersionIndexDispersionIndex\"] = detourIndex\n", "\n", " # Range index\n", " # custom tool identifies perimeter points that are farthest apart, outputs\n", @@ -448,7 +448,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(f\"total time to process: {time.time()-start_time}\")" + "print(f\"total time to process: {time.time() - start_time}\")" ] } ], diff --git a/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Sprawl.ipynb b/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Sprawl.ipynb index 8a25579..f400077 100755 --- a/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Sprawl.ipynb +++ b/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Sprawl.ipynb @@ -381,7 +381,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(f\"total time to process: {time.time()-start_time}\")" + "print(f\"total time to process: {time.time() - start_time}\")" ] } ], diff --git a/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Structure.ipynb b/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Structure.ipynb index 9fde5b1..c6b3cfd 100755 --- a/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Structure.ipynb +++ b/notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Structure.ipynb @@ -254,7 +254,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(f\"total time to process: {time.time()-start_time}\")" + "print(f\"total time to process: {time.time() - start_time}\")" ] } ], diff --git a/notebooks/Implementations/URB_SEAU1_B_A_Ka_ExtractDataUrban.ipynb b/notebooks/Implementations/URB_SEAU1_B_A_Ka_ExtractDataUrban.ipynb index 7dcee24..4c8c4fd 100644 --- a/notebooks/Implementations/URB_SEAU1_B_A_Ka_ExtractDataUrban.ipynb +++ b/notebooks/Implementations/URB_SEAU1_B_A_Ka_ExtractDataUrban.ipynb @@ -430,7 +430,7 @@ " cur_smod = (smod == val).astype(int)\n", " cur_pop = pop * cur_smod\n", " total_curpop = cur_pop.sum()\n", - " print(f\"{val}: {(total_curpop.sum()/total_pop*100)}\")" + " print(f\"{val}: {(total_curpop.sum() / total_pop * 100)}\")" ] }, { diff --git a/notebooks/Implementations/URB_SEAU1_NovelUrbanization/WBGAPI_Extract_urbanization_GDP.ipynb b/notebooks/Implementations/URB_SEAU1_NovelUrbanization/WBGAPI_Extract_urbanization_GDP.ipynb index 19e9e22..b44d937 100644 --- a/notebooks/Implementations/URB_SEAU1_NovelUrbanization/WBGAPI_Extract_urbanization_GDP.ipynb +++ b/notebooks/Implementations/URB_SEAU1_NovelUrbanization/WBGAPI_Extract_urbanization_GDP.ipynb @@ -66,7 +66,7 @@ "outputs": [], "source": [ "for ind in selected_indicators:\n", - " print(f'{ind}: {wb.series.info(ind).items[0][\"value\"]}')" + " print(f\"{ind}: {wb.series.info(ind).items[0]['value']}\")" ] }, { diff --git a/notebooks/Implementations/URB_SEAU1_NovelUrbanization/novelUrbanization.py b/notebooks/Implementations/URB_SEAU1_NovelUrbanization/novelUrbanization.py index 0d59808..d2002ef 100755 --- a/notebooks/Implementations/URB_SEAU1_NovelUrbanization/novelUrbanization.py +++ b/notebooks/Implementations/URB_SEAU1_NovelUrbanization/novelUrbanization.py @@ -422,7 +422,7 @@ def check_no_data(in_folder): cur_file = os.path.join(root, f) curR = rasterio.open(cur_file) curD = curR.read() - print(f'{f}: {(curD == curR.meta["nodata"]).sum()}') + print(f"{f}: {(curD == curR.meta['nodata']).sum()}") def pp_point_urban_summaries(inD, urban_tiffs, out_file): diff --git a/notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Data_Preparation.ipynb b/notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Data_Preparation.ipynb index 8896ed1..4f27672 100644 --- a/notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Data_Preparation.ipynb +++ b/notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Data_Preparation.ipynb @@ -88,7 +88,7 @@ "admin0_file = os.path.join(in_folder, \"ZAF_select_adm0.shp\")\n", "admin3_file = os.path.join(in_folder, \"ADMIN\", \"admin3_geoBounds_FINAL.shp\")\n", "ghsl_thresh = 0.1\n", - "local_ghsl_file = os.path.join(in_folder, f\"ghsl_combined_{int(ghsl_thresh*100)}.tif\")\n", + "local_ghsl_file = os.path.join(in_folder, f\"ghsl_combined_{int(ghsl_thresh * 100)}.tif\")\n", "urban_raster = os.path.join(urban_folder, \"zaf1k_cpo20_urban.tif\")\n", "urban_raster_pop = os.path.join(urban_folder, \"zaf1k_cpo20.tif\")\n", "urban_extents_file = os.path.join(urban_folder, \"cpo20_urban_extents.shp\")\n", diff --git a/notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Zonal_statistics.ipynb b/notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Zonal_statistics.ipynb index bc1e41c..abb84ca 100644 --- a/notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Zonal_statistics.ipynb +++ b/notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Zonal_statistics.ipynb @@ -91,7 +91,7 @@ "admin1_file = os.path.join(in_folder, \"admin1_geoBounds.shp\")\n", "admin3_file = os.path.join(in_folder, \"ADMIN\", \"admin3_geoBounds_FINAL.shp\")\n", "ghsl_thresh = 0.1\n", - "local_ghsl_file = os.path.join(in_folder, f\"ghsl_combined_{int(ghsl_thresh*100)}.tif\")\n", + "local_ghsl_file = os.path.join(in_folder, f\"ghsl_combined_{int(ghsl_thresh * 100)}.tif\")\n", "high_res_pop = (\n", " \"/home/public/Data/GLOBAL/Population/RF_SSA_2015-2020/ZAF/ppp_ZAF_const_2020.tif\"\n", ")\n", diff --git a/src/GOSTurban/urban_helper.py b/src/GOSTurban/urban_helper.py index 8e4db86..348c715 100755 --- a/src/GOSTurban/urban_helper.py +++ b/src/GOSTurban/urban_helper.py @@ -600,7 +600,7 @@ def evaluateOutput(self, admin_stats, commune_stats): f"{name}: TotalPop: {tPop.round(0)}, UrbanPop: {urbPop.round(0)}, HD Pop: {hdPop.round(0)}\n" ) out_stats.write( - f"{name}: {((urbPop/tPop) * 100).round(2)}% Urban; {((hdPop/tPop) * 100).round(2)}% HD Urban\n" + f"{name}: {((urbPop / tPop) * 100).round(2)}% Urban; {((hdPop / tPop) * 100).round(2)}% HD Urban\n" ) except: print(f"Error processing {name}")