Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Flood Modeling

Flood Modeling

The flood model can be imported using the following command. The flood model has been build using the following literature resources

Sánchez-Muñoz et al. (2020)

from IPython.display import display, HTML
import plotly.graph_objects as go
import plotly.io as pio

pio.renderers.default = "plotly_mimetype"
/opt/homebrew/Caskroom/miniconda/base/envs/erad/lib/python3.12/site-packages/kaleido/__init__.py:14: UserWarning:



Warning: You have Plotly version 6.0.1, which is not compatible with this version of Kaleido (1.0.0).

This means that static image generation (e.g. `fig.write_image()`) will not work.

Please upgrade Plotly to version 6.1.1 or greater, or downgrade Kaleido to version 0.2.1.


from erad.models.hazard import FloodModel, FloodModelArea

An instance of FloodModel requires to pieces of information,

  • timestamp: The timestamp for the flood event

  • affected_areas: list of area affected the flood represented by FloodModelArea

Each area affected by flooding is represented by polygon with water level and flowrate.

This enables users to define mutiple areas affected by a given flodd with uniwue parameters.

from datetime import datetime

from gdm.quantities import Distance
from shapely.geometry import Polygon

from erad.quantities import Speed

flood_area = FloodModelArea(
    affected_area=Polygon(
        [
            (-120.93036, 36.60144),
            (-120.91072, 36.60206),
            (-120.91127, 36.5712),
            (-120.93405, 36.58100),
        ]
    ),
    water_velocity=Speed(50, "meter/second"),
    water_elevation=Distance(10, "feet"),
)

flood = FloodModel(
    name="flood 1",
    timestamp=datetime.now(),
    affected_areas=[flood_area],
)
flood.pprint()
Loading...

An example of the FloodModel can be built using the example() methods for testing purposes.

flood_example = FloodModel.example()
flood_example.pprint()
Loading...

Plotting the Flood Model



fig = go.Figure()
flood_example.plot(figure=fig)
fig.show()
Loading...
References
  1. Sánchez-Muñoz, D., Domı́nguez-Garcı́a, J. L., Martı́nez-Gomariz, E., Russo, B., Stevens, J., & Pardo, M. (2020). Electrical grid risk assessment against flooding in Barcelona and Bristol cities. Sustainability, 12(4), 1527.