-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_id_code.py
More file actions
39 lines (31 loc) · 1.16 KB
/
Copy pathtest_id_code.py
File metadata and controls
39 lines (31 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Create a virtual environment
python -m venv venv
# Activate it (Windows)
.\venv\Scripts\activate
# Install dependencies
pip install geopandas pandas
import geopandas as gpd
import pandas as pd
def load_geojson(geojson_data='https://raw.githubusercontent.com/pchaitanya21/VertinetikLLM/main/data/Hicks_Lodge_Trial_pred.geojson'):
#Load GeoJSON file into GeoDataFrame
tree_gdf = gpd.read_file(geojson_data)
return tree_gdf
def filter_ash(tree_gdf=None):
#Filter GeoDataFrame to include only Ash species ('Predicted Tree Species':'Ash')
if tree_gdf is None:
raise ValueError("Input GeoDataFrame is None.")
tree_gdf = tree_gdf.dropna(subset=['Predicted Tree Species'])
ash_tree_gdf = tree_gdf[tree_gdf['Predicted Tree Species'] == 'Ash']
ash_tree_ids = ash_tree_gdf['Tree ID'].tolist()
print(ash_tree_ids)
return ash_tree_ids
def assembely_solution():
try:
tree_gdf = load_geojson()
ash_tree_ids = filter_ash(tree_gdf)
return ash_tree_ids
except Exception as e:
print(f"An error occurred: {e}")
return None
result=assembely_solution()
print(result)