Exercise: Dfsu 2D#

# import the Dfsu class 

Read#

fn = "../data/NorthSea_HD_and_windspeed.dfsu"
# create Dfsu object "dfs" from fn
# print the list of items
# does the mesh have any quad elements? 
# 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`
# ds.items[0].name = "new name"
# 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