Homework
Exercise 1
- Download this dfs0 file into a new project folder.
- Create an empty Jupyter Notebook and import mikeio.
- Read the dfs0 file into a
Dataset
object. - Convert the
Dataset
object into a PandasDataFrame
object. - Call the
describe()
method and review the statistics. - In the same notebook, select a subset of the items.
- Export the subset
DataFrame
to csv with Pandas (hint:to_csv()
)
Exercise 2
- Download this dfs0 file into a new project folder.
- Create an empty Jupyter Notebook and import mikeio.
- Read the dfs0 file into a
Dataset
, only including data between “1993-12-02 16:00” and “1993-12-02 20:00”. - Convert the
Dataset
object into a PandasDataFrame
object. - Plot the
DataFrame
using.plot()
. - Select the first 3 rows of the
DataFrame
in two different ways: usingiloc
and usingloc
.
Exercise 3
- Repeat steps 1-2 of the previous exercise.
- Read the dfs0 file into a
Dataset
object, then convert it to aDataFrame
. - Resample the half-hourly data to minutely data (i.e. upsample) using time interpolation.
- Resample the half-hourly data to hourly data (i.e downsample) using mean aggregation.
- Try 3-4 again, except choose a different fill/aggregation method. Compare the results.
Exercise 4
- Download this dfs0 file into a new project folder.
- Create an empty Jupyter Notebook and import mikeio.
- Read the dfs0 file into a
Dataset
object, then convert it to aDataFrame
. - Compare the observed and model values using a line plot, a scatter plot, and a histogram.
- Save the plots to a
png
file.
Exercise 5
- Download this csv file into a new project folder.
- Read the csv file into a
DataFrame
using Pandas. - Check for
nan
values in the rainfall. How many missing values are there? - Fill the missing value(s) using an appropriate imputation method.
Exercise 6
- Continue from where you left off in the previous exercise.
- Create an
ItemInfo
object for the rainfall data. - Create a
Dataset
object from theDataFrame
. Ensure its item metadata is correct. - Save the
Dataset
object to a dfs0 file. - Open the dfs0 file in MIKE+. Does it make sense?