Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a function to convert NSI to building inventory for earthquake #110

Draft
wants to merge 24 commits into
base: develop
Choose a base branch
from

Conversation

ywkim312
Copy link
Member

@ywkim312 ywkim312 commented Feb 25, 2025

There are four issues in this PR but all those issues are tightly related so it should be included in a single PR.
Also, there is a documentation about the process in this PR https://docs.google.com/document/d/1BRyvJeudHF8eNxrBZB7czIhzpr330wq_ANtI-ggp1qY

Please test it with following code after you install this PR
test1.json file is attached
test1.json

from pyincore_data.nsiparser import NsiParser
from pyincore_data.nsibuildinginventory import NsiBuildingInventory
from pyincore_data.utils.nsiutil import NsiUtil

def create_building_inventory_by_county_fips_list():
    # uncomment any of the following list
    #fips_list = ['41007']  # seaside (westcoast)
    #fips_list = ['17019']   # champaign county (midwest)
    fips_list = ['36021']   # new york county (esatcoast)
    gdf = NsiBuildingInventory.convert_nsi_to_building_inventory_by_county_fips_list(fips_list)
    gdf.to_file('test1.gpkg', driver='GPKG')


def create_building_inventory_by_geojson():
    in_json = 'test1.json'
    gdf = NsiBuildingInventory.convert_nsi_to_building_inventory_from_geojson(in_json, "westCoast")
    gdf.to_file('test1.gpkg', driver='GPKG')


def define_region_by_fips():
    fips = '15005'
    region = NsiUtil.determine_region_by_fips(fips)
    print(region)


if __name__ == '__main__':
    create_building_inventory_by_county_fips_list()
    create_building_inventory_by_geojson()
    define_region_by_fips()```

@ywkim312 ywkim312 requested a review from navarroc February 26, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant