Exercise H: Generic dfs

Exercise H: Generic dfs#

Test your skills in processing of generic dfs files.

import mikeio
import mikeio.generic

read()#

read returns a mikeio Dataset for any dfs file

fn = '../data/wind_20050501.dfs2'
# read fn to a variable ds and determine:
# a) the number of items
# b) the start and end of the file
# a) the minimum value for each timestep of the first item 
# (hint: use the .min(axis='space') on the dataarray

concat()#

concat belongs to the submodule mikeio.generic

fn1 = '../data/wind_20050501.dfs2'
fn2 = '../data/wind_20050502.dfs2'
fn3 = '../data/wind_20050503.dfs2'
# use concat and the above files to create a 
# new file "wind_200505_3days.dfs2"b
fn4 = '../data/wind_20050504.dfs2'
# add also fn4 and see what happens. Why does it fail? 

diff()#

diff() belongs to the submodule mikeio.generic

fnA = '../data/wind_20050501.dfs2'
fnB = '../data/wind_20050501_v2.dfs2'
# use diff to produce a new file wind_20050501_diff.dfs2 
# with the difference between the two above files