Exercise: Dfsu 2D#
Open / Read#
fn = "../data/NorthSea_HD_and_windspeed.dfsu"
# create a Dfsu2DH object "dfs" from fn using mikeio.open
# print the list of items
# does the mesh (use the .geometry attribute) have any quad elements, or is it triangles only?
# read the Wind speed item to a variable ds
# plot the wind speed at the time "2017-10-28 20:00"
# get an array of max wind speed per timestep (hint: use the max(axis=1) on ds)
# plot this array as a time series and determine the time with the largest wind speed
# (hint: use to_dataframe() on the output of max(axis=1))
Write#
# read the Surface elevation item into a new dataset `ds`
# rename the first and only item of this dataset (Surface elevation) to `Sea Level`
# (hint: use the .rename method on the dataset)
# Create new directories project_X and project_X/HD
import os
os.makedirs("project_X/HD", exist_ok=True)
# write this dataset to a new Dfsu file project_X/HD/NorthSea_SLEV.dfsu