Skip to content

Commit

Permalink
Set rail bridge asset_type correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-fred committed Feb 12, 2024
1 parent 1022538 commit 4801815
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions workflow/transport/create_rail_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,18 @@
f"Network contains {len(network.edges)} edges and {len(network.nodes)} nodes"
)

# select and label assets with their type
network.nodes.loc[network.nodes.tag_railway == 'station', 'asset_type'] = RailAssets.STATION
network.edges.loc[str_to_bool(network.edges['tag_bridge']), 'asset_type'] = RailAssets.BRIDGE
network.edges.loc[network.edges.tag_railway == 'rail', 'asset_type'] = RailAssets.RAILWAY
# boolean bridge field
network.edges['bridge'] = str_to_bool(network.edges['tag_bridge'])

# boolean station field
network.nodes['station'] = network.nodes.tag_railway == 'station'

# boolean bridge field
network.edges['bridge'] = str_to_bool(network.edges['tag_bridge'])
# select and label assets with their type
# we will use the `asset_type` field to select damage curves
network.nodes.loc[network.nodes.station == True, 'asset_type'] = RailAssets.STATION
network.edges.loc[network.edges.tag_railway == 'rail', 'asset_type'] = RailAssets.RAILWAY
# bridge overrides railway as asset class, tag last
network.edges.loc[network.edges.bridge == True, 'asset_type'] = RailAssets.BRIDGE

# manually set crs using geopandas rather than snkit to avoid 'init' style proj crs
# and permit successful CRS deserializiation and methods such as edges.crs.to_epsg()
Expand Down

0 comments on commit 4801815

Please sign in to comment.