Skip to content

Commit

Permalink
add conus example
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Dec 12, 2023
1 parent 0e87d65 commit 3b0aa8c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions python/ngen_config_gen/examples/generate_conus/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import geopandas as gpd
import pandas as pd

from ngen.config_gen.file_writer import DefaultFileWriter
from ngen.config_gen.hook_providers import DefaultHookProvider
from ngen.config_gen.generate import generate_configs

from ngen.config_gen.models.cfe import Cfe
from ngen.config_gen.models.pet import Pet

if __name__ == "__main__":
# or pass local file paths instead
hf_file = "https://lynker-spatial.s3.amazonaws.com/v20.1/conus.gpkg"
hf_lnk_file = (
"https://lynker-spatial.s3.amazonaws.com/v20.1/model_attributes.parquet"
)

hf: gpd.GeoDataFrame = gpd.read_file(hf_file, layer="divides")
hf_lnk_data: pd.DataFrame = pd.read_parquet(hf_lnk_file)

hook_provider = DefaultHookProvider(hf=hf, hf_lnk_data=hf_lnk_data)
# files will be written to ./config
file_writer = DefaultFileWriter("./config/")

generate_configs(
hook_providers=hook_provider,
hook_objects=[Cfe, Pet],
file_writer=file_writer,
)

0 comments on commit 3b0aa8c

Please sign in to comment.