-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgenerate_static_input_dataset.py
More file actions
67 lines (49 loc) · 2.07 KB
/
generate_static_input_dataset.py
File metadata and controls
67 lines (49 loc) · 2.07 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os
import pandas as pd
import geopandas as gpd
import rasters as rt
from ECOv002_calval_tables import load_combined_eco_flux_ec_filtered, load_metadata_ebc_filt
from koppengeiger import load_koppen_geiger
def generate_static_input_dataset():
"""
Generate static input dataset for FLiESANN from tower locations.
Creates a CSV file with static tower data including Koppen-Geiger climate
classification and atmospheric parameters.
Returns:
gpd.GeoDataFrame: GeoDataFrame containing the static tower data
"""
# Get the directory where this script is located (FLiESANN package directory)
package_dir = os.path.dirname(os.path.abspath(__file__))
generated_input_table_filename = os.path.join(package_dir, "ECOv002-static-tower-FLiESANN-inputs.csv")
# Load tower location metadata
tower_locations_df = load_metadata_ebc_filt()
tower_IDs = list(tower_locations_df["Site ID"])
tower_names = list(tower_locations_df.Name)
# Load tower data (for reference, though not directly used in static dataset)
tower_data_df = load_combined_eco_flux_ec_filtered()
# Create MultiPoint geometry for tower locations
tower_points = rt.MultiPoint(
x=tower_locations_df['Long'].values,
y=tower_locations_df['Lat'].values
)
# Load Koppen-Geiger climate classification for tower locations
KG_climate = load_koppen_geiger(geometry=tower_points)
# Create GeoDataFrame with static tower data
tower_static_data_gdf = gpd.GeoDataFrame({
"ID": tower_IDs,
"name": tower_names,
"KG_climate": KG_climate,
"COT": 0,
"AOT": 0,
"Ca": 400,
"wind_speed_mps": 0,
"vapor_gccm": 0,
"ozone_cm": 0.3,
"geometry": tower_points
})
# Save to CSV
tower_static_data_gdf.to_csv(generated_input_table_filename, index=False)
print(f"Static input dataset saved to: {generated_input_table_filename}")
return tower_static_data_gdf
if __name__ == "__main__":
generate_static_input_dataset()