fimeval 0.1.56__py3-none-any.whl → 0.1.58__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fimeval
3
- Version: 0.1.56
3
+ Version: 0.1.58
4
4
  Summary: A Framework for Automatic Evaluation of Flood Inundation Mapping Predictions Evaluation
5
5
  Author: Surface Dynamics Modeling Lab
6
6
  Author-email: Supath Dhital <sdhital@crimson.ua.edu>, Dipshika Devi <ddevi@ua.edu>
@@ -680,9 +680,8 @@ Requires-Dist: kaleido==0.2.1
680
680
  Requires-Dist: nbformat<6.0.0,>=5.10.4
681
681
  Requires-Dist: pyproj<4.0.0,>=3.7.0
682
682
  Requires-Dist: notebook<8.0.0,>=7.3.2
683
- Requires-Dist: boto3<2.0.0,>=1.36.16
683
+ Requires-Dist: boto3>=1.40.0
684
684
  Requires-Dist: geemap
685
- Requires-Dist: uv
686
685
  Requires-Dist: seaborn
687
686
  Provides-Extra: dev
688
687
  Requires-Dist: pytest; extra == "dev"
@@ -712,7 +711,7 @@ To address these issues, we developed Flood Inundation Mapping Prediction Evalua
712
711
 
713
712
 
714
713
 
715
- ### **Repository structure**
714
+ ### Repository structure
716
715
  <hr style="border: 1px solid black; margin: 0;">
717
716
 
718
717
  The architecture of the ```fimeval``` integrates different modules to which helps the automation of flood evaluation. All those modules codes are in source (```src``` ) folder.
@@ -721,11 +720,15 @@ fimeval/
721
720
  ├── docs/ # Documentation (contains 'FIMserv' Tool usage sample codes)
722
721
  │ └── sampledata/ # Contains the sample data to demonstrate how this frameworks works
723
722
  │ └── fimeval_usage.ipynb #Sample code usage of the Evaluation framework
723
+ │ └── fimbench_usage.ipynb #Sample code usage of the FIMbench Query and getting benchmark dataset
724
724
  ├── Images/ # have sample images for documentation
725
725
  ├── src/
726
- │ └── fimeval/
726
+ │ └── fimeval/
727
+ │ ├──BenchFIMQuery/ #Module to interact with the extensive FIMdatabase, hosted in AWS S3
728
+ │ │ └── access_benchfim.py #Different classes to query right benchmark FIM for any given location and set of filter
729
+ │ │ └── utilis.py #Support utility
727
730
  │ ├──BuildingFootprint/ # Contains the evaluation of model predicted FIM with microsoft building footprint
728
- │ │ └── microsoftBF.py
731
+ │ │ └── arcgis_API.py #seamless integration of building footprint in evaluation through ArcGIS REST API
729
732
  │ │ └── evaluationwithBF.py
730
733
  │ └── ContingencyMap/ # Contains all the metrics calculation and contingency map generation
731
734
  │ │ ├── evaluationFIM.py # main evaluation moodule
@@ -733,18 +736,18 @@ fimeval/
733
736
  │ │ └── metrics.py # metrics calculation module
734
737
  │ │ └── plotevaluationmetrics.py # use to vizualize the different performance metrics
735
738
  │ │ └── printcontingency.py # prints the contingency map to quickly generate the Map layout
736
- │ │ └── PWBs3.py # module which helps to get permanent water bodies from s3 bucket
739
+ │ │ └── water_bodies.py # module which to get permanent water bodies from s3 bucket and ArcGIS REST API
737
740
  │ └── utilis.py #Includes the resampling and reprojection of FIMs
738
741
  └── tests/ # Includes test cases for different functionality
739
742
  ```
740
743
  The graphical representation of fimeval pipeline can be summarized as follows in **```Figure 1```**. Here, it will show all the steps incorporated within the ```fimeval``` during packaging and all functionality are interconnected to each other, resulting the automation of the framework.
741
744
 
742
745
  <div align="center">
743
- <img width="900" alt="image" src="./Images/flowchart.jpg">
746
+ <img width="800" alt="image" src="./Images/flowchart.jpg">
744
747
  </div>
745
748
  Figure 1: Flowchart showing the entire framework pipeline.
746
749
 
747
- ### **Framework Installation and Usage**
750
+ ### Framework Installation and Usage
748
751
  <hr style="border: 1px solid black; margin: 0;">
749
752
 
750
753
  This framework is published as a python package in PyPI (https://pypi.org/project/fimeval/).For directly using the package, the user can install this package using python package installer 'pip' and can import on their workflows:
@@ -765,7 +768,9 @@ import fimeval as fp
765
768
  ```
766
769
  **Note: The framework usage provided in detailed in [Here (docs/fimeval_usage.ipynb)](./docs/fimeval_usage.ipynb)**. It has detail documentation from installation, setup, running- until results.
767
770
 
768
- #### **Main Directory Structure**
771
+ ### Main Directory Structure
772
+ <hr style="border: 1px solid black; margin: 0;">
773
+
769
774
  The main directory contains the primary folder for storing the case studies. If there is one case study, user can directly pass the case study folder as the main directory. Each case study folder must include a Benchmark FIM (B-FIM) with a 'benchmark' word assigned within the B-FIM file and different Model Predicted FIM (M-FIM)
770
775
  in tif format.
771
776
  For mutilple case studies,the main directory could be structure in such a way that contain the seperate folders for individual case studies.For example, if a user has two case studies they should create two seperate folders as shown in the Figure below.
@@ -780,13 +785,13 @@ main_dir = Path('./path/to/main/dir')
780
785
  ```
781
786
 
782
787
  #### **Permanent Water Bodies (PWB)**
783
- This framework uses PWB to first to delineate the PWB in the FIM and assign into different class so that the evaluation will be more fair. For the Contiguous United States (CONUS), the PWB is already integrated within the framework however, if user have more accurate PWB or using fimeval for outside US they can initialize and use PWB within fimeval framework. Currently it is using PWB publicly hosted by ESRI: https://hub.arcgis.com/datasets/esri::usa-detailed-water-bodies/about
788
+ This framework uses PWB to first to delineate the PWB in the FIM and assign into different class so that the evaluation will be more fair. For the Contiguous United States (CONUS), the PWB is already integrated within the framework however, if user have more accurate PWB or using fimeval for outside US they can initialize and use PWB within fimeval framework. Currently it is using PWB publicly hosted by ESRI through REST API: https://hub.arcgis.com/datasets/esri::usa-detailed-water-bodies/about
784
789
 
785
790
  If user have more precise PWB, they can input their own PWB boundary as .shp and .gpkg format and need to assign the shapefile of the PWB and define directory as,
786
791
  ```bash
787
792
  PWD_dir = Path('./path/to/PWB/vector/file')
788
793
  ```
789
- #### **Methods for Extracting Flood Extents**
794
+ #### Methods for Extracting Flood Extents
790
795
  1. **```smallest_extent```**
791
796
  The framework will first check all the raster extents (benchmark and FIMs). It will then determine the smallest among all the rasters. A shape file will then be created to mask all the rasters.
792
797
 
@@ -816,7 +821,7 @@ method_name = "AOI"
816
821
  AOI = Path('./path/to/AOI/vectorfile')
817
822
  ```
818
823
 
819
- #### **Executing the Evaluation framework**
824
+ #### Executing the Evaluation framework
820
825
  The complete description of different modules, what they are meant for, arguments taken to run that module and what will be the end results from each is described in below **Table 1**. If user import `fimeval` framework as `fp` into workflows, they can call each module mentioned in **Table 1** as `fp.Module_Name(args)`. Here arguments in italic represents the optional field, depending upon the user requirement.
821
826
 
822
827
  Table 1: Modules in `fimeval` are in order of execution.
@@ -825,7 +830,7 @@ Table 1: Modules in `fimeval` are in order of execution.
825
830
  | `EvaluateFIM` | It runs all the evaluation of FIM between B-FIM and M-FIMs. | `main_dir`: Main directory containing the case study folders, <br> `method_name`: How users wants to evaluate their FIM, <br> `outpur_dir`: Output directory where all the results and the intermidiate files will be saved for further calculation, <br> *`PWB_dir`*: The permanenet water bodies vectory file directory if user wants to user their own boundary, <br> *`target_crs`*: this fimeval framework needs the floodmaps to be in projected CRS so define the projected CRS in epsg code format, <br> *`target_resolution`*: sometime if the benchmark is very high resolution than candidate FIMs, it needs heavy computational time, so user can define the resolution if there FIMs are in different spatial resolution, else it will use the coarser resolution among all FIMS within that case. |The outputs includes generated files in TIFF, SHP, CSV, and PNG formats, all stored within the output folder. Users can visualize the TIFF files using any geospatial platform. The TIFF files consist of the binary Benchmark-FIM (Benchmark.tif), Model-FIM (Candidate.tif), and Agreement-FIM (Contingency.tif). The shp files contain the boundary of the generated flood extent.|
826
831
  | `PlotContingencyMap` | For better understanding, It will print the agreement maps derived in first step. | `main_dir`, `method_name`, `output_dir` : Based on the those arguments, once all the evaluation is done, it will dynamically get the corresponding contingency raster for printing.| This prints the contingency map showing different class of evaluation (TP, FP, no data, PWB etc). The outputs look like- Figure 4 first row.|
827
832
  | `PlotEvaluationMetrics` | For quick understanding of the evaluation metrics, to plot bar of evaluation scores. | `main_dir`, `method_name`, `output_dir` : Based on the those arguments, once all the evaluation is done, it will dynamically get the corresponding file for printing based on all those info.| This prints the bar plots which includes different performance metrics calculated by EvaluateFIM module. The outputs look like- Figure 4 second row.|
828
- | `EvaluationWithBuildingFootprint` | For Building Footprint Analysis, user can specify shapefile of building footprints as .shp or .gpkg format. By default it consider global Microsoft building footprint dataset. Those data are hosted in Google Earth Engine (GEE) so, It pops up to authenticate the GEE account, please allow it and it will download the data based on evaluation boundary and evaluation is done. | `main_dir`, `method_name`, `output_dir`: Those arguments are as it is, same as all other modules. <br> *`building_footprint`*: If user wants to use their own building footprint file then pass the directory here, *`country`*: It is the 3 letter based country ISO code (eg. 'USA', NEP' etc), for the building data automation using GEE based on the evaluation extent, *`shapefile_dir`*: this is the directory of user defined AOI if user is working with their own boundary and automatic Building footprint download and evaluation, *`geeprojectID`*: this is the google earth engine google cloud project ID, which helps to access the GEE data and resources to work with building footprint download and process. | It will calculate the different metrics (e.g. TP, FP, CSI, F1, Accuracy etc) based on hit and miss of building on different M-FIM and B-FIM. Those all metrics will be saved as CSV format in `output_dir` and finally using that info it prints the counts of building foorpint in each FIMs as well as scenario on the evaluation end via bar plot.|
833
+ | `EvaluationWithBuildingFootprint` | For Building Footprint Analysis, user can specify shapefile of building footprints as .shp or .gpkg format. By default it consider global Microsoft building footprint dataset hosted in ArcGIS Online. It is seamlessly integrated within framework through ArcGIS REST API. | `main_dir`, `method_name`, `output_dir`: Those arguments are as it is, same as all other modules. <br> *`building_footprint`*: If user wants to use their own building footprint file then pass the directory here, *`shapefile_dir`*: this is the directory of user defined AOI if user is working with their own boundary and automatic Building footprint download and evaluation,| It will calculate the different metrics (e.g. TP, FP, CSI, F1, Accuracy etc) based on hit and miss of building on different M-FIM and B-FIM. Those all metrics will be saved as CSV format in `output_dir` and finally using that info it prints the counts of building foorpint in each FIMs as well as scenario on the evaluation end via bar plot.|
829
834
 
830
835
  <p align="center">
831
836
  <img src="./Images/methodsresults_combined.jpg" width="750" />
@@ -834,8 +839,9 @@ Table 1: Modules in `fimeval` are in order of execution.
834
839
  Figure 4: Combined raw output from framework for different two method. First row (subplot a and b) and second row (subplot c and d) is contingency maps and evaluation metrics of FIM derived using `PrintContingencyMaP` and `PlotEvaluationMetrics` module. Third row (subplot e and f) is the output after processing and calculating of evaluation with BF by unsing `EvaluateWithBuildingFoorprint` module.
835
840
 
836
841
  ## Installation Instructions
842
+ <hr style="border: 1px solid black; margin: 0;">
837
843
 
838
- ### 1. Prerequisites
844
+ #### 1. Prerequisites
839
845
 
840
846
  Before installing `fimeval`, ensure the following software are installed:
841
847
 
@@ -849,13 +855,13 @@ Before installing `fimeval`, ensure the following software are installed:
849
855
 
850
856
  ---
851
857
 
852
- ### 2. Install Anaconda
858
+ #### 2. Install Anaconda
853
859
 
854
860
  If Anaconda is not installed, download and install it from the [official website](https://www.anaconda.com/products/distribution).
855
861
 
856
862
  ---
857
863
 
858
- ### 3. Set Up Virtual Environment
864
+ #### 3. Set Up Virtual Environment
859
865
 
860
866
  #### For Mac Users
861
867
 
@@ -873,25 +879,43 @@ uv pip install fimeval
873
879
  ```
874
880
 
875
881
  ### Google Colab Version
882
+ <hr style="border: 1px solid black; margin: 0;">
876
883
 
877
884
  To use fimeval in Google Colab, follow the steps below:
878
885
 
879
- ## Upload Files
886
+ #### Upload Files
880
887
  Upload all necessary input files (e.g., raster, shapefiles, model outputs) to your Google Drive.
881
- ## Open Google Colab
888
+ #### Open Google Colab
882
889
  Go to Google Colab and sign in with a valid Google account.
883
- ## Mount Google Drive
890
+ #### Mount Google Drive
884
891
  In a new Colab notebook, mount the Google Drive
885
892
  ```bash
886
893
  pip install fimeval
887
894
  ```
888
- ### **Acknowledgements**
895
+ ### Citing our work
896
+ <hr style="border: 1px solid black; margin: 0;">
897
+
898
+ - Devi, D., Dipsikha, Supath Dhital, Dinuke Munasinghe, Sagy Cohen, Anupal Baruah, Yixian Chen, Dan Tian, & Carson Pruitt (2025).
899
+ *A framework for the evaluation of flood inundation predictions over extensive benchmark databases.*
900
+ **Environmental Modelling & Software**, 106786.
901
+ https://doi.org/10.1016/j.envsoft.2025.106786
902
+
903
+ - Cohen, S., Baruah, A., Nikrou, P., Tian, D., & Liu, H. (2025).
904
+ *Toward robust evaluations of flood inundation predictions using remote sensing–derived benchmark maps.*
905
+ **Water Resources Research**, 61(8).
906
+ https://doi.org/10.1029/2024WR039574
907
+
908
+ ### Acknowledgements
909
+ <hr style="border: 1px solid black; margin: 0;">
910
+
889
911
  | | |
890
912
  | --- | --- |
891
913
  | ![alt text](https://ciroh.ua.edu/wp-content/uploads/2022/08/CIROHLogo_200x200.png) | Funding for this project was provided by the National Oceanic & Atmospheric Administration (NOAA), awarded to the Cooperative Institute for Research to Operations in Hydrology (CIROH) through the NOAA Cooperative Agreement with The University of Alabama.
892
914
 
893
- ### **For More Information**
915
+ ### For More Information
916
+
894
917
  Contact <a href="https://geography.ua.edu/people/sagy-cohen/" target="_blank">Sagy Cohen</a>
895
918
  (sagy.cohen@ua.edu)
919
+ Supath Dhital, (sdhital@crimson.ua.edu)
896
920
  Dipsikha Devi, (ddevi@ua.edu)
897
- Supath Dhital, (sdhital@crimson.ua.edu)
921
+
@@ -0,0 +1,21 @@
1
+ fimeval/__init__.py,sha256=XzCEx8Pkf_nYA1NY-cuj2MWvdOij5n0pVRtQtwc0Rp4,869
2
+ fimeval/setup_benchFIM.py,sha256=lmMaXq0yn-tRlEiXIda9ywoNFbwR8X4Tiy8MVSgPKxE,1310
3
+ fimeval/utilis.py,sha256=hC7e6ZOXN1RhnpvJmSLrMJXHSLcVJcllBLnG4rGWExE,8261
4
+ fimeval/BenchFIMQuery/__init__.py,sha256=_Ng7sOKNQrcXnoD9MfdvntNcEDRUs3VLA4RmUuil6dU,79
5
+ fimeval/BenchFIMQuery/access_benchfim.py,sha256=qqXlC82SSB9r0telG6HWXI39ohJAw4wxj5p6aAaojJU,28724
6
+ fimeval/BenchFIMQuery/utilis.py,sha256=JMTDf9bOmfEFC6562CiPNb2SsIi1qd_TT34UvM9i8ys,10480
7
+ fimeval/BuildingFootprint/__init__.py,sha256=ncVUP0lT69wrUiwpq5AvM5-8gA9ohlQmMUK_wrcZJwk,178
8
+ fimeval/BuildingFootprint/arcgis_API.py,sha256=F4AuDorU6PlZrHYRtzJx7RnT4un75cz36nmQTID8ooM,6180
9
+ fimeval/BuildingFootprint/evaluationwithBF.py,sha256=AesPK5i3uPCKjcFK3N29Kq1DBbdPWczHbs0pJTPXk5o,16749
10
+ fimeval/ContingencyMap/__init__.py,sha256=8olBcQzgK2Z7OU-9IRH6dXsOyuMvmTefDze-iwBsy5I,292
11
+ fimeval/ContingencyMap/evaluationFIM.py,sha256=HVcwTRBf_O0_CKslMZ365xxWD4pVh8Syz1XlQMbbfdk,19854
12
+ fimeval/ContingencyMap/methods.py,sha256=kbutfo9FUH-yjvnOXxwLpdErUuebMJ8NjCroNWIYCjo,3299
13
+ fimeval/ContingencyMap/metrics.py,sha256=jwOia0Nl7aU7AuGJFAcQ4fVENnp2G_5W6JSJBzo1-_4,1094
14
+ fimeval/ContingencyMap/plotevaluationmetrics.py,sha256=AbR43fnz0mbs5a7o3-ccAj-fa5RRWG4rS3xav58_M-k,4900
15
+ fimeval/ContingencyMap/printcontingency.py,sha256=rTCwL2A-nuIU3ZdRoyFokwfhnUCPx3_PAeFjtMvqRJs,5471
16
+ fimeval/ContingencyMap/water_bodies.py,sha256=tPf5R-8BNfARsJsecWlX0VPH9EU16utUOAxB4eQ9XHE,6605
17
+ fimeval-0.1.58.dist-info/licenses/LICENSE.txt,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
18
+ fimeval-0.1.58.dist-info/METADATA,sha256=JGKtnyP9IrH7Qvlhg6o47zsG7jBWXJJOQ_1Y4mU8Sg4,57043
19
+ fimeval-0.1.58.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
20
+ fimeval-0.1.58.dist-info/top_level.txt,sha256=F4QW50msI8sRrX_DK3NQ-s3swQ4-2_5Ty3mfm9ZMc6k,8
21
+ fimeval-0.1.58.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,132 +0,0 @@
1
- # Importing necessary libraries
2
- import geemap
3
- import ee
4
- import os
5
- from shapely.geometry import box
6
- import pandas as pd
7
- from pathlib import Path
8
- import geopandas as gpd
9
- from pyspark.sql import SparkSession
10
- from shapely.wkt import loads
11
- import shutil
12
-
13
- # Suppress the warnings
14
- import warnings
15
-
16
- warnings.filterwarnings("ignore")
17
-
18
- # Authenticate and initialize Earth Engine
19
- ee.Authenticate()
20
-
21
-
22
- # %%
23
- def split_into_tiles(boundary, tile_size=0.1):
24
- bounds = boundary.total_bounds
25
- x_min, y_min, x_max, y_max = bounds
26
- tiles = []
27
- x = x_min
28
- while x < x_max:
29
- y = y_min
30
- while y < y_max:
31
- tile = box(x, y, x + tile_size, y + tile_size)
32
- if tile.intersects(boundary.unary_union):
33
- tiles.append(tile)
34
- y += tile_size
35
- x += tile_size
36
- return gpd.GeoDataFrame(geometry=tiles, crs=boundary.crs)
37
-
38
-
39
- # Merge the final geojson files
40
- def mergeGeoJSONfiles(output_dir, merged_file):
41
- output_dir = Path(output_dir)
42
- files = list(output_dir.glob("*.geojson"))
43
- gdfs = [gpd.read_file(file) for file in files]
44
- merged_gdf = gpd.GeoDataFrame(pd.concat(gdfs, ignore_index=True), crs="EPSG:4326")
45
- merged_gdf.to_file(merged_file, driver="GPKG")
46
-
47
-
48
- # Process each batch with number of tiles
49
- def process_batch(partition, collection_name, output_dir, boundary_wkt, projectID=None):
50
- try:
51
- if projectID:
52
- ee.Initialize(project=projectID)
53
- else:
54
- ee.Initialize()
55
-
56
- except Exception:
57
- print("To initialize, please provide the earth engine project ID")
58
-
59
- # Convert WKT boundary to geometry
60
- boundary = loads(boundary_wkt)
61
- results = []
62
-
63
- for tile_wkt in partition:
64
- try:
65
- tile = loads(tile_wkt)
66
- aoi = ee.Geometry(tile.__geo_interface__)
67
- collection = ee.FeatureCollection(collection_name).filterBounds(aoi)
68
-
69
- # Download features and filter by boundary
70
- gdf = geemap.ee_to_gdf(collection)
71
- gdf = gdf[gdf.geometry.intersects(boundary)]
72
-
73
- # Save each tile as a GeoJSON file
74
- tile_id = f"tile_{hash(tile)}"
75
- output_file = Path(output_dir) / f"{tile_id}.geojson"
76
- gdf.to_file(output_file, driver="GeoJSON")
77
- results.append(f"Saved: {output_file}")
78
- except Exception as e:
79
- results.append(f"Error processing tile: {e}")
80
-
81
- return results
82
-
83
-
84
- def getBuildingFootprintSpark(
85
- countryISO, boundary_file, out_dir, tile_size, projectID=None
86
- ):
87
- spark = SparkSession.builder.appName("BuildingFootprints").getOrCreate()
88
-
89
- # Make temporary directory
90
- temp_dir = out_dir / "temp"
91
- temp_dir.mkdir(parents=True, exist_ok=True)
92
-
93
- # Load and process boundary
94
- boundary = gpd.read_file(boundary_file).to_crs("EPSG:4326")
95
- tiles = split_into_tiles(boundary, tile_size)
96
- boundary_wkt = boundary.unary_union.wkt
97
-
98
- collection_names = [f"projects/sat-io/open-datasets/VIDA_COMBINED/{countryISO}"]
99
-
100
- # Distribute processing
101
- for collection_name in collection_names:
102
- tiles_rdd = spark.sparkContext.parallelize(
103
- tiles.geometry.apply(lambda x: x.wkt).tolist(), numSlices=10
104
- )
105
- results = tiles_rdd.mapPartitions(
106
- lambda partition: process_batch(
107
- partition, collection_name, str(temp_dir), boundary_wkt, projectID
108
- )
109
- ).collect()
110
-
111
- # Merge GeoJSON files
112
- mergeGeoJSONfiles(temp_dir, out_dir / "building_footprint.gpkg")
113
-
114
- # Clean up the temp directory
115
- shutil.rmtree(temp_dir, ignore_errors=True)
116
-
117
- print(f"Building footprint data saved to {out_dir / 'building_footprint.gpkg'}")
118
-
119
-
120
- # %%
121
- # Export the building footprint
122
- def BuildingFootprintwithISO(countryISO, ROI, out_dir, geeprojectID=None):
123
- out_dir = Path(out_dir)
124
- out_dir.mkdir(parents=True, exist_ok=True)
125
- filename = out_dir / "building_footprint.gpkg"
126
-
127
- if filename.exists():
128
- os.remove(filename)
129
-
130
- getBuildingFootprintSpark(
131
- countryISO, ROI, out_dir, tile_size=0.05, projectID=geeprojectID
132
- )
@@ -1,42 +0,0 @@
1
- # import Libraries
2
- import geopandas as gpd
3
- import boto3
4
- import botocore
5
- import os
6
- import tempfile
7
-
8
- # Initialize an anonymous S3 client
9
- s3 = boto3.client(
10
- "s3", config=botocore.config.Config(signature_version=botocore.UNSIGNED)
11
- )
12
-
13
- bucket_name = "sdmlab"
14
- pwb_folder = "PWB/"
15
-
16
-
17
- def PWB_inS3(s3_client, bucket, prefix):
18
- """Download all components of a shapefile from S3 into a temporary directory."""
19
- tmp_dir = tempfile.mkdtemp()
20
- response = s3_client.list_objects_v2(Bucket=bucket, Prefix=prefix)
21
- if "Contents" not in response:
22
- raise ValueError("No files found in the specified S3 folder.")
23
-
24
- for obj in response["Contents"]:
25
- file_key = obj["Key"]
26
- file_name = os.path.basename(file_key)
27
- if file_name.endswith((".shp", ".shx", ".dbf", ".prj", ".cpg")):
28
- local_path = os.path.join(tmp_dir, file_name)
29
- s3_client.download_file(bucket, file_key, local_path)
30
-
31
- shp_files = [f for f in os.listdir(tmp_dir) if f.endswith(".shp")]
32
- if not shp_files:
33
- raise ValueError("No .shp file found after download.")
34
-
35
- shp_path = os.path.join(tmp_dir, shp_files[0])
36
- return shp_path
37
-
38
-
39
- def get_PWB():
40
- shp_path = PWB_inS3(s3, bucket_name, pwb_folder)
41
- pwb = gpd.read_file(shp_path)
42
- return pwb
@@ -1,17 +0,0 @@
1
- fimeval/__init__.py,sha256=HZJKq7XEhL6TnwFkhpf8NcEQ5h7zPQ3XJh3z5gF0gQ8,603
2
- fimeval/utilis.py,sha256=KdU6pSMS8dPf1zFyS-SOUdDSJr87IQ28uSG3ZuVfq1A,6782
3
- fimeval/BuildingFootprint/__init__.py,sha256=oP9YWLdo6ANzSQFxYLv7Ku_26AY5NkLNhZLK28ICMLo,109
4
- fimeval/BuildingFootprint/evaluationwithBF.py,sha256=3v5dZk7xL9h6emf36Cxlsq5DJ1mYA5FgWpX4i97VPFg,18238
5
- fimeval/BuildingFootprint/microsoftBF.py,sha256=73M_e_n_3lsejsnP9eX06hou0sr2-yaWdjuoUwZ8O2Y,4063
6
- fimeval/ContingencyMap/PWBs3.py,sha256=UFICxO58c2fA9mIffH4ooqphv3ZXe6yX8QzpRjtI6fs,1275
7
- fimeval/ContingencyMap/__init__.py,sha256=ckps2dyg6aci3TA-3P7oTMcCAcSTz9AA6sndHtZEwdE,259
8
- fimeval/ContingencyMap/evaluationFIM.py,sha256=zdr55Vc0FzmI4p-8xlWmm92agGdimpWPCVzcCtu4qzU,17349
9
- fimeval/ContingencyMap/methods.py,sha256=kbutfo9FUH-yjvnOXxwLpdErUuebMJ8NjCroNWIYCjo,3299
10
- fimeval/ContingencyMap/metrics.py,sha256=jwOia0Nl7aU7AuGJFAcQ4fVENnp2G_5W6JSJBzo1-_4,1094
11
- fimeval/ContingencyMap/plotevaluationmetrics.py,sha256=AbR43fnz0mbs5a7o3-ccAj-fa5RRWG4rS3xav58_M-k,4900
12
- fimeval/ContingencyMap/printcontingency.py,sha256=-1H_Ze2TbRSER7vy7bd0HvxnziNzPPOIPOm2YhB7r4A,5422
13
- fimeval-0.1.56.dist-info/licenses/LICENSE.txt,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
14
- fimeval-0.1.56.dist-info/METADATA,sha256=2u8hha99stJgzPpGzrU6A4rbgYmD2DRT2lmEuRWchas,56113
15
- fimeval-0.1.56.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- fimeval-0.1.56.dist-info/top_level.txt,sha256=F4QW50msI8sRrX_DK3NQ-s3swQ4-2_5Ty3mfm9ZMc6k,8
17
- fimeval-0.1.56.dist-info/RECORD,,