Homework

Exercise 1

  1. Download this dfs0 file into a new project folder.
  2. Create an empty Jupyter Notebook and import mikeio.
  3. Read the dfs0 file into a Dataset object.
  4. Convert the Dataset object into a Pandas DataFrame object.
  5. Call the describe() method and review the statistics.
  6. In the same notebook, select a subset of the items.
  7. Export the subset DataFrame to csv with Pandas (hint: to_csv())

Exercise 2

  1. Download this dfs0 file into a new project folder.
  2. Create an empty Jupyter Notebook and import mikeio.
  3. Read the dfs0 file into a Dataset, only including data between “1993-12-02 16:00” and “1993-12-02 20:00”.
  4. Convert the Dataset object into a Pandas DataFrame object.
  5. Plot the DataFrame using .plot().
  6. Select the first 3 rows of the DataFrame in two different ways: using iloc and using loc.

Exercise 3

  1. Repeat steps 1-2 of the previous exercise.
  2. Read the dfs0 file into a Dataset object, then convert it to a DataFrame.
  3. Resample the half-hourly data to minutely data (i.e. upsample) using time interpolation.
  4. Resample the half-hourly data to hourly data (i.e downsample) using mean aggregation.
  5. Try 3-4 again, except choose a different fill/aggregation method. Compare the results.

Exercise 4

  1. Download this dfs0 file into a new project folder.
  2. Create an empty Jupyter Notebook and import mikeio.
  3. Read the dfs0 file into a Dataset object, then convert it to a DataFrame.
  4. Compare the observed and model values using a line plot, a scatter plot, and a histogram.
  5. Save the plots to a png file.

Exercise 5

  1. Download this csv file into a new project folder.
  2. Read the csv file into a DataFrame using Pandas.
  3. Check for nan values in the rainfall. How many missing values are there?
  4. Fill the missing value(s) using an appropriate imputation method.

Exercise 6

  1. Continue from where you left off in the previous exercise.
  2. Create an ItemInfo object for the rainfall data.
  3. Create a Dataset object from the DataFrame. Ensure its item metadata is correct.
  4. Save the Dataset object to a dfs0 file.
  5. Open the dfs0 file in MIKE+. Does it make sense?