How to¶
How to Analyze Time Series¶
These tasks extract information from the time series, but do not manipulate the time series data itself.
Access Simple Statistics¶
Access Simple Statistics through the Time Series Properties¶
To access simple time series statistics through the time series properties:
- Select|topic=How To Select A Time Series the time series
- Right-click on the time series. The Properties Explorer will display two tabs: Time Series and Statistics
- Select the Statistics tab. It will show the basic statistics
- Average (Mean)|topic=Mean Value (Average)
- Maximum|topic=Maximum Value
- Minimum|topic=Minimum Value
- Standard Deviation|topic=Standard Deviation
- Number of Missing Values
These statistics are computed over the entire period of available data.
Access Simple Statistics through a Chart¶
To access simple time series statistics through a chart:
- Add|topic=Create A New Chart the time series data to a chart
- Access|topic=View Simple Time Series Statistics in a Chart the statistics in the chart properties
Compute Simple Statistics through Tools¶
To access simple time series statistics through Time Series Analysis tools:
- Select|topic=How To Select A Time Series the time series
- In the Tools Explorer select one of the Time Series Analysis Tools
- Maximum Value|topic=Maximum Value
- Minimum Value|topic=Minimum Value
- Mean (Time Weighted)|topic=Time Weighted Average (Mean)
- Standard Deviation|topic=Standard Deviation
- Mode|topic=Mode
- Data Quantile|topic=Data Quantile
- Execute|topic=How To Execute A Tool the tool. The results can be accessed in a table.
Compute Advanced Statistics¶
Advanced statistics are computed using the Time Series Analysis tools. To compute these statistics:
- Select|topic=How To Select A Time Series the time series
- In the Tools Explorer select one of
- Distribution|topic=Distribution (Cumulative Distribution Function – CDF, or probability Distribution Function – PDF)
- Duration Curve|topic=Duration Curve Tool
- In the Properties Explorer, set the desired tool properties.
- Execute|topic=How To Execute A Tool the tool. The results can be accessed in a table or chart.
The results of these calculations can not be saved as time series in the DSS database.
Compute Statistics Time Series¶
Some advanced statistics, which themselves are time series, can be computed using the time series tools. To compute these statistics:
- Select|topic=How To Select A Time Series the time series
- In the Tools Explorer select one of
- Moving Average|topic=Moving Average
- Residual Mass|topic=Residual Mass
- In the Properties Explorer, set the desired tool properties.
- Execute|topic=How To Execute A Tool the tool. The results can be accessed in a table or chart.
The results of these calculations can be saved as time series in the DSS database.
How to Manipulate a Time Series¶
Manipulate Time Series Properties¶
To manipulate time series properties (not the data itself):
- Select|topic=How To Select A Time Series the time series. The Properties Explorer will show two tabs: ‘Time Series’ and ‘Statistics’.
- Select the ‘Time Series’ tab.
- Edit time series properties by selecting properties fields
- Drop down menus with options will be displayed for the Time series ‘Type|topic=Supported Time Types’ and the ‘Value Type|topic=Supported Value Types’,
- The ‘Data Series Name’ and the ‘Variable’|topic=Supported Variable Types can be entered directly.
Changing the ‘Value Type’ or ‘Variable’ does not change the time series data itself, just its description. Therefore, tools|topic=Time Series Tools must be used to manipulate the time series data if the ‘Value Type’ or ‘Variable’ is changed.
See also .|topic=Create a New Time Series Manually
Manipulate Individual Data Values Manually¶
Data Tables are used to manipulate/edit time series data manually. To do so:
- Tabulate|topic=How To Tabulate A Time Series the time series
- Double-click the cell holding the data value to be edited
- Type in a new value and hit return.
Data values must be edited one at a time.
Edits are immediately saved to the DSS database. Thus the original time series should be replicated (copied , pasted|topic=Cut\, Copy\, Paste Or Delete A Time Series and renamed|topic=How To Rename A Time Series) first.
Manipulate Data Values using Time Series Tools¶
Time series tools are available to manipulate large amounts of data either in batch mode or interactively.
Batch Type Data Manipulation¶
To manipulate time series data using batch type ‘Time Series Processing ‘tools:
- Select|topic=How To Select A Time Series the time series
- In the Tools Explorer select one of
- Value Type Conversion|topic=Value Type Conversion
- Extract Time Period|topic=Extract Time Period
- Resample|topic=Resample
- Shift/Lag Time Period|topic=Shift/Lag Time Period
- Synchronizer|topic=Synchronizer
- In the Properties Explorer, set the desired tool properties.
- Execute|topic=How To Execute A Tool the tool. The results can be accessed in a table or chart.
Output time series can be saved|topic=Create a New Time Series from Tool Results to the DSS database via charts.
Interactive Data Manipulation¶
To manipulate time series data in interactve mode:
- Select|topic=How To Select A Time Series the time series
- In the Tools Explorer select one of
- Double Mass Analysis|topic=Double Mass
- Gap Filler|topic=Gap Filler
- Execute|topic=How To Execute A Tool the tool. This will open the tool specific user interface.
- Interact with the tool.
- When ready select ‘Execute’ to tabulate or chart the results
Output time series can be saved|topic=Create a New Time Series from Tool Results to the DSS database via charts.
How to use the Weather generator¶
This How To guide will illustrate the use of the weather generator tool, based on the nearest neighbor resampling technique. This function is used to generate ensemble time series to use as weather forcing to run multiple simulations. The result of such simulations has the form of ensemble time series output/s. The tutorial will also show how to run ensemble simulations using the generated weather data and work with the simulation results. Finally it will illustrate how to import external weather time series and work with them as ensemble time series.
Neighbor resampling weather generator tool¶
The weather generation tool creates daily time series ensembles of weather variables based on historical time series. It analyses historical time series from one or more locations of different variable types, shuffles the historical record and produces an ensemble of time series with consistent spatiotemporal statistics. The algorithm uses a Nearest-Neighbour method to calculate likeness of the weather between days as described in the paper:
Buishand, A. & Brandsma, T., Multisite simulation of daily precipitation and temperature in the Rhine basin by nearest-neighbor resampling, Water Resources Research, Vol 37, No 11, 2001.
We will give an example of how the weather generator tool simulates weather by shuffling historical time series data (see following figure). For each day of the year (DOY) to simulate (eg. day 50) a multi-day search window is centred on the preceding day (eg. day 49) for each year in the historical dataset. For example, for a search window of 7 days, the closest weather matches around DOY 49 is searched (between DOY 46 and 52 in all years in the historical record). Once the k closest weather matches are selected from all the time windows, one is chosen according to a discrete probability distribution that gives a higher probability to the closest neighbor. The following day*s data is used for DOY 50 in the generated time series. The time series is initialized by randomly selecting the value corresponding to a January 1st from the historical record.
The tool is designed such that the user selects one or more historical time series with the following conditions: - At least one of these time series is either precipitation or temperature - The time series selected contain at least 1096 overlapping days (3 years) - The time series contain daily values without gaps
The user also specifies: - The number of ensemble members to generate - The number of years to generate - The start year for the generated ensembles (which will begin January 1st) - The number of the k nearest neighbours - The number of days within the search window
Illustration of the nearest-neighbour weather generator. To simulate the value of DOY 50 the closest neighbour, e.g. the matching of the value of the previous day, DOY 49, is searched in the historical time series. The value of the following day is assumed to be the value of the day of simulation.
Case study¶
The model setup used in this tutorial is a simple MIKE 11 (M11) rainfall runoff model developed for the city of Aarhus. Three catchments and two river branches are represented in the model. The catchments are those of Aarhus city, Lyngbygård and Skibby; the branches are those of Aarhus Å, in the Skibby catchment, and Lyngbygård Å, in the Lyngbygård catchment. The simulated variables of interest are the discharge at the stations Skibby, along Aarhus Å branch, and Lyngbygård, along Lyngbygård Å branch, against which the model was calibrated.
The default simulation period is a 20-years period running from 2-1-1990 to 31-12-2009.
In this tutorial an ensemble of input time series of temperature, precipitation and evapotranspiration will be generated by the weather generator tool for the three catchments. The produced model output will be an ensemble of river discharge time series at Skibby and Lyngbygård stations.
Import model, create and populate scenario¶
In order to be able to import and work with the Aarhus model using the MIKE Workbench platform, the steps illustrated in the following have to be done. To get help on how to perform the below operations, as well as if you have any doubts on how to use MIKE Workbench, please, refer to the help manual.
-
Register the model
Register the Aarhus model in MIKE Workbench with the name Aarhus M11. The Scenario for the model is created during the registration process. You can keep the default names for the model group and the name of the scenario. !!! note Remember that before being restarted, the original model must be run with M11 and the results must be generated. -
Populate the model scenario with the model input and output variables that will be changed in the exercise
These are the input weather time series of temperature, rainfall and evapotranspiration at the three catchments and the M11 output of the discharge time series at Skibby and Lyngbygård stations, all listed in the tables below.
!!! note
Note that the same weather time series are used at the Skibby and Lyngbygård catchments and also that the temperature input is the same in all three catchments.
Input time seriesVariable Time series Catchment Temperature DMI_Temperature_Aarhus_Total_RR.dfs0 Skibby, Lyngbygård, Aarhus by Evaporation DMI_PE_Aarhus_Total_RR_cc_v5.dfs0
DMI_PE_ Aarhus _Total_RR_cc_v3.DFS0Skibby and Lyngbygård
Aarhus byRainfall DMI_rainfall_Aarhus_min_runoff_RR.dfs0
DMI_rainfall_Aarhus_by_RR.DFS0Skibby and Lyngbygård
Aarhus byOutput time series
Variable Time series Runoff RunOff, SKIBBY, 119.000 - 1 - SIM_2012_FF_NAM_v9_full.res11
RunOff, LYNGBYGÅRD, 131.000 - 2 - SIM_2012_FF_NAM_v9_full.res11Tip
Multiple variables can be included in the scenario at the same time. To select more than one variable, hold the ctrl key while selecting the variables.
-
Set hotstart date
The MIKE Workbench adapter for M11 is currently not importing the initial condition of the hotstart file of the original model setup, if the date is different than the start date of the simulation. Therefore this entry has to be set manually. This is done in the scenario properties window. Set the initial condition for reading the hotstart file to the one in the original model, ie. to 1-1-2006 00:00:00.
-
Run the baseline simulation
Run the model once to generate the results for the baseline scenario. These can then be compared to the results of the ensemble simulation.
You should now be able to find the simulation results in the MIKE Workbench time series explorer. You can try to plot them in a chart, for example, or view them in a table.
Generation of weather time series¶
This section illustrates through an example how to create ensembles of weather time series using the weather generator (WG) tool of MIKE Workbench. For this exercise, an ensemble of climate time series will be generated for all the weather input variables included in the model scenario.
-
Select the time series and the WG tool
We want to generate an ensemble of time series for all the 5 weather records included in the input scenario. To do that, first select the input time series for which you want to create the ensemble. !!! tip The WG tool can run on multiple time series, so you can select all time series at the same time. -
Select and configure the WG tool
Select the weather generator (WG) tool from the tools explorer. You can then configure the tool entries in the tool property window.
For this exercise we will generate an ensemble of 10 members for each time series, each 20-years long and starting at the first year of the simulation, 1990. Set the WG entries accordingly and keep the other WG parameters to the recommended values with a search window of 61 days and k=5.
-
Run the tool
When the tool entries are set, you can execute the tool, for example running it to a chart.
This command generates an ensemble of 10 time series for each input time series selected. However, only the mean of the generated ensemble is shown in the generated plot.Note
Remember that it is possible to apply the weather generator tool only to time series containing daily values and without missing values. If the time series are not on daily equidistant time axis, you can use the resampling tool available in the tools explorer to transform them in the required format (Time series processing -> Resampling tool).
-
Save the weather ensemble time series to the database
The generated ensembles should be saved to the database in order to be used as input time series for the ensemble scenario. There are several options to save time series to the database. One of them, which is easy to use when working with few time series, is to save them manually from the generated plot.
First, create a sub-folder in the database and rename it WG ensemble TS. Then select a time series from the chart legend, right click on it and choose save as. In the window that appears, select as Group name the WG ensemble TS subfolder. The time series is added to the subfolder and the postfix (Generated) is added to its original name. Note that ensemble time series are indicated in the time series manager by the symbol.
Repeat this step for each of the 5 weather time series.
Different operations can be performed on ensemble time series. For example, all the members of the ensemble can be added to the same chart or opened in a table, and several statistics can be calculated for the ensemble. We will illustrate all these options when looking at the ensemble simulation results.
Creating a tool sequence in MIKE Workbench¶
Alternatively to performing steps 3 and 4, you could also have created a sequence of commands to both run the WG tool and save the generated time series into the specified folder. In this way, you create a sequence of commands that can be saved in the toolbox and applied in the same way as any other pre-defined tools. This option can save a lot of time, especially when working with a large number of time series. The following steps illustrate how to work with sequences in MIKE Workbench.
-
As previously done, select the 5 input time series for which you want to generate weather ensembles from the time series explorer.
-
In the tools explorer select the nearest neighbor resampling tool. Check that it is configured as previously described, otherwise change the entries. Right click on the tool and choose the option Add to sequence.
-
A new window appears showing the sequence of tools to run. After the Selected Object tool, it contains only the Nearest neighbour resampling tool. We need to add the command to save the generated time series to the database.
-
Select from the tools explorer the To database tool. In the tool property window specify as Save to group entry the folder WG ensemble TS, so that the folder is created, if not existing, and the generated time series are saved into it. As previously done, add the tool to the sequence.
-
Now that the sequence is created, we need to save it in the toolbox. Do it by clicking on the save icon on top of the sequence window.
The sequence is now saved to the toolbox in the folder Stored Sequence with the default name My sequence_1. Right click on the sequence name and rename it, for example as WG_and_save_tool.
-
You can now select again the 5 input time series and run the tool. You can run it from the sequence window, by clicking the run icon
and then click Run Entire Sequence. Alternatively, you can also run the tool from the property window (note that, in this case, it does not matter which run option - to chart/list/time series table - you select. Since only the commands in the sequence are run, no plots, list or time series will be displayed in the data view window).
The ensemble time series are generated and saved into the WG ensemble TS folder.
To open the sequence window, for example if you need to check the entries and edit its tools, right click on the name of the sequence and choose Edit.
Ensemble scenario simulation¶
The ensemble weather time series will be the input for the new simulation to execute. In this case, an ensemble of 10 simulation results will be produced. This section will explain how to set up a new scenario and run a simulation using the weather ensemble time series as input.
-
Create a new scenario
The only difference between the baseline scenario and the ensemble scenario is in the weather inputs. All the other parameters are the same, including the scenario inputs and outputs we want to modify or view after running a simulation. To create a copy of the existing scenario with the above properties use the clone option.
You can rename the new scenario, e.g. as Ensembles scenario of Aarhus M11.
Note
Creating a new scenario from the imported model will also create a duplicate of the scenario we have just worked with. The only difference is that, in this case, the scenario is not populated and the model inputs and outputs of interest have to be included again.
-
Substitute the historical input time series with the ensemble weather time series
The generated weather ensemble time series must be associated to the input variables of the new scenario. To do that, first open the ensemble scenario on the data view and then move to the time series explorer. Drag and drop each time series from the time series explorer to the related scenario input variable in the scenario data view. Do that for all the 5 time series, carefully checking that the names of the time series and variables for which the association is made are the same.
The full path of the time series that has been associated to a variable can be seen in the fly-by text when holding the pointer above the variable. This is useful for checking that the scenario variables contain the correct generated time series. -
Ensemble simulation execution
After all the inputs variables have been associated to the weather ensemble ones, run a simulation for the ensemble scenario.
When an ensemble simulation is executed, a corresponding number of sub-simulations is run and the resulting output time series are assembled together.
The number of simulations, N_sim, is dependent on the number of ensemble members in the input time series. N_sim is determined as the minimal number of time series members in any input time series having more than 1 member. For any other input time series having only one member, this member is used in all model simulations. If the time series have more than one member, then the members from 1 to N_sim are used.
In this case, since all the time series ensembles have 10 members, 10 different simulations will be executed for the scenario.
Viewing of results and post processing¶
When an ensemble simulation is executed, a corresponding number of model simulations is run and the resulting output time series assembled together in an
ensemble time series, which is indicated in the time series explorer by the symbol .
By default the commands add to new chart, add to new table as well as the tools of the time series explorer, when applied to an ensemble time series, perform operations on a time series that is the mean of the ensemble members. The single ensemble members can be extracted and inspected as well, as explained in the following.
In this tutorial, the generated ensemble outputs to analyze are the discharge at Lyngbygård and Skibby stations. Here we will work with Skibby time series only. You are welcome to inspect the output runoff time series at Lyngbygård as well.
-
Visual inspection of statistical properties of a time series ensemble
You can make a plot of the mean ensemble runoff at Skibby using the command Add to new chart All. This command opens a chart window showing the mean discharge at Skibby station.
You can perform a visual inspection of some statistical properties of the time series ensemble using the MIKE Workbench chart tools available in the chart toolstrip. These tools allow you to add the max/min range of the ensemble,, and the +/- one standard deviation from the mean of the ensemble,
.
To make these tools available, first select the chart time series in the chart legend (left click on it).
First, add the min/max range of the ensemble to the chart. The new series will have the name of the original series appended to the name of the selected statistics.
In the chart the max/min range appears by default as a colored area, which covers the mean of the ensemble. To make the ensemble mean visible again, right click on the Skibby runoff time series line in the chart legend and select Send to back.
You can change how the elements in the chart are displayed by selecting them in the chart legend and change their properties in the time series property window. You can, for example, set the primary color of the min/max range area to white and choose red as border color. For the Skibby runoff time series, you can set the line color to a darker blue.
If you move to the Statistics time series window, you can check some statistics on the selected time series, such as average, maximum and minimum values, missing values and standard deviation.
After applying the new format settings, zoom into an area of interest of the chart. Tip: to zoom in the chart click and hold on the start time of the period that shall be zoomed in. Hold and drag to the end of the period. When releasing, the chart will zoom in on the selected period. Use the scroll-bar to move the zoom window.)
You can notice how the variability of the discharge in the ensemble increases with larger discharge values and with discharge peaks. To further explore this, you can visually check the standard deviation of the ensemble.
To add the standard deviation range to the chart, select the Skibby runoff time series from the chart legend, then apply the +/- one standard deviation tool. The +/- one standard deviation is calculated and added by default as a new series to the chart as a filled area. You can change its appearance as previously done for the min/max range.
-
Another ensemble statics tool
Another tool is available in the time series toolbox to calculate statistics on ensemble time series, the Ensemble statistics tool. Like some of the previously used tools, it can calculate the maximum, minimum, mean and standard deviation of the ensemble. Additionally, it can compute the quartile and the exceedance and non-exceedance probabilities of the ensemble. All these statistics are calculated for each day of the time series and can be added to a chart, as well as opened in a table.
You can try to create some plots with these statistics for the output discharge ensemble time series.
-
Extract ensemble members
So far we have worked with the mean of the ensemble and some statistical properties of the ensemble. We will now learn how to extract the time series of the ensemble and work with them.
In the time series explorer, select the ensemble output of the runoff at Skibby station. In the time series tools explorer select the tool Extract ensemble members. This tool extracts the time series from the ensemble and saves them as single time series to the database. Specify the path /Ensemble output/Skibby as destination Target group in which the time series will be saved. Run the tool.
A new subfolder called Skibby is created and the time series are saved into it. Each time series name has a suffix in the form #n with n ranging from 0 up to (total number of ensembles -1). You can notice that the symbol of these time series is the one of a single time series:.
Plot all the ensemble members in the same chart (select simultaneously all the time series and select Add to new chart All).
You can zoom into the plot, to be able to inspect the different patterns of the ensemble members.
As an exercise, you can add to this plot the mean of the ensemble and again, the max/min range of the ensemble. You can format the average and the range in order to make them easily visible in the chart. Check that the range includes all members.
-
Duration curve plots
You can work with the member time series as any kind of single time series and apply to them the tools from the tools explorer. You can, for example, make a duration curve plot for the discharge ensemble.
Select all the ensemble members from the time series explorer. Choose the Duration curve tool from the tools explorer and run it with the option to chart.
You can now add the duration curve of the average ensemble time series to this chart. Following the previous steps, run the duration curve tool on the mean ensemble time series with the option To chart. A new duration curve plot is added to the same window of the ensemble plot. You can then move the mean duration curve to the plot of the ensemble members curves. To do so, select the time series in the plot legend, right click and choose Move to existing chart area Legend.
The duration curve of the average discharge is added to the plot of the ensemble members. You can then format the duration curve of the average discharge, for example choosing a black dash line and increasing its thickness to 2.
Using external data to run climate simulations¶
In the previous part of the tutorial, we showed how to generate weather scenarios using the weather generator built in MIKE Workbench and use them to run a model to create hydrological scenarios. It is also possible to use MIKE Workbench to make ensemble model runs using external climate time series. To illustrate this feature we consider a climate change study that uses climate data from an ensemble of climate model scenarios. The time series of different climate scenarios can be imported in the MIKE Workbench database, grouped an ensemble time series and used as weather forcing for any hydrological model. This section illustrates how to do it.
We continue working with the Aarhus model and we try to run it using some climate change weather time series available as .dfs0 files.
The weather time series used in this tutorial are produced using 15 different combinations of global and regional climate circulation models. The climate projections are based on the emission scenario SRA1B for the prediction year 2080.
The weather data available for the climate change projections have a larger spatial extent than that of the three catchments defined in the model. Therefore, only one precipitation, potential evapotranspiration and temperature time series is available for the area. So, differently than the baseline model we previously worked with, in this scenario the three catchments will have the same weather forcing.
-
Import time series
MIKE Workbench offers several tools to import time series files into the platform, depending on the format of the files containing the data. You can find them in the time series tools explorer, after you have selected any of the folders in the time series explorer. Specific tools are available to import data from ASCII, .dfs0, GRIB, NetCDF files.
When you select one of these tools, you can see the respective property window populated with the entries to specify. You can notice that these tools allow you to import time series from a single file, a folder or a batch file. In the first case, only the selected file is imported; in the second case all the files contained within the selected folder are imported; while, in the last case, the import settings are loaded into the time series import wizard from a comma separated file. You can also notice that the imported files can be saved in a specific folder and also renamed during the importing process.
The generic Time series import tool allows to access and import even a larger variety of files, whose type can be read in the selection menu in the property file of the tool. This tool, however, allows to import only one time series at a time.
In our case, the climate data describing precipitation, potential evapotranspiration and temperature are in .dfs0 format and are contained in a folder called CC time series. Therefore we choose to import them using the IMPORT FROM DFS0 tool and, in the tools properties, we specify Folder as Import from option. Set the other tool entries as shown in the figure below. Then run the tool.
The Climate Change data folder is created in the time series explorer and populated with the imported time series. 15 climate time series are imported for each weather variable. Each time series has the name of the file of origin followed by a postfix of the form [data_type_n] with data_type that is evaporation, temperature or Precip and n, a number ranging from 1 to 15.
-
Group time series as ensemble time series
The time series tool Convert to ensemble is used to group a set of time series into an ensemble time series. In order to use it, you need to first select all the time series of a specific weather type that you want to include in the ensemble. In the tool property window specify the name of the ensemble time series and also that of the folder in which you want the variable to be saved (here we use the names CC_Evaporation, CC_temperature and CC_rainfall for the variables and Climate Change ensembles for the folder). Then run the tool. Do it for the 3 different climate variables.
-
Ensemble scenario simulation
Once the ensembles are created, they can be used as input time series to run a climate simulation with the Aarhus model. You can proceed as done before when setting up and running a simulation with ensemble time series inputs. Refer to the previous sections of this tutorial or to the MIKE Workbench help manual if you need help or want to know additional details on how to proceed.-
Create new scenario (remember to use the Clone model option)
-
Associate climate ensemble time series to model input variables
-
Run model simulations
Note that you can extend the simulation end date to 31-12-2009 and generate 20 years of results. -
Check outputs
As previously done for the ensemble results created using the weather generator, you can use the tools available in the time series toolbox to inspect and analyze the climate change simulation results.
-