Skip to content

Time Series Module

Time series stored in a MIKE OPERATIONS database can be retrieved, organized and analyzed using the time series manager.

Time series providers allows retrieving and maintaning time series of 3rd party time series databases.

// Get the time series module after starting up the application.
var tsModule = application.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;
# Get the time series module from the application.
tsModule = app.Modules.Get("Time series Manager")
# Get the time series module from the application.
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(app.Modules.Get('Time series Manager'))

Module Providers

The time series module contains the following providers, providing access to the MIKE OPERATIONS database.

Provider Description
TimeSeriesList Manage time series.
TimeSeriesGroupList Manage time series groups.
FlagDefinitionList Manage time series quality flag definitions of flag types. Flag definitions contains a value, a color and a description.
FlagTypeList Manage time series quality flag types. Each flag type has a number of quality flag definitions.
TimeSeriesFlagMappingList Manage time series quality flag mappings for time series. The time series flag mapping defines the flags available for a time series.
TimeSeriesCommentMappingList Manage time series comment mappings
TimeSeriesFeatureAssociationList Manage time series associations to features of feature classes.

Read more about using module providers here

Using queries

A selection of time series can be fetched using queries.

// Fetch time series with Equidistant_Calendar
var tsModule = app.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;
var query = new DHI.Solutions.Generic.Query();
query.Add(new DHI.Solutions.Generic.QueryElement("XAxisType", 3, DHI.Solutions.Generic.QueryOperator.Eq));
var tsList = tsModule.TimeSeriesList.Fetch(query);
# Fetch time series with Equidistant_Calendar
tsModule = app.Modules.Get('Time series Manager')
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("XAxisType", 3, DHI.Solutions.Generic.QueryOperator.Eq))
tsList = tsModule.TimeSeriesList.Fetch(query)
# Fetch time series with Equidistant_Calendar
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(app.Modules.Get('Time series Manager'))
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("XAxisType", 3, DHI.Solutions.Generic.QueryOperator.Eq))
tsList = tsModule.TimeSeriesList.Fetch(query)

Using the Like operator.

// Fetch time series starting with "aa" using the "Like" operator.
var tsModule = app.Modules.Get("Time series Manager");
var query = new DHI.Solutions.Generic.Query();
query.Add(new DHI.Solutions.Generic.QueryElement("Name", "aa*", DHI.Solutions.Generic.QueryOperator.Like));
var tsList = tsModule.TimeSeriesList.Fetch(query);
# Fetch time series starting with "aa" using the "Like" operator.
tsModule = app.Modules.Get('Time series Manager')
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("Name", "aa*", DHI.Solutions.Generic.QueryOperator.Like))
tsList = tsModule.TimeSeriesList.Fetch(query)
# Fetch time series starting with "aa" using the "Like" operator.
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(app.Modules.Get('Time series Manager'))
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("Name", "aa*", DHI.Solutions.Generic.QueryOperator.Like))
tsList = tsModule.TimeSeriesList.Fetch(query)

Query Properties

Time Series

Query properties supported when querying on time seriesin the TimeSeriesList provider.

Query Property Type Database Column Note
_End DateTime end_time
_MaxAllowedValue double max_allowed_value
_MemberCount int member_count
_MinAllowedValue double min_allowed_value
_Start DateTime start_time
GroupId Guid group_id The time series group id.
IsPublic bool is_public Use a boolean (True or False)
Name string name
StorageType int storage_type Raw = 0
Blob = 1
StorageBlobPeriod int storage_blob_period This property only contains values for time series of StorageType=1 (Blob).
For StorageType=0 (Raw), the value is Null.
Hour = 0
Day = 1
Week = 2
Month = 3
Year = 4
TimeStep double time_step Time step length for equidistant time series (XAxisType=Equidistant and Equidistant_Calendar).
TimeZoneUTC string time_zone_utc
Url string url
ValueType int value_type Instantaneous = 0
Accumulated = 1
Step_Accumulated = 2
Mean_Step_Accumulated = 3
Reverse_Mean_Step_Accumulated = 4
XAxisType int time_type Undefined_Axis = 0
Equidistant = 1
Non_Equidistant = 2
Equidistant_Calendar = 3
Non_Equidistant_Calendar = 4
YAxisUnitCode int eum_unit The EUM unit code (mm, m, m^3/s etc). Refer to the eum.xml file of available unit codes in the MIKE Zero installation.
YAxisVariableCode int eum_type The EUM variable code (Water level, Rainfall etc). Refer to the eum.xml file of available unit codes in the MIKE Zero installation.
Version Guid version
XmlInfo string xmlinfo

Time Series Values (time steps)

The list of time steps (list of IDataSeriesValuePair) of a time series is not directly used as a provider as value pairs has it's own mapping.

Query Property Type Database Column Note
coverperiodstart DateTime date_time The property name on IDataSeriesValuePair is XValue
coverperiodend DateTime date_time The property name on IDataSeriesValuePair is XValue
datetime DateTime date_time The property name on IDataSeriesValuePair is XValue
xvalue double data_value The property name on IDataSeriesValuePair is YValue
value double data_value The property name on IDataSeriesValuePair is YValue
// Get time steps for a specific period of a time series using a custom query. 
var start = SystemDateTime.Now.AddDays(-7);
var end = System.DateTime.Now;
var query = new DHI.Solutions.Generic.Query();
query.Add(new DHI.Solutions.Generic.QueryElement("datetime", start, DHI.Solutions.Generic.QueryOperator.Gte));
query.Add(new DHI.Solutions.Generic.QueryElement("datetime", end, DHI.Solutions.Generic.QueryOperator.Lte));
var timeSteps = ts.Fetch(query);
# Get time steps for a specific period of a time series using a custom query. 
start = System.DateTime.Now.AddDays(-7)
end = System.DateTime.Now
query = DHI.Solutions.Generic.Query()
query.Add(DHI.Solutions.Generic.QueryElement("datetime", start, DHI.Solutions.Generic.QueryOperator.Gte))
query.Add( DHI.Solutions.Generic.QueryElement("datetime", end, DHI.Solutions.Generic.QueryOperator.Lte))
timeSteps = ts.Fetch(query)

Updating time series efficiently

Minimizing the number of database operations is vital for making efficient code that performs. This means that number of calls to the provider methods Add, Update and Delete should be minimized.

When updating time series values, this is also the case.

Do not add or update time steps by calling ts.Add(valuePair) or ts.Update(valuePair) many times. Instead build a list of time steps and use ts.SetData(valuePairList) followed by a single tsModule.TimeSeriesList.Update(ts, true).

// Fetch all existing time steps of the time series
var valuePairList = ts.FetchAll();

// Add time steps to the list (no database operations)
valuePairList.Add(timeStepList);

// Set all time steps of the time series (in memory)
ts.SetData(valuePairList);

// Update the time series with only one database call.
tsModule.TimeSeriesList.Update(ts, true);
# Fetch all existing time steps of the time series
valuePairList = ts.FetchAll()

# Add time steps to the list (no database operations)
valuePairList.Add(timeStepList)

# Set all time steps of the time series (in memory)
ts.SetData(valuePairList)

# Update the time series with only one database call.
tsModule.TimeSeriesList.Update(ts, True)

Updating time series quality flags

Time series quality flags of time steps can be updated using the API of MIKE OPERATIONS

# Fetch an existing time series
ts = timeseriesManager.TimeSeriesList.Fetch('/myTimeSeries')

# Get the flag type to use (here the first one is used).
flagType = timeseriesManager.FlagTypeList.FetchAll()[0]

# Get the value pair (time step) of the time series to apply the quality flag to.
valuePair = ts.FetchAll()[0]

# Create a new quality flag mapping (or update an existing one).
tsFlagMap = timeseriesManager.TimeSeriesFlagMappingList.CreateNew()
tsFlagMap.FlagTypeId = flagType.Id
tsFlagMap.TimeSeriesId = ts.Id
# Sequence indicates the member number in case the time series is an ensemble time series. 
# Sequence=1 for the first member or if the time series is not an ensemble, hence only has only one member.
tsFlagMap.Sequence = 1
if ts.IsCalendar:
    tsFlagMap.DateTime = valuePair.XValue
else:
    tsFlagMap.DateTime = DateTime.FromOADate(valuePair.XValueAsDouble);

tsFlagMap.FlagValue = 2
timeseriesManager.TimeSeriesFlagMappingList.Add(tsFlagMap)

Remote Data Providers

For remote time series providers, data can be queried either directly from the provider or by registrating the time series, so that time series are available from the default time series provider.

// Get the time series module
var tsModule = application.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;

// Fetch time series registrated in the time series manager.
var registratedTs = tsModule.TimeSeriesList.Fetch("/RegistratedTimeSeries/Ts1");

// Fetch time series directly from the provider.
// Create a new provider
var timeSeriesMikeCloudProvider = new DHI.Solutions.TimeseriesManager.TSMIKECloudProvider.TimeSeriesMIKECloudProvider();

// Startup the provider with the connection string as argument and add it to the list of time series data providers.
timeSeriesMikeCloudProvider.StartUp(application, tsModule, "[API Key]");
tsModule.TimeSeriesDataProviders.Add(timeSeriesMikeCloudProvider);

// Fetch a time series using the provider (here from the MIKE Cloud Time Series Provider).
var ts = timeSeriesMikeCloudProvider.TimeSeriesList.Fetch("/projectname/subproj1Name/subproj2Name/datasetName&timeseriesName");
# Get the time series module
tsModule = app.Modules.Get("Time series Manager")

# Fetch time series registrated in the time series manager.
registratedTs = tsModule.TimeSeriesList.Fetch("/RegistratedTimeSeries/Ts1")

# Fetch time series directly from the provider.
# Create a new provider
timeSeriesMikeCloudProvider = DHI.Solutions.TimeseriesManager.TSMIKECloudProvider.TimeSeriesMIKECloudProvider()

# Startup the provider with the connection string as argument and add it to the list of time series data providers.
timeSeriesMikeCloudProvider.StartUp(app, tsModule, "[API Key]")
tsModule.TimeSeriesDataProviders.Add(timeSeriesMikeCloudProvider)

#Fetch a time series using the provider (here from the MIKE Cloud Time Series Provider).
ts = timeSeriesMikeCloudProvider.TimeSeriesList.Fetch("/projectname/subproj1Name/subproj2Name/datasetName&timeseriesName")
# Get the time series module
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(app.Modules.Get("Time series Manager"))

# Fetch time series registrated in the time series manager.
registratedTs = tsModule.TimeSeriesList.Fetch("/RegistratedTimeSeries/Ts1")

# Fetch time series directly from the provider.
# Create a new provider
timeSeriesMikeCloudProvider = DHI.Solutions.TimeseriesManager.TSMIKECloudProvider.TimeSeriesMIKECloudProvider()

# Startup the provider with the connection string as argument and add it to the list of time series data providers.
timeSeriesMikeCloudProvider.StartUp(app, tsModule, "[API Key]")
tsModule.TimeSeriesDataProviders.Add(timeSeriesMikeCloudProvider)

#Fetch a time series using the provider (here from the MIKE Cloud Time Series Provider).
ts = timeSeriesMikeCloudProvider.TimeSeriesList.Fetch("/projectname/subproj1Name/subproj2Name/datasetName&timeseriesName")

MIKE Cloud Provider

The sample code below shows how to startup a MIKE Cloud provider (DHI Platform Time Series storage) in case it has not already been loaded from the runtime.config file.

Install the NuGet package DHI.MikeOperations.TimeseriesManager.Provider.MikeCloud in order to load required dependencies for the MIKE Cloud provider.

The DHI Platform storage contains data in projects. Each project contains a hierarchy of sub-projects containing datasets. When using the MIKE Cloud Time Series Provider, both projects and sub-projects are treated as groups. This means that querying groups using TimeSeriesGroupList, will return projects and sub-projects but NOT datasets.

This means that when adding new time series using the MIKE Cloud Time Series Provider, the name of the time seriesbeing added should contain both dataset name and time series name (separated by a &).

// Get the time series module.
var module = application.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;

// Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
var timeSeriesMikeCloudProvider = new DHI.Solutions.TimeseriesManager.TSMIKECloudProvider.TimeSeriesMIKECloudProvider();

// Startup the provider with the connection string as argument and add it to the list of time series data providers.
timeSeriesMikeCloudProvider.StartUp(application, module, "[API Key]");
module.TimeSeriesDataProviders.Add(timeSeriesMikeCloudProvider);

// Get all time series from the MIKE Cloud storage.
var ts = timeSeriesMikeCloudProvider.TimeSeriesList.FetchAll();

// Get a single time series from the full path of the time series in the cloud storage.
var ts = timeSeriesMikeCloudProvider.TimeSeriesList.Fetch("/projectname/subproj1Name/subproj2Name/datasetName&timeseriesName");
# Get the time series module.
tsModule = app.Modules.Get("Time series Manager")

# Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
timeSeriesMikeCloudProvider = DHI.Solutions.TimeseriesManager.TSMIKECloudProvider.TimeSeriesMIKECloudProvider()

# Startup the provider with the connection string as argument and add it to the list of time series data providers.
timeSeriesMikeCloudProvider.StartUp(app, tsModule, "[API Key]")
module.TimeSeriesDataProviders.Add(timeSeriesMikeCloudProvider)

# Get all time series from the MIKE Cloud storage.
ts = timeSeriesMikeCloudProvider.TimeSeriesList.FetchAll()

# Get a single time series from the full path of the time series in the cloud storage.
ts = timeSeriesMikeCloudProvider.TimeSeriesList.Fetch("/projectname/subproj1Name/subproj2Name/datasetName&timeseriesName")
# Get the time series module.
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(app.Modules.Get("Time series Manager"))

# Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
timeSeriesMikeCloudProvider = DHI.Solutions.TimeseriesManager.TSMIKECloudProvider.TimeSeriesMIKECloudProvider()

# Startup the provider with the connection string as argument and add it to the list of time series data providers.
timeSeriesMikeCloudProvider.StartUp(app, tsModule, "[API Key]")
module.TimeSeriesDataProviders.Add(timeSeriesMikeCloudProvider)

# Get all time series from the MIKE Cloud storage.
ts = timeSeriesMikeCloudProvider.TimeSeriesList.FetchAll()

# Get a single time series from the full path of the time series in the cloud storage.
ts = timeSeriesMikeCloudProvider.TimeSeriesList.Fetch("/projectname/subproj1Name/subproj2Name/datasetName&timeseriesName")

DIMS.CORE Provider

The sample code below shows how to startup a DIMS.CORE provider in case it has already been configured in MIKE Workbench and loaded from the runtime.config file.

Install the NuGet package DHI.MikeOperations.TimeseriesManager.Provider.DIMS.CORE in order to load required dependencies for the DIMS.CORE provider.

// Get the time series module.
var tsModule = application.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;

// Get the provider (if more DIMS.CORE providers has been configured, Single() cannot be used).
var dimsProvider = tsModule.TimeSeriesDataProviders.Single(p => p.Name == "Time Series DIMS Provider");

// Fetch all time series.
var allTs = dimsProvider.TimeSeriesList.FetchAll();
# Get the time series module.
tsModule = app.Modules.Get("Time series Manager")

# Get the provider (if more DIMS.CORE providers has been configured, Single() cannot be used).
dimsProvider = None

for provider in tsModule.TimeSeriesDataProviders:
    if provider.Name == "Time Series DIMS Provider":
        dimsProvider = provider
        break

# Fetch all time series.
allTs = dimsProvider.TimeSeriesList.FetchAll();
# Get the time series module.
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(app.Modules.Get("Time series Manager"))

# Get the provider (if more DIMS.CORE providers has been configured, Single() cannot be used).
dimsProvider = tsModule.TimeSeriesDataProviders.Single(p => p.Name == "Time Series DIMS Provider")

# Fetch all time series.
allTs = dimsProvider.TimeSeriesList.FetchAll();

MIKE OPERATIONS Provider

The MIKE OPERATIONS provider allows access to MIKE OPERATIONS time series in another MIKE OPERATIONS database. When logging in to MIKE Workbench, it is possible to get a connection token for the active connection. The sample code below shows how to startup a MIKE OPERATIONS provider in case it has not already been loaded from the runtime.config file.

Install the NuGet package DHI.MikeOperations.TimeseriesManager.Provider.MikeOperations.

// Get the time series module.
var tsModule = application.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;

// Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
var provider = new DHI.Solutions.TimeseriesManager.TimeSeriesMOProvider.TimeSeriesMOProvider();

// Startup the provider with the connection token.
provider.StartUp(application, tsModule, "[connection token]");
module.TimeSeriesDataProviders.Add(provider);

// Get all time series.
var ts = provider.TimeSeriesList.FetchAll();

// Get a single time series from the full path of the time series.
var ts = provider.TimeSeriesList.Fetch("/group1/ts1");
# Get the time series module.
tsModule = app.Modules.Get("Time series Manager")

# Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
provider = DHI.Solutions.TimeseriesManager.TimeSeriesMOProvider.TimeSeriesMOProvider()

# Startup the provider with the connection token.
provider.StartUp(app, tsModule, "[connection token]")
module.TimeSeriesDataProviders.Add(provider)

# Get all time series.
ts = provider.TimeSeriesList.FetchAll()

# Get a single time series from the full path of the time series.
ts = provider.TimeSeriesList.Fetch("/group1/ts1")
# Get the time series module.
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(app.Modules.Get("Time series Manager"))

# Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
provider = DHI.Solutions.TimeseriesManager.TimeSeriesMOProvider.TimeSeriesMOProvider()

# Startup the provider with the connection token.
provider.StartUp(app, tsModule, "[connection token]")
module.TimeSeriesDataProviders.Add(provider)

# Get all time series.
ts = provider.TimeSeriesList.FetchAll()

# Get a single time series from the full path of the time series.
ts = provider.TimeSeriesList.Fetch("/group1/ts1")

Tools

When using the API for running tools, every tool are following the concept in the below sample showing the use of the Time Series Resample tool.

// Get the tool from the tool name.
var tool = application.Tools.CreateNew("Resample") as DHI.Solutions.TimeseriesManager.Tools.Processing.IResampleTool;

// Add input items to the tool.
tool.InputItems.Add(ts);

// Set the properties of the tool.
tool.TimeStepDay = 1;

// Execute the tool.
tool.Execute();

// Get the output of the tool (if any).
var resampledTs = tool.OutputItems[0];
# Get the tool from the tool name.
tool = app.Tools.CreateNew("Resample")

# Add input items to the tool.
tool.InputItems.Add(ts)

# Set the properties of the tool.
tool.TimeStepDay = 1

# Execute the tool.
tool.Execute()

# Get the output of the tool (if any).
resampledTs = tool.OutputItems[0]
# Get the tool from the tool name.
tool = DHI.Solutions.TimeseriesManager.Tools.Processing.IResampleTool(app.Tools.CreateNew("Resample"))

# Add input items to the tool.
tool.InputItems.Add(ts)

# Set the properties of the tool.
tool.TimeStepDay = 1

# Execute the tool.
tool.Execute()

# Get the output of the tool (if any).
resampledTs = tool.OutputItems[0]

Accumulation

This tool calculates the accumulation of all values in a time series. Note this is not the same as summing the values. For rates and instantaneous values, accumulation is calculated by multiplying the values by the time period they are applicable.

Tool Info Accumulation
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IAccumulationTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Accumulation") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.AccumulationTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
double value = (double)outputItem.TabularData.Rows[0][1];

Annual Maximum

This tool extracts the annual maximum. The start of the year can be set to any day and month.

Tool Info Annual Maximum
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ExtremeValues
API Reference DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.IAnnualMaximumTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • StartDay: Gets or sets start day of water year
  • StartMonth: Gets or sets start month of water year

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Annual Maximum") as DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.AnnualMaximumTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts);
tool.StartDay = 1;
tool.StartMonth = 5;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Annual maximum series (seasonal)

In the annual maximum series (AMS) method the maximum value in each year of the record are extracted for the extreme value analysis.

Tool Info Annual maximum series (seasonal)
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.ISeasonalAnnualMaximumTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • StartDay: Gets or sets start day of water year
  • StartMonth: Gets or sets start month of water year
  • SeasonStartDay: Gets or sets start day of season
  • SeasonStartMonth: Gets or sets start month of season
  • SeasonEndDay: Gets or sets end day of season
  • SeasonEndMonth: Gets or sets end month of season

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Annual maximum series (seasonal)") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.ISeasonalAnnualMaximumTool;
# Get the tool.
tool = app.Tools.CreateNew("Annual maximum series (seasonal)")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.ISeasonalAnnualMaximumTool(app.Tools.CreateNew("Annual maximum series (seasonal)"))

Annual N-Day Minimum

Tool for calulating the annual day minimum of a time series.

Tool Info Annual N-Day Minimum
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ExtremeValues
API Reference DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.IAnnualNDayMinimumTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • StartDay: Gets or sets start day of water year
  • StartMonth: Gets or sets start month of water year
  • AverageLength: Gets or sets length of averaging

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Annual N-Day Minimum") as DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.AnnualNDayMinimumTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts);
tool.StartDay = 1;
tool.StartMonth = 1;
tool.AverageLength = 10;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Append

The Append tool is used to append a time series or a value to an existing time series. The following methods are available: - Append_timeseries – One time series is appended to the other, at a user specified date(Master time series / Date settings appear when selected). If both time series contains a time step at the append date, the value from the master time series will be used. - Append_value – Adds a specified single value at a user specified date(value / date tool setting appears when selected). - Append_last_value – Adds the last value of a time series to a new time step at a user specified date(Date setting appear when selected).

Tool Info Append
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IAppendTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • AppendOption: Gets or sets the Append option.
  • AppendDate: Gets or sets a value indicating the DateTime value the append cuts between timeseries. All steps in the master timeseries before and on AppendDate are copied to the output timeseries. All steps in the other timeseries after AppendDate are copied to the output timeseries. If the other timeseries has a step on AppendDate - and the master did not - it is copied to the output timeseries.
  • AppendDateValue: Gets or sets a value indicating the time for which the specified value shall be inserted.
  • AppendValue: Gets or sets the value that shall be appended at the specified AppendDateValue.
  • MasterTimeseries: Gets or sets the name of the master time series to append time steps to.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Append") as DHI.Solutions.TimeseriesManager.Tools.Processing.AppendTool;

// Set the tool properties and execute.
tool.AppendOption = DHI.Solutions.TimeseriesManager.Tools.Processing.AppendOption.Append_last_value;
tool.InputItems.Add(ts1);
tool.InputItems.Add(ts2);
tool.MasterTimeseries = "TsName1";
tool.AppendDate = new DateTime(2000, 1, 5, 0, 0, 0, 0);
tool.AppendDateValue = new DateTime(2018, 8, 30);
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Append values

This tool is used for appending values on an existing time series in the database.

Tool Info Append values
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.IAppendValuesTools
Input Items A single time series
Output Items A time series

Tool Properties

  • FilePath: Gets or sets the csv file names.
  • IsOutOfPlatform: Gets or sets a value indicating whether tool is out of platform
  • TemplateName: Gets or sets the template of the previous chart
  • FlagFilePath: Gets or sets the path of flag file
  • FlagMappingFilePath: Gets or sets the path of mapping flag file
  • OverwriteExistingValues: Gets or sets a value indicating whether over write the existing value
  • OverwriteExistingFlags: Gets or sets a value indicating whether over write the existing flags
  • Delimiter: Gets or sets the delimiter of the input file
  • DecimalSeparator: Gets or sets the decimal separator
  • TimeFormat: Gets or sets the time format
  • UseDefaultTimeFormat: Gets or sets a value indicating whether use default time format
  • TimeColumn: Gets or sets the time column
  • DataColumn: Gets or sets the data column
  • DataStartRow: Gets or sets the data start row

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Append values") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.AppendValuesTools;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.AutoUIExecute = false;
tool.FilePath = @"c:\temp\spreadsheet1.xlsx";
tool.IsOutOfPlatform = true;
tool.FlagMappingFilePath = @"c:\temp\MappingSpreadsheet.xlsx";
tool.OverwriteExistingFlags = true;
tool.DecimalSeparator = ".";
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Auto-correlation

This tool calculates the auto-correlation value of a time series.

Tool Info Auto-correlation
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IAutoCorrelationTool
Input Items A single time series
Output Items An X-Y data series

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Auto-correlation") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.AutoCorrelationTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Average

The Average tool is used to calculate the simple mean and/or time weighted average of one or more time series.

Tool Info Average
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.ITimeWeighedAverageValueTool
Input Items One or more time series
Output Items A data table

Tool Properties

  • TimeBasedAverageValue: Gets or sets a value indicating whether the type of average.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Average") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.TimeWeighedAverageValueTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.TimeBasedAverageValue = true;
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = (double)outputItem.TabularData.Rows[0][1];

BasicAvgNumEvent

The Count per year (average) tool returns the average number of time steps per year that contains values.

Tool Info BasicAvgNumEvent
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IBasicAvgNumEventTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("BasicAvgNumEvent") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.BasicAvgNumEventTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
double actual = (double)outputItem.TabularData.Rows[0][1];

BasicLMoments

L-moments are statistics used to summarize the shape of a probability distribution. They are analogous to ordinary moments in that they can be used to calculate quantities analogous to standard deviation, skewness and kurtosis, termed the L-scale, L-skewness and L-kurtosis respectively (the L-mean is identical to the conventional mean). L-moments differ from conventional moments in that they are calculated using linear combinations of the ordered data; the "l" in "linear" is what leads to the name being "L-moments". Just as for conventional moments, a theoretical distribution has a set of population L-moments.

Tool Info BasicLMoments
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IBasicLMomentsTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("BasicLMoments") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.BasicLMomentsTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = outputItem.TabularData.Rows[0];

BasicOrdinaryMoments

The Ordinary moments tool calculates the ordinary moments of one or more time series. The ordinary moments are: - Mean - Variance - Skewness - Kurtosis

Tool Info BasicOrdinaryMoments
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IBasicOrdinaryMomentsTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("BasicOrdinaryMoments") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.BasicOrdinaryMomentsTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = outputItem.TabularData.Rows[0];

BasicSampleSize

The Basic Sample Size tool returns the number of time steps that contains values in a time series (number of time steps minus missing values).

Tool Info BasicSampleSize
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IBasicSampleSizeTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("BasicSampleSize") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.BasicSampleSizeTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
int result = (int)outputItem.TabularData.Rows[0][1];

Check time series tool

The Check time series tool checks the values of one or more time series, according to a specified criterion, and returns back a boolean with the result of the check.

Tool Info Check time series tool
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.ICheckTimeseriesTool
Input Items One or more time series
Output Items A data table

Tool Properties

  • CheckMethod: Gets or sets the CheckMethod. The check method determines which check that will be applied to the input items.
  • PeriodOption: Gets or sets the PeriodOption. The period option determines if the check shall be applied to the entire time series, or to a sub-period only
  • StartDate: Gets or sets the StartDate. The start date determines the start of the sub-period for which the check will be applied.
  • EndDate: Gets or sets the EndDate. The end date determines the end of the sub-period for which the check will be applied.
  • CheckValue: Gets or sets the CheckValue. The check value is the value that will be searched for if CheckMethod = Value_exists.
  • MaxGap: Gets or sets the MaxGap. The max gap is the maximum acceptable gap in a time series. If a gap that exceeds the MaxGap is found in a time series, true is returned.
  • RangeMax: Gets or sets RangeMax. Range max is the minimum value of the range that will be checked for if CheckMethod = WithinRange.
  • RangeMin: Gets or sets RangeMin. Range min is the minimum value of the range that will be checked for if CheckMethod = WithinRange.
  • MaxRateOfChange: Gets or sets the MaxRateOfChange. This is the value that defines the maximum acceptable rate of change. If this rate is exceeded in one or more time steps, true will be returned. Relevant if CheckMethod = Max_rate_of_change.
  • RateOfChangeUnit: Gets or sets the RateOfChangeUnit. The rate of change unit defines the unit of the specified MaxRateOfChange.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Check time series tool") as DHI.Solutions.TimeseriesManager.Tools.Processing.CheckTimeseriesTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds);
tool.CheckMethod = DHI.Solutions.TimeseriesManager.Tools.Processing.CheckMethod.Within_range;
tool.PeriodOption = DHI.Solutions.TimeseriesManager.Tools.Processing.CheckTimeseriesTool_PeriodOption.Entire_timeseries;
tool.RangeMax = 100;
tool.RangeMin = 5;
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
bool valueExists = (bool)outputItem.TabularData.Rows[0][1];

Convert to ensemble

Tool for converting two or more time series into a single ensemble time series.

Tool Info Convert to ensemble
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IConvertToEnsembleTool
Input Items Two or more time series
Output Items A time series

Tool Properties

  • EnsembleName: Gets or sets the name of ensemble name to the selected series
  • TargetGroup: Gets or sets a value indicating the selected series. to the selected series
  • DuplicateNameOption: Gets or sets the option when a time series with the same name is already existed in the group

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Convert to ensemble") as DHI.Solutions.TimeseriesManager.Tools.Processing.ConvertToEnsembleTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds1);
tool.InputItems.Add(ds2);
tool.TargetGroup = "/test";
tool.EnsembleName = "EnsembleTest";
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Coverage

This tool calculates coverage of time series.

Tool Info Coverage
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.ITimeSeriesCoverageTool
Input Items One or more time series
Output Items No output items

Tool Properties

  • IsOutOfPlatform: Gets or sets a value indicating whether tool is out of platform

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Coverage") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.ITimeSeriesCoverageTool;
# Get the tool.
tool = app.Tools.CreateNew("Coverage")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.ITimeSeriesCoverageTool(app.Tools.CreateNew("Coverage"))

Create timeseries

The Create time series tool is used to create a new time series based on a template time series. Optionally, a constant value can be inserted in each time step.

Tool Info Create timeseries
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.ICreateTimeseries
Input Items One or more time series
Output Items A time series

Tool Properties

  • StartTime: Gets or sets the the start date of the new time series
  • EndTime: Gets or sets the end date of the new time series
  • Value: Gets or sets the value that will be inserted at all time steps.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Create timeseries") as DHI.Solutions.TimeseriesManager.Tools.Processing.CreateTimeseries;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.StartTime = new DateTime(2017, 12, 20);
tool.EndTime = new DateTime(2018, 1, 26);
tool.Value = 168;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Cross-correlation

The Cross-correlation tool measures the similarity between a time series and lagged versions of another time series as a function of the lag.

Tool Info Cross-correlation
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.ICrossCorrelationTool
Input Items Two or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Cross-correlation") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.CrossCorrelationTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds1_in);
tool.InputItems.Add(ds2_in);
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
string name = ds_out.TabularData.Rows[0][0].ToString();
double value = (double)ds_out.TabularData.Rows[0][1];

Cumulative distribution function

Cumulative distribution function tool, calculating the probability that a random variable, from a particular distribution, is less than a certain value.

Tool Info Cumulative distribution function
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.CumulativeDistribution
API Reference DHI.Solutions.TimeseriesManager.Tools.CDFTool.ICDFTool
Input Items One or more estimation of distribution parameters
Output Items An X-Y data series

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Cumulative distribution function") as DHI.Solutions.TimeseriesManager.Tools.CDFTool.ICDFTool;
# Get the tool.
tool = app.Tools.CreateNew("Cumulative distribution function")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.CDFTool.ICDFTool(app.Tools.CreateNew("Cumulative distribution function"))

Data quantile

This tool calculates the data quantile. The data quantile is the value that a specified fraction of all raw data are less than. For a fraction of 0.5 the data quantile is the same as the median.

Tool Info Data quantile
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IDataQuantileTool
Input Items One or more time series
Output Items A data table

Tool Properties

  • Fraction: Gets or sets the fraction for which the data quantile shall be calculated for. For a fraction of 0.5 the data quantile is the same as the median.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Data quantile") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.DataQuantileTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Fraction = 0.25;
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = (double)outputItem.TabularData.Rows[0][1];    

Delta Change Factors

The Delta Change Factor tool downscales one or multiple climate parameter time series (precipitation, temperature, evaporation or potential evapotranspiration) using monthly delta change factors (CFs) given in NetCDF format. The tool can either generate delta change factors from control and scenario climate data or be given the delta change factors directly. Delta change factors are relative (precipitation, potential evapotranspiration) or absolute (temperature) changes of monthly averages derived from the comparison between scenario and control period. The monthly CFs are multiplied (added) by every value in the respective month of the observation time series in order to derive the downscaled and projected timeseries. Climate data is given in NetCDF format for the control and scenario period.If the periods span across several NetCDF files, then a CSV file can be used as input that lists the files in chronological order.

Tool Info Delta Change Factors
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ClimateDeltaChangeDownscaling
API Reference DHI.Solutions.TimeseriesManager.UI.Tools.DeltaChangeDownscalingTool.IDeltaChangeDownscalingTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • MinimumRainfallThreshold: Gets or sets a value indicating the minimum threshold for average monthly rainfall, below which the value is not considered in the calculation for Delta Change Factor for the month
  • IsPeriodRepresentative: Gets or sets a value indicating whether the data is representive of a time duration instead of the exact date or time. ie. if the data is daily data at 12pm (or any hour of the day), the data represents that entire day. If the data is monthly data and the date falls on the 15th day of the month (or any other day of the month), the data represents the entire month.
  • CalculateDeltaChangeFactors: Gets or sets a value indicating whether delta change factors shall be calculated. If true, ControlDataFilePath, ScenarioDataFilePath and ChangeFactorFilePath (path to file to be created) shall be provided If false, only ChangeFactorFilePath is required
  • CalculateDeltaChangeFactorsOnlyForObservedData: Gets or sets a value indicating whether delta change factors shall be calculated only for spatial grids in which the observed data resides If true, ControlDataFilePath, ScenarioDataFilePath and ChangeFactorsFilePath shall be provided
  • OutputSuffix: Gets or sets the suffix to be added to the name of the input dataseries when naming output dataseries
  • ControlDataFilePath: Gets or sets the path for the control data NetCDF file In case control data splits across multiple files, pass the CSV file listing the multiple NetCDF files in chronological order Only required if CalculateDeltaChangeFactors is true
  • ScenarioDataFilePath: Gets or sets the path for the scenario data NetCDF file In case scenario data splits across multiple files, pass the CSV file listing the multiple NetCDF files in chronological order Only required if CalculateDeltaChangeFactors is true
  • DeltaChangeFactorsFilePath: Gets or sets the path for the delta change factors If CalculateDeltaChangeFactors is set to true, it represents the path for the file to be created Delta change factors file is generated if CalculateDeltaChangeFactors is true
  • KeepTimestepAsObservedData: Gets or sets a value indicating whether to keep the future timesteps the same as observed data. If KeepTimestepAsObservedData is set to true, the future timesteps will be the same as the observed timesteps. Else, it will be the same as the scenario timesteps

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Delta Change Factors") as DHI.Solutions.TimeseriesManager.UI.Tools.DeltaChangeDownscalingTool.IDeltaChangeDownscalingTool;
# Get the tool.
tool = app.Tools.CreateNew("Delta Change Factors")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.UI.Tools.DeltaChangeDownscalingTool.IDeltaChangeDownscalingTool(app.Tools.CreateNew("Delta Change Factors"))

Differences

A Timeseries Difference tool that can calculate residual time series from a master time series.

Tool Info Differences
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Differences
API Reference DHI.Solutions.TimeseriesManager.Tools.TSeriesDifferenceTool.ITimeseriesDifferenceTool
Input Items Two or more time series
Output Items A time series

Tool Properties

  • MasterSeries: Gets or sets a value indicating the selected series. All time series will be subtracted to the selected series

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Differences") as DHI.Solutions.TimeseriesManager.Tools.TSeriesDifferenceTool.TimeseriesDifferenceTool;

// Set the tool properties and execute.
tool.InputItems.Add(differenceTest_Ts_Master);
tool.InputItems.Add(differenceTest_Ts_Input);
tool.MasterSeries = differenceTest_Ts_Master.Name;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Distribution

Distribution Functions tool supporting distribution functions:

  • Cumulative (CDF) - The probability that a random variable, from a particular distribution, is less than a certain value.
  • Probability (PDF) - The probability of the random variable falling within a particular range of values.
Tool Info Distribution
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IDistributionTool
Input Items One or more time series
Output Items An X-Y data series

Tool Properties

  • DistributionType: Gets or sets the distribution Type.
  • IntervalLength: Gets or sets the interval length
  • StartValue: Gets or sets the start value

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Distribution") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.DistributionTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.DistributionType = DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.DistributionType.CDF;
tool.IntervalLength = 214;
tool.StartValue = -28;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Double mass

The Double mass tool is used to determine whether there is a need for corrections to the data to account for changes in data collection procedures or other local conditions. The tool is configured in a dialog that appears when executing the tool.

Tool Info Double mass
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.DoubleMass
API Reference DHI.Solutions.TimeseriesManager.UI.Tools.DoubleMassTool.IDoubleMassTool
Input Items Two or more time series
Output Items A time series

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Double mass") as DHI.Solutions.TimeseriesManager.UI.Tools.DoubleMassTool.IDoubleMassTool;
# Get the tool.
tool = app.Tools.CreateNew("Double mass")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.UI.Tools.DoubleMassTool.IDoubleMassTool(app.Tools.CreateNew("Double mass"))

Drought Duration and Volume

Drought duration and volume tool.

Tool Info Drought Duration and Volume
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IDroughtTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • Threshold: Gets or sets threshold level for computation
  • VolumeUnit: Gets or sets the volume unit.
  • Variable: Gets or sets variable.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Drought Duration and Volume") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.DroughtTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Threshold = 300;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Duration curve

Duration curves. X-axis: time-weighted probability, Y-axis: data values exceeded.

Special case for instantaneous data, which are treated with EventsToScalarOperator. Slow, but correct, because: With interpolation for instantaneous data, where several thresholds may be crossed during a single time step, e.g., so the duration above those thresholds must also be counted (whereas a naive algorithm would only count the duration above the lowest of the two adjacent values in the single time step currently examined). Sketch:

Tool Info Duration curve
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IDurationCurveTool
Input Items One or more time series
Output Items An X-Y data series

Tool Properties

  • XAxisUnit: Gets or sets the X-axis unit

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Duration curve") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.DurationCurveTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.XAxisUnit = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.XAxisUnitType.Fraction;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Empirical CDF

Cumulative distribution function (empirical) Tool.

Tool Info Empirical CDF
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Distribution
API Reference DHI.Solutions.TimeseriesManager.Tools.Distribution.IEmpiricalCDFTool
Input Items One or more time series
Output Items An X-Y data series

Tool Properties

  • PlotPosition: Gets or sets plotting position (empirical probability). The following plotting positions can be used (Blom, Cunnane, Gringorten, Hazen, Weibull).

Tool Methods

  • SetPlotPosition(EvaStatWrapper.PlotType plotPos): set plotting position by PlotType

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Empirical CDF") as DHI.Solutions.TimeseriesManager.Tools.Distribution.EmpiricalCDFTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.PlotPosition = "Weibul";
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

EnsembleStatisticsTool

The ensemble statistics tool calculates a user specified statics for each input ensemble time series. The tool will return the calculated result as an ordinary time series with one value for each time step in the input ensemble time series. The tool calculates the statistics of the remaining elements once missing values are removed.

Tool Info EnsembleStatisticsTool
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IEnsembleStatisticsTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • StatOption: Gets or sets the statistics option.
  • Probability: Gets or sets the probability for the quantile statistics option
  • ExceedanceConstant: Gets or sets the Exceedance Constant value option
  • NonExceedanceConstant: Gets or sets the Non Exceedance Constant value option

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("EnsembleStatisticsTool") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.EnsembleStatisticsTool;

// Set the tool properties and execute.
tool.StatOption = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.StatOption.Maximum;
tool.Execute();    

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Exceedance Duration and Volume

Exceedance duration and volume.

Tool Info Exceedance Duration and Volume
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IExceedanceTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • Threshold: Gets or sets threshold level for computation

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Exceedance Duration and Volume") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.ExceedanceTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Threshold = 2000;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Extract ensemble members

A tool that can take an ensemble (multi-item) time series and produce a single item time series for each member.

Tool Info Extract ensemble members
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IExtractEnsembleMembersTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • TargetGroup: Gets or sets a value indicating the selected series. All time series will be subtracted to the selected series
  • DuplicateNameOption: Gets or sets the option when a time series with the same name is already existed in the group
  • SaveToDatabase: Gets or sets a value indicating whether the ensemble members should be saved to the database.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Extract ensemble members") as DHI.Solutions.TimeseriesManager.Tools.Processing.ExtractEnsembleMembers;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.TargetGroup = "/";
tool.DuplicateNameOption = DHI.Solutions.TimeseriesManager.Tools.Processing.DuplicateNameOption.CreateAndReplace;
tool.SaveToDatabase = true;
tool.Execute();

// Get the output of the tool.
var ds_member1 = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;
var ds_member2 = tool.OutputItems[1] as DHI.Solutions.Generic.IDataSeries;

Extract time period

Cuts all time series before start and beyond end date. This is done at the exact start and end dates, ie, if a TS does not have a time step at the start/end times, add it/them, and synchronize appropriately. The tool returns the extracted time series (clones).

Tool Info Extract time period
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IExtractPeriodTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • PeriodBegin: Gets or sets the start time for the cut.
  • PeriodEnd: Gets or sets the end time for the cut.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Extract time period") as DHI.Solutions.TimeseriesManager.Tools.Processing.ExtractPeriodTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.PeriodBegin = new DateTime(2010, 1, 3, 12, 0, 0, 0);
tool.PeriodEnd = new DateTime(2010, 1, 8, 12, 0, 0, 0);
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Fit to distribution

Parameter estimation tool for determining the probability distribution, supporting methods: - Moments - L_Moments - MaximumLikelihood

Tool Info Fit to distribution
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Distribution
API Reference DHI.Solutions.TimeseriesManager.Tools.Distribution.IParameterEstimateTool
Input Items One or more time series
Output Items Estimation of distribution parameters

Tool Properties

  • Method: Gets or sets method used to estimate parameters
  • Distribution: Gets or sets distribution used to estimate parameters
  • IType_LP3: Gets or sets input parameter used in MOM log-Pearson Type 3 distribution
  • IType_LN3: Gets or sets input parameter used in MOM log-normal distribution
  • Threshold: Gets or sets input parameter for following distributions:
    • Log_normal2
    • Exponential1
    • Generalised_Pareto2
    • GammaPearson_Type3_2
    • Weibull2

Tool Methods

  • SetMethod(EvaStatWrapper.MethodType method): set method with MethodType
  • SetDistribution(EvaStatWrapper.DistributionType dist): set distribution with DistributionType
  • SetTypeLN3(EvaStatWrapper.LN3Type ln3Type): set LN3 type with int
  • SetTypeLP3(EvaStatWrapper.LP3Type lp3Type): set LP3 type with int

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Fit to distribution") as DHI.Solutions.TimeseriesManager.Tools.Distribution.IParameterEstimateTool;
# Get the tool.
tool = app.Tools.CreateNew("Fit to distribution")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.Distribution.IParameterEstimateTool(app.Tools.CreateNew("Fit to distribution"))

Flag outliers

This tool adds a user specified flag to the values in a time series that falls within a specified criterion. Flags can be added to the original input time series, or a copy of the series. By default, Days=1.

Tool Info Flag outliers
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IFlagOutlierTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • UpperLimit: Gets or sets the upper limit of the data series.
  • LowerLimit: Gets or sets the lower limit of the data series.
  • AddFlagsToCopy: Gets or sets a value indicating whether the flags shall be added to a copy of the data series. If true, the flags shall be added to a copy of the data series. If false,the flags shall be added directly to the input time series.
  • FlagOutliers: Gets or sets the flag selected.
  • ReplaceExisting: Gets or sets a value indicating whether the flags replace the existing one If the value is true, the tool will always flag a value identified as outliers, even if the time step already has been flagged (and hence existing flags will be overwritten). If false, the tool will not add flags to time steps that has already been flagged.
  • Option: Gets or sets a value criteria for flagging
  • MaxRate: Gets or sets a value of maximum allowed rate
  • MinRate: Gets or sets a value of minimum allowed rate
  • Days: Gets or sets a value of change of rate per days
  • Hours: Gets or sets a value of change of rate per hours
  • Minutes: Gets or sets a value of change of rate per minutes
  • Seconds: Gets or sets a value of change of rate per seconds
  • Smoothing: Gets or sets a value of smoothing
  • Unit: Gets or sets the unit.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Flag outliers") as DHI.Solutions.TimeseriesManager.Tools.Processing.IFlagOutlierTool;
# Get the tool.
tool = app.Tools.CreateNew("Flag outliers")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.Processing.IFlagOutlierTool(app.Tools.CreateNew("Flag outliers"))

Forecast statistics

Forecast statistics tool

Tool Info Forecast statistics
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IForecastStatisticsTool
Input Items A single time series group
Output Items An X-Y data series

Tool Properties

  • Statistics: Gets or sets the value of Statistics
  • HindCast: Gets or sets the value of HindCast
  • ObservationTimeseries: Gets or sets the value of ObservationTimeseries
  • ForecastTimeseries: Gets or sets the value of ForecastTimeseries

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Forecast statistics") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IForecastStatisticsTool;
# Get the tool.
tool = app.Tools.CreateNew("Forecast statistics")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IForecastStatisticsTool(app.Tools.CreateNew("Forecast statistics"))

Gap filler

Fill gaps in time series Y by: 1. finding the most closely correlated other time series X in the analysis that has data; 2. use linear regression to get Y(X) = mX + b. The coefficients m and b can be found along with the correlations (to save time, although logically, they don't have anything to do with each other in the logic of this tool) Note there is no requirement on data type or unit consistency between X and Y. In that sense, this approach is similar to co-kriging. (Strictly speaking, the m parameter includes any unit conversion.) Example for why the approach makes sense: It is ok to infer discharge from rainfall.

Tool Info Gap filler
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.GapFiller
API Reference DHI.Solutions.TimeseriesManager.UI.Tools.GapFillerTool.IGapFillerTool
Input Items Two or more time series
Output Items A time series

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Gap filler") as DHI.Solutions.TimeseriesManager.UI.Tools.GapFillerTool.IGapFillerTool;
# Get the tool.
tool = app.Tools.CreateNew("Gap filler")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.UI.Tools.GapFillerTool.IGapFillerTool(app.Tools.CreateNew("Gap filler"))

Goodness-of-fit Chi-Squared

The Chi-square goodness of fit test is a statistical hypothesis test used to determine whether a variable is likely to come from a specified distribution or not. It is often used to evaluate whether sample data is representative of the full population.

Tool Info Goodness-of-fit Chi-Squared
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.GoodnessOfFit.ChiSquared
API Reference DHI.Solutions.TimeseriesManager.Tools.FitChiSquaredTool.IFitChiSquaredTool
Input Items One or more estimation of distribution parameters
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Goodness-of-fit Chi-Squared") as DHI.Solutions.TimeseriesManager.Tools.FitChiSquaredTool.IFitChiSquaredTool;
# Get the tool.
tool = app.Tools.CreateNew("Goodness-of-fit Chi-Squared")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.FitChiSquaredTool.IFitChiSquaredTool(app.Tools.CreateNew("Goodness-of-fit Chi-Squared"))

Goodness-of-fit Kolmogorov-Smirnov

The Kolmogorov-Smirnov Goodness of Fit Test (K-S test) compares distribution data with a known distribution to determine if the data have the same distribution.

Tool Info Goodness-of-fit Kolmogorov-Smirnov
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.GoodnessOfFit.KolmogorovSmirnov
API Reference DHI.Solutions.TimeseriesManager.Tools.FitKSTool.IFitKSTool
Input Items One or more estimation of distribution parameters
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Goodness-of-fit Kolmogorov-Smirnov") as DHI.Solutions.TimeseriesManager.Tools.FitKSTool.IFitKSTool;
# Get the tool.
tool = app.Tools.CreateNew("Goodness-of-fit Kolmogorov-Smirnov")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.FitKSTool.IFitKSTool(app.Tools.CreateNew("Goodness-of-fit Kolmogorov-Smirnov"))

Goodness-of-fit Log-Likelihood

Tool for calculating the log-likelihood value of a regression model. It is a way to measure the goodness of fit for a model. The higher the value of the log-likelihood, the better a model fits a dataset.

Tool Info Goodness-of-fit Log-Likelihood
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.GoodnessOfFit.LogLikelihood
API Reference DHI.Solutions.TimeseriesManager.Tools.FitLogLikelihoodTool.IFitLogLikelihoodTool
Input Items One or more estimation of distribution parameters
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Goodness-of-fit Log-Likelihood") as DHI.Solutions.TimeseriesManager.Tools.FitLogLikelihoodTool.IFitLogLikelihoodTool;
# Get the tool.
tool = app.Tools.CreateNew("Goodness-of-fit Log-Likelihood")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.FitLogLikelihoodTool.IFitLogLikelihoodTool(app.Tools.CreateNew("Goodness-of-fit Log-Likelihood"))

Goodness-of-fit Probability plot correlation coefficient

Tool for calculationg the correlation coefficient of a set of distribution parameters. The coefficient provides a measure of how good a linear prediction of the value of one of the two random variables can be formed based on an observed value of the other.

Tool Info Goodness-of-fit Probability plot correlation coefficient
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.GoodnessOfFit.ProbabilityPlot
API Reference DHI.Solutions.TimeseriesManager.Tools.FitPPCCTool.IFitPPCCTool
Input Items One or more estimation of distribution parameters
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Goodness-of-fit Probability plot correlation coefficient") as DHI.Solutions.TimeseriesManager.Tools.FitPPCCTool.IFitPPCCTool;
# Get the tool.
tool = app.Tools.CreateNew("Goodness-of-fit Probability plot correlation coefficient")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.FitPPCCTool.IFitPPCCTool(app.Tools.CreateNew("Goodness-of-fit Probability plot correlation coefficient"))

Histogram

Tool for creating a histogram from one or more time series.

Tool Info Histogram
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Distribution
API Reference DHI.Solutions.TimeseriesManager.Tools.Distribution.IHistogramTool
Input Items One or more time series
Output Items An X-Y data series

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Histogram") as DHI.Solutions.TimeseriesManager.Tools.Distribution.HistogramTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

ImportFromASCII

Import one or more time series from ASCII files. The ASCII file can contain multiple columns with time series. The name of the time series are specified in the first row of the file.

Only data consisting of a date and a value will be read. There may be other text in the file, but it will not be read. The exception is the optional title of the value column, which must be placed next to the DateTime-column. This will be the title of the time series.

Tool Info ImportFromASCII
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.IImportFromASCIITool
Input Items No or a single time series group
Output Items A time series

Tool Properties

  • FilePath: Gets or sets the file name. Enabled when ImportFromOption = SingleFile.
  • Group: Gets or sets the Group to which the time series / ensemble will be imported.
  • Folder: Gets or sets the Folder from which the time series / ensemble will be imported from. Enabled when ImportFromOption = Folder.
  • ImportFromOption: Gets or sets the import option. The import option determines if a single file, or all files in a specified folder shall be imported.
  • ImportAsOption: Gets or sets the import option. The import option determines if the items in the selected file(s) shall be imported as time series or time series ensembles.
  • EnsembleName: Gets or sets the name of the imported ensemble. Enabled when ImportAsOption = Ensemble.
  • ImportToDatabase: Gets or sets a value indicating whether the imported series shall be written to the database. Default is true, but for unit test, it shall be false.
  • TimeZone: Gets or sets the value of timezone
  • NamingOption: Gets or sets the time series naming option.
  • BatchImportFormat: Gets or sets the specification format of batch importing.
  • SpreadsheetPath: Gets or sets the path of the Spreadsheet that contains an optional import specification for importing more time series with varying properties. The spreadsheet can contain the following columns: "File name" (required), - "Item no.", "Group" (required), "Feature class (path)", "Feature (display attribute)", "Variable" (required for ASCII import), "Unit" (required for ASCII import), "ValueType" (required for ASCII import).
  • Variable: Gets or sets the DHI EUM variable for the time series.
  • Unit: Gets or sets the DHI EUM unit of the time series.
  • ValueType: Gets or sets the type of value of the time series.
  • Separator: Gets or sets the column separator in the ASCII file (Tab (\t), Comma ",", SemiColon ";" or Space " "). The default is Tab (\t).
  • DateColumn: Gets or sets the date column. The default date column is the first column of the file (1).
  • ValueColumn: Gets or sets the value column. The default is the second column (2)
  • FirstDataRow: Gets or sets the first data row. The default is the second row (2). Note that the first row (1) in the file can contain unit and variable of the time series to import in the following format. "Discharge[m^3/s]:Instantaneous". In this case the first data row will be 3.
  • DateTimeFormat: Gets or sets the time format of the DateColumn column. Default is "yyyy-MM-dd HH:mm:ss".
  • DecimalSeparator: Gets or sets the decimal separator.
  • MissingValue: Gets or sets the value used for missing values in the file.

Code Sample

// Get the tool assuming that the tool is already loaded.
var tool = application.Tools.CreateNew("ImportFromASCII") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromASCIITool;

tool.ImportFromOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromOption.SingleFile;
// Set column separator of the file (default=Tab).
tool.Separator = "Comma";
// Setting the file path will parse the file header using the separator.
tool.FilePath = @"c:\temp\TimeSeriesToImport.txt";
tool.Variable = "1st order rate AD model";
tool.Unit = "/h";
tool.Group = "/";
tool.ImportAsOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportAsOption.TimeSeries;

// Execute the tool
tool.Execute();

// Get the output of the tool.
var importedTsList = tool.OutputItems;

ImportFromDfs0

This tool will import dfs0 files to the DSS. The following import options are available: 1. Import a single dfs0 file 2. Import all dfs0 files in a specified folder to the dss. The tool can import the items in the selected dfs0 file(s) to a (number of) single item IDataSeries, or to a single multi item IDataSeries.

Tool Info ImportFromDfs0
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.IImportFromDfs0Tool
Input Items No or a single time series group
Output Items A time series

Tool Properties

  • FilePath: Gets or sets the file name. Enabled when ImportFromOption = SingleFile.
  • Group: Gets or sets the Group to which the time series / ensemble will be imported.
  • Folder: Gets or sets the Folder from which the time series / ensemble will be imported from. Enabled when ImportFromOption = Folder.
  • ImportFromOption: Gets or sets the import option. The import option determines if a single file, or all files in a specified folder shall be imported.
  • ImportAsOption: Gets or sets the import option. The import option determines if the items in the selected file(s) shall be imported as time series or time series ensembles.
  • EnsembleName: Gets or sets the name of the imported ensemble. Enabled when ImportAsOption = Ensemble.
  • ImportToDatabase: Gets or sets a value indicating whether the imported series shall be written to the database. Default is true, but for unit test, it shall be false.
  • TimeZone: Gets or sets the value of timezone
  • NamingOption: Gets or sets the time series naming option.
  • BatchImportFormat: Gets or sets the specification format of batch importing.
  • SpreadsheetPath: Gets or sets the path of the Spreadsheet that contains an optional import specification for importing more time series with varying properties. The spreadsheet can contain the following columns: "File name" (required), - "Item no.", "Group" (required), "Feature class (path)", "Feature (display attribute)", "Variable" (required for ASCII import), "Unit" (required for ASCII import), "ValueType" (required for ASCII import).

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("ImportFromDfs0") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromDfs0Tool;

// Set the tool properties and execute.
tool.ImportFromOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromOption.SingleFile;
tool.FilePath = @"c:\temp\discharge_station1.dfs0";
tool.Group = "/";
tool.ImportAsOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportAsOption.TimeSeries;
tool.NamingOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.NamingOption.FileNameAndItemName;
tool.ImportToDatabase = false;
tool.Execute();

// Get the output of the tool.
var importedTsList = tool.OutputItems;

ImportFromExcel

This tool is used for importing time series from Microsoft Excel.

Tool Info ImportFromExcel
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.IImportFromExcelTool
Input Items No or a single time series group
Output Items A time series

Tool Properties

  • Variable: Gets or sets the value of variable.
  • Unit: Gets or sets the value of unit.
  • ValueType: Gets or sets the list of value types supported.
  • TimeSeriesGroup: Gets or sets the value of TS group or TS path in the MO database where the time series are placed. If a folder is specified, the time series name to use is the sensor name.
  • ToDatabase: Gets or sets a value indicating whether the time series should be imported into the time series database (true). False means that the time series can be found as output items of the tool only.
  • FromDate: Gets or sets the value of date from where data (time steps) should be taken.
  • ToDate: Gets or sets the value of date from where data (time steps) should be taken.
  • ExcelFilePath: Gets or sets the Excel file name.
  • SheetName: Gets or sets the Excel Sheet name containing data to import.
  • DataStartRow: Gets or sets the Excel start row number.
  • DateColumn: Gets or sets the Excel date column: Use letters(A, B, C etc).
  • ValueColumn: Gets or sets the Excel value column: Use letters(A, B, C etc).
  • DateFormat: Gets or sets the Excel date format, in case the value of the cell is not a DateTime. Default "MM/dd/yy".
  • OutputDataSeriesName: Gets or sets output data series Name.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("ImportFromExcel") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromExcelTool;

// Set properties and execute the tool.
tool.ExcelFilePath = @"c:\temp\ts1.xlsx";
tool.SheetName = "Sheet1";
tool.DataStartRow = 2;
tool.DateColumn = "A";
tool.ValueColumn = "B";
tool.Variable = "Water Level";
tool.Unit = "m";
tool.ValueType = "Instantaneous";
tool.TimeSeriesGroup = "/";
tool.ToDatabase = false;
tool.Execute();

// Get the output of the tool.
var importedTsList = tool.OutputItems;

ImportFromGRIB

This tool is used for extracting time series from raster’s with the GRIB format. The time series for at single point can be imported or for all points.

Tool Info ImportFromGRIB
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportTsFromGRIBTool
Input Items No or a single time series group
Output Items A time series

Tool Properties

  • FilePath: Gets or sets the file path
  • Variable: Gets or sets the variable
  • Group: Gets or sets the group
  • DuplicateNameOption: Gets or sets the option when a time series with the same name is already present in the group
  • ExtractionOption: Gets or sets the extraction option
  • Latitude: Gets or sets the latitude of the interested point
  • Longitude: Gets or sets the longitude of the interested point
  • ImportAsOption: Gets or sets the import as option
  • OutputDataSeriesName: Gets or sets the name of the output data series
  • TargetVariable: Gets or sets the target variable
  • Unit: Gets or sets the unit
  • ValueType: Gets or sets the type of value
  • TimeVariableType: Gets or sets the type of temporal axis
  • Zone: Gets or sets the feature class for the required zone
  • CalculateWeights: Gets or sets a value indicating whether weights shall be recalculate
  • GridFeatureClassDuplicateNameOption: Gets or sets the option when a grid feature class with the same name is already present in the group
  • IsZonePropertyActive: Gets a value indicating whether the Zone property shall be visible
  • Feature: Gets or sets a feature from the feature class
  • IntersectLayer: Gets or sets intersect layer
  • TimeZone: Gets or sets the time zone

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("ImportFromGRIB") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportTsFromGRIBTool;

// Set the tool properties and execute.
tool.FilePath = @"c:\temp\nah.hs.200008.grb";
tool.Variable = "Significantheightofcombinedwindwavesandswell";
tool.DataProvider = DHI.Solutions.TimeseriesManager.Tools.ImportTools.GRIBDataProvider.DMI;
tool.ExtractionOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.ExtractionOption.SinglePoint;
tool.ImportAsOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportAsOption.TimeSeries;
tool.Longitude = 300.0;
tool.OutputDataSeriesName = " GRIBTest";
tool.TimeVariableType = "Equidistant_Calendar";
tool.ValueType = "Instantaneous";
tool.TargetVariable = "1st order rate AD model";
tool.Unit = "/h";
tool.Group = "/";
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

ImportFromNetCdf

This tool is used for extracting time series from raster’s with the NetCDF format. The time series for a single point can be imported or for all points.

Tool Info ImportFromNetCdf
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportTsFromNetCdfTool
Input Items No or a single time series group
Output Items A time series

Tool Properties

  • FilePath: Gets or sets the file path
  • Variable: Gets or sets the variable
  • Group: Gets or sets the group
  • DuplicateNameOption: Gets or sets the option when a time series with the same name is already present in the group
  • ExtractionOption: Gets or sets the extraction option
  • Latitude: Gets or sets the latitude of the interested point
  • Longitude: Gets or sets the longitude of the interested point
  • ImportAsOption: Gets or sets the import as option
  • OutputDataSeriesName: Gets or sets the name of the output data series
  • TargetVariable: Gets or sets the target variable
  • Unit: Gets or sets the unit
  • ValueType: Gets or sets the type of value
  • TimeVariableType: Gets or sets the type of temporal axis
  • Zone: Gets or sets the feature class for the required zone
  • CalculateWeights: Gets or sets a value indicating whether weights shall be recalculate
  • GridFeatureClassDuplicateNameOption: Gets or sets the option when a grid feature class with the same name is already present in the group
  • IsZonePropertyActive: Gets a value indicating whether the Zone property shall be visible
  • Feature: Gets or sets a feature from the feature class
  • IntersectLayer: Gets or sets intersect layer
  • TimeZone: Gets or sets the time zone

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("ImportFromNetCdf") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportTsFromNetCdfTool;

// Set the tool properties and execute.
tool.FilePath = @"c:\temp\Annual_temperature_32.nc";
tool.Variable = "temperature_at_1-5m";
tool.ExtractionOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.ExtractionOption.SinglePoint;
tool.ImportAsOption = DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportAsOption.TimeSeries;
tool.Latitude = 51.280002593994141;
tool.Longitude = 63.799999237060547;
tool.OutputDataSeriesName = " NetCdfTest";
tool.TimeVariableType = "Equidistant_Calendar";
tool.ValueType = "Instantaneous";
tool.TargetVariable = "1st order rate AD model";
tool.Unit = "/h";
tool.Group = "/";
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

ImportFromNOAA

This tool is used for importing time series from NOAA’s National Centers for Environmental Information (NCEI). NCEI is responsible for preserving, monitoring, assessing, and providing public access to the Nation's treasure of climate and historical weather data and information. https://www.ncdc.noaa.gov/cdo-web

Tool Info ImportFromNOAA
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.IImportFromNOAATool
Input Items No or a single time series group
Output Items A time series

Tool Properties

  • Variable: Gets or sets the value of variable.
  • Unit: Gets or sets the value of unit.
  • ValueType: Gets or sets the list of value types supported.
  • TimeSeriesGroup: Gets or sets the value of TS group or TS path in the MO database where the time series are placed. If a folder is specified, the time series name to use is the sensor name.
  • ToDatabase: Gets or sets a value indicating whether the time series should be imported into the time series database (true). False means that the time series can be found as output items of the tool only.
  • FromDate: Gets or sets the value of date from where data (time steps) should be taken.
  • ToDate: Gets or sets the value of date from where data (time steps) should be taken.
  • Token: Gets or sets User specific token. To gain access to NCDC CDO Web Services, register with your email address to get a access token. https://www.ncdc.noaa.gov/cdo-web/token
  • DatasetId: Gets or sets all of the CDO data are in datasets. The containing dataset must be known before attempting to access its data.
  • DataTypes: Gets or sets type of data, acts as a label.
  • Stations: Gets or sets stations are where the data comes from (for most datasets) and can be considered the smallest granual of location data.
  • DataSelection: Gets or sets the result data selection (dataset id, data types, locations and stations).

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("ImportFromNOAA") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromNOAATool;

// Set the tool properties and execute.
tool.Token = "[token]";
tool.Variable = "Undefined";
tool.Unit = "()";
tool.ValueType = "Instantaneous";
tool.DatasetId = "GH_HLY";
tool.Stations = " COOP:010063";
tool.DataTypes = "HPCP";
tool.TimeSeriesGroup = "/";
tool.ToDatabase = false;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

ImportFromRes1d

This tool will import res1d files to the DSS.

Tool Info ImportFromRes1d
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromRes1dTool
Input Items No or a single time series group
Output Items A time series

Tool Properties

  • FilePath: Gets or sets the file name. Enabled when ImportFromOption = SingleFile.
  • Group: Gets or sets the Group to which the time series / ensemble will be imported.
  • Folder: Gets or sets the Folder from which the time series / ensemble will be imported from. Enabled when ImportFromOption = Folder.
  • ImportFromOption: Gets or sets the import option. The import option determines if a single file, or all files in a specified folder shall be imported.
  • ImportAsOption: Gets or sets the import option. The import option determines if the items in the selected file(s) shall be imported as time series or time series ensembles.
  • EnsembleName: Gets or sets the name of the imported ensemble. Enabled when ImportAsOption = Ensemble.
  • ImportToDatabase: Gets or sets a value indicating whether the imported series shall be written to the database. Default is true, but for unit test, it shall be false.
  • TimeZone: Gets or sets the value of timezone
  • NamingOption: Gets or sets the time series naming option.
  • BatchImportFormat: Gets or sets the specification format of batch importing.
  • SpreadsheetPath: Gets or sets the path of the Spreadsheet that contains an optional import specification for importing more time series with varying properties. The spreadsheet can contain the following columns: "File name" (required), - "Item no.", "Group" (required), "Feature class (path)", "Feature (display attribute)", "Variable" (required for ASCII import), "Unit" (required for ASCII import), "ValueType" (required for ASCII import).

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("ImportFromRes1d") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromRes1dTool;
# Get the tool.
tool = app.Tools.CreateNew("ImportFromRes1d")

ImportFromSensemetricsTool

This tool is used for importing time series from Sensemetrics.

Tool Info ImportFromSensemetricsTool
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.IImportFromSensemetricsTool
Input Items No input items required
Output Items A time series

Tool Properties

  • Variable: Gets or sets the value of variable.
  • Unit: Gets or sets the value of unit.
  • ValueType: Gets or sets the list of value types supported.
  • TimeSeriesGroup: Gets or sets the value of TS group or TS path in the MO database where the time series are placed. If a folder is specified, the time series name to use is the sensor name.
  • ToDatabase: Gets or sets a value indicating whether the time series should be imported into the time series database (true). False means that the time series can be found as output items of the tool only.
  • FromDate: Gets or sets the value of date from where data (time steps) should be taken.
  • ToDate: Gets or sets the value of date from where data (time steps) should be taken.
  • APIKey: Gets or sets the value of API Key for getting access to connections, devices and sensors.
  • Connection: Gets or sets the value of a connection contains devices. It is possible to query a connection to get available devices.
  • Devices: Gets or sets the value of Devices.
  • Sensors: Gets or sets the sensors to import.
  • Host: Gets or sets the value of Host.
  • Metrics: Gets or sets the metrics to import.
  • RetrievalParamsXml: Gets or sets the retrieval parameters XML.

Tool Methods

  • GetNodeIds(): Gets the node ids/connections available using the API Key
  • GetDeviceIds(System.String nodeId): Gets the device ids of a node
  • GetSensorIds(): Gets a list of all sensor ids
  • GetSensorIds(System.String nodeId ,System.String deviceId): Gets a list of sensor ids for the specified device
  • GetSensors(): Gets a list of sensors.
  • GetMetrics(System.String sensorId): Gets a list of metrics of the specified sensor
  • GetMetrics(System.String nodeId ,System.String deviceId ,System.String sensorId): Gets a list of metrics of the specified node, device and sensor

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("ImportFromSensemetricsTool") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromSensemetricsTool;

// Set the tool properties and execute.
tool.APIKey = "[API Key]";
tool.Connection = "/n1/n2";
tool.Devices = "/d1/d2";
tool.Sensors = "/sensor";
tool.Metrics = "metrics";
tool.Variable = "Rainfall";
tool.Unit = "m";
tool.ValueType = "Instantaneous";
tool.ToDatabase = false;
tool.TimeSeriesGroup = "/";
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

ImportFromUSGS

The import from USGS tool is used to import time series data provided by the United States Geological Survey (USGS). Specifically, the tool downloads data from the USGS Daily Values Site Web Service (https://waterservices.usgs.gov/rest/DV-Service.html) and stores them in the selected time series group. The tool is designed to allow repeated execution in order to append more recent data to time series that already exist in the selected time series group.

Tool Info ImportFromUSGS
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ImportTools
API Reference DHI.Solutions.TimeseriesManager.Tools.ImportTools.IImportFromUSGSTool
Input Items No or a single time series group
Output Items A time series

Tool Properties

  • SiteNo: Gets or sets the site number of the station to download data from
  • ParameterCode: Gets or sets the parameter code of time serie to download for the station
  • StatisticsType: Gets or sets the type of time serie statistics to download for the station
  • StartDate: Gets or sets the Start Date of downloaded data
  • EndDate: Gets or sets the End Date of downloaded data
  • TimeSeriesGroup: Gets or sets the name of directory where time series will be stored
  • ImportToDatabase: Gets or sets a value indicating whether the imported series shall be written to the database. Default is true, but for unit test, it shall be false.
  • EnsureEquidistant: Gets or sets a value indicating whether it should be ensured that the time series imported are equidistant.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("ImportFromUSGS") as DHI.Solutions.TimeseriesManager.Tools.ImportTools.ImportFromUSGSTool;

// Set the tool properties and execute.
tool.StartDate = DateTime.MinValue;
tool.EndDate = DateTime.MinValue;
tool.SiteNo = "11456000,11458000";
tool.TimeSeriesGroup = "/";
tool.ImportToDatabase = false;
tool.ParameterCode = "00060";
tool.StatisticsType = "00003";
tool.EnsureEquidistant = true;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

MannKendall

The Mann-Kendall test is used for testing monotonic trend of a time series.

Tool Info MannKendall
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IMannKendallTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("MannKendall") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IMannKendallTool;
# Get the tool.
tool = app.Tools.CreateNew("MannKendall")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IMannKendallTool(app.Tools.CreateNew("MannKendall"))

Mann-Whitney test

The Mann-Whitney test is used for testing shift in the mean between two sub-samples defined from a time series.

Tool Info Mann-Whitney test
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IMannWhitneyTool
Input Items One or more time series
Output Items A data table

Tool Properties

  • SplitDate: Gets or sets the date that splits data in 2 samples

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Mann-Whitney test") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IMannWhitneyTool;
# Get the tool.
tool = app.Tools.CreateNew("Mann-Whitney test")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IMannWhitneyTool(app.Tools.CreateNew("Mann-Whitney test"))

Maximum value

The Maximum Value Tool get the maximum value of the input time series, and returns it as a scalar value. The tool will return one value per input item.

Tool Info Maximum value
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IMaximumValueTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Maximum value") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.MaximumValueTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = (double)outputItem.TabularData.Rows[0][1];

MIKECloudTsUploadTool

Tool for uploading time series to the DHI Cloud Platform Time Series storage.

Tool Info MIKECloudTsUploadTool
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.MikeCloudUpload
API Reference DHI.Solutions.TimeseriesManager.Tools.MikeCloudUploadTool.IMikeCloudUploadTool
Input Items One or more time series or one or more time series groups
Output Items No output items

Tool Properties

  • UploadStructure: Gets or sets the export directory structure
  • DestinationRootPath: Gets or sets the path in the MIKE Cloud Platform project to upload time series and time series groups to.
  • Overwrite: Gets or sets a value indicating whether existing time series should be overwritten. If False, existing time series will be skipped.
  • RegisterTimeSeries: Gets or sets a value indicating whether time series uploaded should be registered to a new folder in the time series manager
  • RegisterRootPath: Gets or sets the root folder where registered time series should be placed (support UploadStructure).
  • MikeCloudProvider: Gets or sets the MIKE Cloud provider to be used for uploading time series.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("MIKECloudTsUploadTool") as DHI.Solutions.TimeseriesManager.Tools.MikeCloudUploadTool.MikeCloudUploadTool;

// Set the tool properties and execute.
tool.MikeCloudProvider = timeSeriesDataProvider as DHI.Solutions.TimeseriesManager.TSMIKECloudProvider.TimeSeriesMIKECloudProvider;
tool.InputItems.Add(ts);
tool.DestinationRootPath = "/MyProject/MyTimeSeriesRep";
tool.Overwrite = false;
tool.RegisterTimeSeries = true;
tool.RegisterRootPath = "/TsGroup/RegisteredTs";
tool.UploadStructure = DHI.Solutions.TimeseriesManager.Tools.MikeCloudUploadTool.UploadStructureOptions.DatasetPerTimeSeries;
tool.Execute();

Minimum value

The Minimum Value Tool get the minimum value of the input time series, and returns it as a scalar value. The tool will return one value per input item.

Tool Info Minimum value
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IMinimumValueTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Maximum value") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.MaximumValueTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = (double)outputItem.TabularData.Rows[0][1];

Mode

The Model value tool calculates the mode of the specified input series. The Mode is the value that occurs the most frequently in a sample. The mode is not necessarily unique, since the same maximum frequency may be attained at different values. The most ambiguous case occurs in uniform distributions, wherein all values are equally likely, and for samples drawn from continuous distributions where all values tend to occur only once. Since the latter is a very common, the Mode tool has been extended such that the user can specify a tolerance within which two values can be considered equal. In the case where the tolerance is set to low when mode is calculated for samples drawn from continuous distribution, the number of mode values will approach the number of values in the sample. When this happens, the concept becomes useless. To indicate when this happens, the user may set a limit to the number of values the tool can return. If this value is exceeded, the tool returns a single double.NaN.

Tool Info Mode
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IModeValueTool
Input Items One or more time series
Output Items A data table

Tool Properties

  • Tolerance: Gets or sets the Tolerance. For samples drawn from discrete distributions, the tolerance should be set to zero. For samples drawn from continuous distributions the tolerance should be a positive number.
  • MaxNoOfModeValuesReturned: Gets or sets the Maximum number of mode values the tool may return. If this number is exceeded, the tool will return a single double.NaN.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Mode") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.ModeValueTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Tolerance = 0.1;
tool.MaxNoOfModeValuesReturned = 5;
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = (double)outputItem.TabularData.Rows[0][1];

Monthly Statistics

This tool calculates statistics for each specified month. This can be a single month or a range of months. For a timeseries containing several years, a calculation is made for each month in each year. In addition to the chosen statistic, it is possible to get monthly and yearly mean, maximum, and minimum. Note that these values are also based on the chosen time series.

Tool Info Monthly Statistics
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IMonthlyStatisticsTool
Input Items One or more time series
Output Items A data table

Tool Properties

  • Tool: Gets or sets the tool to use to calculate statistics. Only tools having scalars as output are supported
  • FirstMonth: Gets or sets the first month to calculate statistics.
  • LastMonth: Gets or sets the last month to calculate statistics.
  • YearlyAverage: Gets or sets a value indicating whether calculate yearly average statistics
  • YearlyMaximum: Gets or sets a value indicating whether calculate yearly maximum
  • YearlyMinimum: Gets or sets a value indicating whether calculate yearly minimum
  • MonthlyAverage: Gets or sets a value indicating whether calculate monthly average
  • MonthlyMaximum: Gets or sets a value indicating whether calculate monthly maximum
  • MonthlyMinimum: Gets or sets a value indicating whether calculate monthly minimum
  • StatisticsData: Gets or sets the calculate statistics data

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Monthly Statistics") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IMonthlyStatisticsTool;
# Get the tool.
tool = app.Tools.CreateNew("Monthly Statistics")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IMonthlyStatisticsTool(app.Tools.CreateNew("Monthly Statistics"))

Moving Average

The Moving average tool calculates the moving average for a number of input time series. If the tool is configured to interpolate across gaps in the input time series, the user can specify a maximum duration / missing value count across interpolation shall take place. If interpolation across gaps is not allowed, or if the gaps in the input series exceeds the criteria defined by the user, gaps will be transferred to the output series.

Tool Info Moving Average
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IMovingAverageTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • WindowPosition: Gets or sets a value indicating the window position.
  • InterpolateAcrossGaps: Gets or sets a value indicating whether the algorithm shall interpolate across gaps in the input series or not. If set to true, the algorithm will interpolate across gaps that are less than a specified duration/number. If set to false, gaps in the input series will result in gaps in the output series.
  • MaxAllowedGapDuration: Gets or sets a value indicating the no of missing values the algorithm shall interpolate across. (it has an effect when property InterpolateAcrossGaps is false).
  • MaxNumberOfMissingValuesPerGap: Gets or sets a value indicating the maximum duration a gap the algorithm shall interpolate across. (it has an effect when property InterpolateAcrossGaps is false).
  • TimeStepDay: Gets or sets the Day part of the averaging window
  • TimeStepHour: Gets or sets the Hour part of the averaging window
  • TimeStepMinute: Gets or sets the Minute part of the averaging window
  • TimeStepSecond: Gets or sets the Second part of the averaging window

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Moving Average") as DHI.Solutions.TimeseriesManager.Tools.Processing.IMovingAverageTool;
# Get the tool.
tool = app.Tools.CreateNew("Moving Average")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.Processing.IMovingAverageTool(app.Tools.CreateNew("Moving Average"))

Nearest neighbour resampling

The “NearestNeighbourResampling” tool is type of weather generator used to generate daily time series ensembles of weather variables based on historical time series. The tool analyses historical time series from one or more locations of different variable types and shuffled the historical record to produce ensembles of time series with consistent spatiotemporal statistics.

Tool Info Nearest neighbour resampling
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.NearestNeighbourResampling
API Reference DHI.Solutions.TimeseriesManager.Tools.NearestNeighbourResampling.INearestNeighbourResampling
Input Items One or more time series
Output Items A time series

Tool Properties

  • NumberOfEnsembles: Gets or sets the Day part of the resampling time span
  • StartDateYear: Gets or sets the Month part of the resampling time span
  • NumberOfYears: Gets or sets the Day part of the resampling time span
  • DayWindow: Gets or sets parameter _dayWindow. Where _dayWindow is the number of days within the search window. Default is 61 (same as the paper).
  • K: Gets or sets parameter K. Where K is the number of nearest neighbors from which to select.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Nearest neighbour resampling") as DHI.Solutions.TimeseriesManager.Tools.NearestNeighbourResampling.INearestNeighbourResampling;
# Get the tool.
tool = app.Tools.CreateNew("Nearest neighbour resampling")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.NearestNeighbourResampling.INearestNeighbourResampling(app.Tools.CreateNew("Nearest neighbour resampling"))

Partial Duration Series

This tool is used to extract extreme events from a time series.

Tool Info Partial Duration Series
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ExtremeValues
API Reference DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.IPartialDurationSeriesTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • PDSType: Gets or sets type of PDS analysis
  • Threshold: Gets or sets threshold level
  • AvgExceed: Gets or sets average annual number of exceedances
  • RecordLength: Gets or sets record Length
  • UseInterEventTime: Gets or sets a value indicating whether use inter event time
  • InterEventTime: Gets or sets inter event time (in hours)
  • UseInterEventLevel: Gets or sets a value indicating whether use inter event level
  • InterEventLevel: Gets or sets inter event level

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Partial Duration Series") as DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.IPartialDurationSeriesTool;
# Get the tool.
tool = app.Tools.CreateNew("Partial Duration Series")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.IPartialDurationSeriesTool(app.Tools.CreateNew("Partial Duration Series"))

Partial duration series (seasonal)

This tool is used to extract extreme events from a time series on a seasonal basis.

Tool Info Partial duration series (seasonal)
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ExtremeValues
API Reference DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.ISeasonalPartialDurationSeriesTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • PDSType: Gets or sets type of PDS analysis
  • Threshold: Gets or sets threshold level
  • AvgExceed: Gets or sets average annual number of exceedances
  • RecordLength: Gets or sets Record Length
  • UseInterEventTime: Gets or sets a value indicating whether use inter event time
  • InterEventTime: Gets or sets inter event time (in hours)
  • UseInterEventLevel: Gets or sets a value indicating whether use inter event level
  • InterEventLevel: Gets or sets inter event level
  • SeasonStartDay: Gets or sets start day of season
  • SeasonStartMonth: Gets or sets start month of season
  • SeasonEndDay: Gets or sets end day of season
  • SeasonEndMonth: Gets or sets end month of season

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Partial duration series (seasonal)") as DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.ISeasonalPartialDurationSeriesTool;
# Get the tool.
tool = app.Tools.CreateNew("Partial duration series (seasonal)")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.ExtremeValues.ISeasonalPartialDurationSeriesTool(app.Tools.CreateNew("Partial duration series (seasonal)"))

Period Statistics

This tool calculates statistics for a specified period (daily, monthly etc.).

Tool Info Period Statistics
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.PeriodStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.PeriodStatisticsTool.IPeriodStatisticsTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • Period: Gets or sets the period to calculate statistics
  • Tool: Gets or sets the tool to use to calculate statistics. Only tools having scalars as output are supported
  • ItemValueType: Gets or sets the target Item Value Type.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Period Statistics") as DHI.Solutions.TimeseriesManager.Tools.PeriodStatisticsTool.IPeriodStatisticsTool;
# Get the tool.
tool = app.Tools.CreateNew("Period Statistics")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.PeriodStatisticsTool.IPeriodStatisticsTool(app.Tools.CreateNew("Period Statistics"))

Quality flag filter

The quality flag filter tool can be used to process the flagged values of the input time series.

Tool Info Quality flag filter
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IQualityFlagFilterTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • FlagOption: Gets or sets a value flag option. It can be "Skip" or "Substitute"
  • QualityFlag: Gets or sets a value Quality Flag. Comma separated string contains integers
  • ValueToInsert: Gets or sets the value to insert.
  • ProcessCopy: Gets or sets a value indicating whether process the input items' copy.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Quality flag filter") as DHI.Solutions.TimeseriesManager.Tools.Processing.IQualityFlagFilterTool;
# Get the tool.
tool = app.Tools.CreateNew("Quality flag filter")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.Processing.IQualityFlagFilterTool(app.Tools.CreateNew("Quality flag filter"))

Quantile estimates

Quantile Estimation Tool.

Tool Info Quantile estimates
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.QuantileEstimates
API Reference DHI.Solutions.TimeseriesManager.Tools.QuantileEstimateTool.IQuantileEstimateTool
Input Items One or more estimation of distribution parameters
Output Items A data table

Tool Properties

  • ReturnPeriod: Gets or sets definition of return periods

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Quantile estimates") as DHI.Solutions.TimeseriesManager.Tools.QuantileEstimateTool.IQuantileEstimateTool;
# Get the tool.
tool = app.Tools.CreateNew("Quantile estimates")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.QuantileEstimateTool.IQuantileEstimateTool(app.Tools.CreateNew("Quantile estimates"))

Quantile Perturbation

The Quantile Perturbation tool downscales one or multiple climate parameter time series (precipitation, temperature, evaporation or potential evapotranspiration) using change factor quantile mapping (see Sunyer et. al. (2015) for a more detailed description). The change factor quantile mapping approach derives monthly, empirical cumulative distribution functions(CDF) for control and scenario climate data. Observations are projected, bias corrected and downscaled by mapping the probability of the observed value, determined from the CDF of the control period, to the scenario probability and corresponding value. This approach is also referred to as empirical quantile mapping.The graph under the “Quantile Quantile” tool illustrates the principle of quantile mapping. While the central part of the CDF is typically well described empirically, the extreme tail of the distribution is not.If the data in the observed record and the control data allow, i. e.there are at least 20 data points above the 95th percentile, then the tail of the distribution is parameterized using a Gamma/Pearson Type 3 distribution. This parametrization is also used to extrapolate projected values falling outside the range of the control data. Climate data is given in NetCDF format for the control and scenario period.If the periods span across several NetCDF files, then a CSV file can be used as input that lists the files in chronological order.

Tool Info Quantile Perturbation
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ClimateQuantilePerturbation
API Reference DHI.Solutions.TimeseriesManager.UI.Tools.QuantilePerturbationDownscalingTool.IQuantilePerturbationDownscalingTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • MinimumRainfallThreshold: Gets or sets a value indicating the minimum threshold for average monthly rainfall in mm/mth, below which the value is not considered in the calculation for quantile perturbation for the month
  • OutputSuffix: Gets or sets the suffix to be added to the name of the input dataseries when naming output dataseries
  • ControlDataFilePath: Gets or sets the path for the control data NetCDF file
  • ScenarioDataFilePath: Gets or sets the path for the scenario data NetCDF file
  • KeepTimestepAsObservedData: Gets or sets a value indicating whether to keep the future timesteps the same as observed data. If KeepTimestepAsObservedData is set to true, the future timesteps will be the same as the observed timesteps. Else, it will be the same as the scenario timesteps

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Quantile Perturbation") as DHI.Solutions.TimeseriesManager.UI.Tools.QuantilePerturbationDownscalingTool.IQuantilePerturbationDownscalingTool;
# Get the tool.
tool = app.Tools.CreateNew("Quantile Perturbation")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.UI.Tools.QuantilePerturbationDownscalingTool.IQuantilePerturbationDownscalingTool(app.Tools.CreateNew("Quantile Perturbation"))

Quantile Quantile

The Quantile Quantile tool downscales one or multiple climate parameter time series (precipitation, temperature, evaporation or potential evapotranspiration) using bias correction quantile mapping (see Sunyer et. al. (2015) for a more detailed description). The bias correction quantile mapping approach derives monthly, empirical cumulative distribution functions(CDF) for observations and control climate data. Scenario climate data are bias corrected and downscaled by mapping the probability of the scenario value, determined from the CDF of the control period, to the observed probability and corresponding value. This approach is also referred to as empirical quantile mapping.The graph below illustrates the principle of quantile mapping.

Tool Info Quantile Quantile
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ClimateQuantileQuantile
API Reference DHI.Solutions.TimeseriesManager.UI.Tools.QuantileQuantileDownscalingTool.IQuantileQuantileDownscalingTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • MinimumRainfallThreshold: Gets or sets a value indicating the minimum threshold for average monthly rainfall in mm/mth, below which the value is not considered in the calculation for quantile quantile for the month
  • OutputSuffix: Gets or sets the suffix to be added to the name of the input dataseries when naming output dataseries
  • ControlDataFilePath: Gets or sets the path for the control data NetCDF file
  • ScenarioDataFilePath: Gets or sets the path for the scenario data NetCDF file

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Quantile Quantile") as DHI.Solutions.TimeseriesManager.UI.Tools.QuantileQuantileDownscalingTool.IQuantileQuantileDownscalingTool;
# Get the tool.
tool = app.Tools.CreateNew("Quantile Quantile")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.UI.Tools.QuantileQuantileDownscalingTool.IQuantileQuantileDownscalingTool(app.Tools.CreateNew("Quantile Quantile"))

Rate of change

The Rate of change tool calculates the slope (rate of change) of a input time series.

Tool Info Rate of change
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IRateChangeTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • Suffix: Gets or sets a value of the name suffix for output time series.
  • Unit: Gets or sets a value of time unit. Change (Per_second, Per_minute, Per_hour, Per_day)

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Rate of change") as DHI.Solutions.TimeseriesManager.Tools.Processing.RateChangeTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.Unit = DHI.Solutions.TimeseriesManager.Tools.Processing.Units.Per_hour;
tool.Suffix = "hour";
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Regression statistics

This tool performs polynomial regression between two time series.

Tool Info Regression statistics
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.PolynomialRegression
API Reference DHI.Solutions.TimeseriesManager.Tools.EOAnalysis.IPolynomialRegression
Input Items Two time series
Output Items An X-Y data series

Tool Properties

  • ToolMode: Gets or sets the tool mode. The tool mode can be either Analyze or Predict. In Analyze mode, the tool will calculate the regression line, and in Predict mode, the tool will use the specified parameters to predict the empty values in the dependent series.
  • a0: Gets or sets the Intercept in the regression line. In Analyze mode, this value will be calculated. In Predict mode, this value will be used to predict the empty values in the dependent series.
  • a1: Gets or sets the first-order parameter in the regression line. In Analyze mode, this value will be calculated. In Predict mode, this value will be used to predict the empty values in the dependent series.
  • a2: Gets or sets the second-order parameter in the regression line. In Analyze mode, this value will be calculated. In Predict mode, this value will be used to predict the empty values in the dependent series.
  • a3: Gets or sets the third-order parameter in the regression line. In Analyze mode, this value will be calculated. In Predict mode, this value will be used to predict the empty values in the dependent series.
  • a4: Gets or sets the fourth-order parameter in the regression line. In Analyze mode, this value will be calculated. In Predict mode, this value will be used to predict the empty values in the dependent series.
  • a5: Gets or sets the fifth-order parameter in the regression line. In Analyze mode, this value will be calculated. In Predict mode, this value will be used to predict the empty values in the dependent series.
  • R2: Gets the R2 of the regression line. The R2 value indicates the ratio of variation that is explained by the model to the total variation in the model. Its value is always between 0 and 1, where 0 indicates the model explains nothing, and 1 means the model explains the data perfectly.
  • SumOfSquares: Gets the Sum of squares of the residuals of the model.
  • StandardError: Gets the Standard error of the model. The standard error is the root-mean-square of the residuals.
  • AkaikeCriterion: Gets the Akaike criterion of the model. The Akaike information criterion is a measure of the relative goodness of fit of a statistical model. It can be said to describe the tradeoff between bias and variance in model construction, or loosely speaking between accuracy and complexity of the model.
  • BayesianCriterion: Gets the Bayesian criterion for the model. The Bayesian criterion is similar to the Akaike criterion, but generally has a higher penalty term for introduction of additional parameters in a model.
  • Degree: Gets the degree of the regression polynomial (1 - 5). Notice that when Degree is set to one, linear regression will be used.
  • IndependentVariable: Gets or sets the independent variable (time series). The independent variable shall be one of the two input time series.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Regression statistics") as DHI.Solutions.TimeseriesManager.Tools.EOAnalysis.IPolynomialRegression;
# Get the tool.
tool = app.Tools.CreateNew("Regression statistics")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.EOAnalysis.IPolynomialRegression(app.Tools.CreateNew("Regression statistics"))

Replace value tool

The Replace values tool can be used to replace any given value (“Replace value”) or range of values in a time series by a new value (“Replace with”) (e.g. the user can specify that all values = 5 shall be replaced with the value 2.5).

Tool Info Replace value tool
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IReplaceValuesTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • ReplaceValueMethod: Gets or sets the ReplaceValueMethod. ReplaceValueMethod determines what shall replace the specified ReplaceValue.
  • ReplaceValue: Gets or sets the ReplaceValue. The ReplaceValue is the value that will be replaced according to the selected ReplaceValueOption.
  • ReplaceByValue: Gets or sets the ReplaceByValue. If ReplaceValueToolOption is With_constant, the ReplaceByValue will be inserted instead of the ReplaceValue.
  • RangeMax: Gets or sets RangeMax. If ReplaceValueMethod = Replace_range_with_constant, RangeMax defines the max value of the range.
  • RangeMin: Gets or sets RangeMin. If ReplaceValueMethod = Replace_range_with_constant, RangeMax defines the minimum value of the range.
  • MaxRateOfChange: Gets or sets the MaxRateOfChange. If ReplaceValueMethod = Limit_rate_of_change, the time series will be corrected such that the specified MaxRateOfChange is never exceeded.
  • RateOfChangeUnit: Gets or sets the RateOfChangeUnit. The rate of change unit defines the unit of the specified max rate of change.
  • RateOfChangeOption: Gets or sets how values outside the allowed rate of change should be set.
  • ReplaceOption: Gets or sets the ReplaceOption. The Replace option determines of all or only the first occurrence of the ReplaceValue shall be replaced.
  • MaxGapUnit: Gets or sets the MaxGapUnit. The max gap unit defines the unit of the specified max gap.
  • MaxGap: Gets or sets the MaxGap. The max gap defines the maximum gap allowed in a time series.
  • PeriodOption: Gets or sets the period option of the tool. The period option determines if the tool shall be applied on the entire time series, or on a sub-period.
  • ProcessOption: Gets or sets the process option. The process option determines if the tool shall process the input series or a copy of the input series.
  • StartDate: Gets or sets the start date from where the values should be replaced.
  • EndDate: Gets or sets the end date to where the values should be replaced.
  • ReplaceByValueForExceededRate: Gets or sets value to be replace with for ReplaceOption Limit_rate_of_change and With_constant.
  • RangeOption: Gets or sets the replace option. The range option determines if the values inside, or outside the specified range shall be replaced. Only relevant when ReplaceValueMethod = Replace_range_with_constant

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Replace value tool") as DHI.Solutions.TimeseriesManager.Tools.Processing.ReplaceValuesTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.ReplaceValueMethod = DHI.Solutions.TimeseriesManager.Tools.Processing.ReplaceValueMethod.With_constant;
tool.ReplaceOption = DHI.Solutions.TimeseriesManager.Tools.Processing.ReplaceOption.Replace_all_hits;
tool.ReplaceValue = 1;
tool.ReplaceByValue = 100;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Resample

The resample tool is used for changing the time step of a time series into a user specified time step. It is possible to resample into larger and smaller time steps. The tool will not update the the input time series directly, but will create clones of the input time series, to by found in the tools output items after resampling. Set the time step for year, month, day, hour, minute, second. Note that the tool is by default using a 1 day interval (TimeStepDay=1).

Tool Info Resample
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IResampleTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • TimeStepYear: Gets or sets the Day part of the resampling time span
  • TimeStepMonth: Gets or sets the Month part of the resampling time span
  • TimeStepDay: Gets or sets the Day part of the resampling time span. The default value is 1 day.
  • TimeStepHour: Gets or sets the Hour part of the resampling time span.
  • TimeStepMinute: Gets or sets the Minute part of the resampling time span.
  • TimeStepSecond: Gets or sets the second part of the resampling time span.
  • InterpolateAcrossGaps: Gets or sets a value indicating whether the algorithm shall interpolate across gaps in the input series or not. If set to true, the algorithm will interpolate across gaps that are less than a specified duration/number. If set to false, gaps in the input series will result in gaps in the output series.
  • MaxAllowedGapDuration: Gets or sets a value indicating the no of missing values the algorithm shall interpolate across. (it has an effect when property InterpolateAcrossGaps is false).
  • MaxNumberOfMissingValuesPerGap: Gets or sets a value indicating the maximum duration a gap the algorithm shall interpolate across. (it has an effect when property InterpolateAcrossGaps is false).
  • StartDateOffset: Gets or sets the offset used for the resampling
  • StartTimeOffset: Gets or sets the start time used in conjunction with the start Start Date Offset
  • StartTime: Gets or sets the start date time used in conjunction with the Start Date Offset = SpecificDateTime

Code Sample

// Get the tool assuming that the tool is already loaded.
var tool = application.Tools.CreateNew("Resample") as DHI.Solutions.TimeseriesManager.Tools.Processing.ResampleTool;

// Add a time series to the input items (the tool support 1 or more input time series).
tool.InputItems.Add(ts);

// Default of TimeStepDay=1
tool.TimeStepDay = 0;
tool.TimeStepMinute = 30;

// Execute the tool
tool.Execute();

// Get the output of the tool.
var resampledTs = tool.OutputItems[0];

Residual mass

The Residual mass is calculated by first converting the input series to value type Step_Accumulated, and then:

Res_n = Xn - Avg + Xn-1

where Res_n is the residual mass, and X are the step accumulated values. The Item Type of the output will be Accumulated. The Residual mass tool uses the Convert value tool.

Tool Info Residual mass
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IResidualMassTool
Input Items One or more time series
Output Items A time series

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Residual mass") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IResidualMassTool;
# Get the tool.
tool = app.Tools.CreateNew("Residual mass")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IResidualMassTool(app.Tools.CreateNew("Residual mass"))

RunTest

RunTestTool - General non-parametric test for testing independence and homogeneity of a time series.

Tool Info RunTest
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IRunTestTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("RunTest") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IRunTestTool;
# Get the tool.
tool = app.Tools.CreateNew("RunTest")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IRunTestTool(app.Tools.CreateNew("RunTest"))

SelectTsTool

Tool for selecting time series in one or more time series groups.

Tool Info SelectTsTool
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.ISelectTsTool
Input Items One or more time series groups
Output Items A time series

Tool Properties

  • ValueType: Gets or sets the Item Value Type (All, Instantaneous, Accumulated, Step_Accumulated, Mean_Step_Accumulated or Reverse_Mean_Step_Accumulated).
  • TimeseriesName: Gets or sets the value of the timeseries name pattern, e.g. MyTs, Ts* (any time series starting with Ts), Ts? (matching single character).

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("SelectTsTool") as DHI.Solutions.TimeseriesManager.Tools.Processing.SelectTsTool;

// Set the tool properties and execute.
tool.InputItems.Add(tsGroup);
tool.ValueType = "All";
tool.TimeseriesName = "t*";
tool.Execute();

// Output items contains a list of time series satisfying the name pattern.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Standard deviation

Standard Deviation tool calculates the standard deviation of a time series, or XY Series. The tool handles multiple input items, and returns a single value for each input item. If provided with an empty time series, double.NaN is returned.

Tool Info Standard deviation
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.IStandardDeviationTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Standard deviation") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.StdDevTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = (double)outputItem.TabularData.Rows[0][1];

Sum

This tool calculates the sum of all the values in a timeseries.

Tool Info Sum
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.BasicStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.ISumTool
Input Items One or more time series
Output Items A data table

Tool Properties

The tool has no properties.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Sum") as DHI.Solutions.TimeseriesManager.Tools.BasicStatistics.SumTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.Execute();

// Get the output of the tool.
var outputItem = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var result = (double)outputItem.TabularData.Rows[0][1];

Synchronize

The Synchronize tool is used to resample a set of time series into a common time axis. The new common time axis is defined by combining the axes of all input time series. One synchronized time series will be produced for each time series.

Tool Info Synchronize
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.ISynchronizeTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • InterpolateAcrossGaps: Gets or sets a value indicating whether the algorithm shall interpolate across gaps in the input series or not. If set to true, the algorithm will interpolate across gaps that are less than a specified duration/number. If set to false, gaps in the input series will result in gaps in the output series.
  • MaxAllowedGapDuration: Gets or sets a value indicating the no of missing values the algorithm shall interpolate across. (it has an effect when property InterpolateAcrossGaps is false).
  • MaxNumberOfMissingValuesPerGap: Gets or sets a value indicating the maximum duration a gap the algorithm shall interpolate across. (it has an effect when property InterpolateAcrossGaps is false).
  • AllowTimeStepMerging: Gets or sets a value indicating whether Time step merging is allowed or not.
  • ConcurrencyTolerance: Gets or sets a value indicating the minimum concurrency time step. The adjacent time steps which are separated by less than this value they will be merged into a single time step, it has an effect when property AllowTimeStepMerging is true.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Synchronize") as DHI.Solutions.TimeseriesManager.Tools.Processing.SynchronizeTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds1_in);
tool.InputItems.Add(ds2_in);
tool.InterpolateAcrossGaps = true;
tool.MaxAllowedGapDuration = TimeSpan.FromMinutes(10);
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Time series query

QueryToolTool class

Tool Info Time series query
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Query
API Reference DHI.Solutions.TimeseriesManager.Tools.QueryTool.QueryTool
Input Items No input items required
Output Items No output items

Tool Properties

The tool has no properties.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Time series query") as DHI.Solutions.TimeseriesManager.Tools.QueryTool.QueryTool;
# Get the tool.
tool = app.Tools.CreateNew("Time series query")

Time Shift

Tool to shift X or Y values

Tool Info Time Shift
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IShiftAndLagTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • LagXDateTime: Gets or sets a value which shifts all values of X by a specified value. This property with type timespan is used when the XValue type is date time.
  • LagXDouble: Gets or sets a value which shifts all values of X by a specified value. This property with type double is used when the XValue type is scalar.
  • ShiftY: Gets or sets a value which shifts all values of Y by a specified value.
  • ReplaceValues: Gets or sets a value indicating whether the original dataseries has to be replaced or a new cloned dataseries has to be sent as output.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Time Shift") as DHI.Solutions.TimeseriesManager.Tools.Processing.ShiftAndLagTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.ShiftY = 10;
tool.LagXDateTime = new TimeSpan(0, 2, 0);
tool.ReplaceValues = false;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Timeseries Calculator

Tool for performing raster math on one or more input rasters.

Tool Info Timeseries Calculator
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.ITimeseriesCalculatorTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • Formula: Gets or sets the formula to be used for calculating rasters The formula syntax is based on SpreadsheetGear (which itself is based on Microsoft Excel). Instead of cell references, however, formulas are to be entered using timeseries names in brackets. (e.g. "[mytimeseries]"). The link between the timeseries names and the timeseries rasters are to be mapped in the Mapping property.
  • NameMapping: Gets or sets the mapping of names used in the formula to the input rasters.

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Timeseries Calculator") as DHI.Solutions.TimeseriesManager.Tools.Processing.ITimeseriesCalculatorTool;
# Get the tool.
tool = app.Tools.CreateNew("Timeseries Calculator")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.Processing.ITimeseriesCalculatorTool(app.Tools.CreateNew("Timeseries Calculator"))

Timeseries Query

The time series query tool retrieves a set of data series based on a query specified by the user.

Tool Info Timeseries Query
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.TimeseriesQuery
API Reference DHI.Solutions.TimeseriesManager.Tools.TimeseriesQueryTool.ITimeseriesQueryTool
Input Items No input items required
Output Items A time series

Tool Properties

  • Queries:
  • Query:

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Timeseries Query") as DHI.Solutions.TimeseriesManager.Tools.TimeseriesQueryTool.ITimeseriesQueryTool;
# Get the tool.
tool = app.Tools.CreateNew("Timeseries Query")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.TimeseriesQueryTool.ITimeseriesQueryTool(app.Tools.CreateNew("Timeseries Query"))

To chart

Class for ToChart tool.

Tool Info To chart
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ToChart
API Reference DHI.Solutions.TimeseriesManager.UI.Tools.ToChart.IToChartTool
Input Items One or more time series or one or more time series
Output Items No output items

Tool Properties

  • ChartDisplayOptions: Gets or sets the DisplayOption for the chart New Chart New or active chart
  • ChartAreaOptions: Gets or sets the DisplayOption for the chart area New Chart Area New or First Compliant Chart Area
  • ChartOutputName: Gets or sets the name of chart if Specified Chart option is selected for ChartDisplayOptions

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("To chart") as DHI.Solutions.TimeseriesManager.UI.Tools.ToChart.IToChartTool;
# Get the tool.
tool = app.Tools.CreateNew("To chart")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.UI.Tools.ToChart.IToChartTool(app.Tools.CreateNew("To chart"))

To database

This tool takes one or more timeseries and saves it directly to the database.

Tool Info To database
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ToDatabase
API Reference DHI.Solutions.TimeseriesManager.Tools.ToDatabaseTool.IToDatabaseTool
Input Items One or more time series
Output Items No output items

Tool Properties

  • Group: Gets or sets the group in which to save the timeseries
  • NamePostFix: Gets or sets the postfix string to be added to the timeseries name.e.g. TimeseriesA Postfix
  • TimeseriesName: Gets or sets the name to be added to the timeseries, e.g. MyTs, MyTs (1), MyTs(2) etc
  • DuplicateNameOption: Gets or sets the option to be chosen when a timeseres with the same name is already present in the group

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("To database") as DHI.Solutions.TimeseriesManager.Tools.ToDatabaseTool.IToDatabaseTool;
# Get the tool.
tool = app.Tools.CreateNew("To database")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.ToDatabaseTool.IToDatabaseTool(app.Tools.CreateNew("To database"))

To feature class

This tool takes one or more timeseries and saves it directly to the database.

Tool Info To feature class
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ToFeatureClass
API Reference DHI.Solutions.TimeseriesManager.Tools.ToFeatureClass.IToFeatureClassTool
Input Items One or more time series
Output Items A feature class

Tool Properties

  • ColumnName: Gets or sets the name of the column to be added to feature class(es) to contain scalar values
  • Tool: Gets or sets the tool to use to calculate scalars. Only tools having scalars as output are supported
  • OutputOption: Gets or sets the output option for the tool
  • FeatureClass: Gets or sets the value of selected feature class

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("To feature class") as DHI.Solutions.TimeseriesManager.Tools.ToFeatureClass.IToFeatureClassTool;
# Get the tool.
tool = app.Tools.CreateNew("To feature class")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.ToFeatureClass.IToFeatureClassTool(app.Tools.CreateNew("To feature class"))

To file

The “To file” tool is used to export one or more time series, ensemble and/or group to files on the disk.

Tool Info To file
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.TimeseriesExport
API Reference DHI.Solutions.TimeseriesManager.Tools.TimeseriesExportTool.ITimeseriesExportTool
Input Items One or more time series or one or more time series groups
Output Items No output items

Tool Properties

  • ExportDirectory: Gets or sets the export directory
  • ExportFormat: Gets or sets the export format
  • DirectoryStructure: Gets or sets the export directory structure
  • ExportFlags: Gets or sets a value indicating whether the flags should be export or not
  • Delimiter: Gets or sets the delimiter format.
  • DateTimeFormat: Gts or sets the date time format.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("To file") as DHI.Solutions.TimeseriesManager.Tools.TimeseriesExportTool.TimeseriesExportTool;

// Set the tool properties and execute.
tool.InputItems.Add(ds_in);
tool.ExportFormat = DHI.Solutions.TimeseriesManager.Tools.TimeseriesExportTool.ExportFormatOptions.dfs0;
tool.ExportDirectory = @"c:\Temp";
tool.Execute();

To timeseries table

The To time series table tool opens the input series in a time series table.

Tool Info To timeseries table
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ToTimeseriesTable
API Reference DHI.Solutions.TimeseriesManager.UI.Tools.ToTimeseriesTable.ToTimeseriesTable
Input Items One or more time series
Output Items A time series table

Tool Properties

  • TableDisplayOptions:
  • TableOutputName:

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("To timeseries table") as DHI.Solutions.TimeseriesManager.UI.Tools.ToTimeseriesTable.ToTimeseriesTable;
# Get the tool.
tool = app.Tools.CreateNew("To timeseries table")

To XY table

The ToXYTable tool opens the input XY series to an XY Table.

Tool Info To XY table
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.ToTimeseriesTable
API Reference DHI.Solutions.TimeseriesManager.UI.Tools.ToTimeseriesTable.ToXYTable
Input Items No input items required
Output Items No output items

Tool Properties

  • TableDisplayOptions:
  • TableOutputName:

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("To XY table") as DHI.Solutions.TimeseriesManager.UI.Tools.ToTimeseriesTable.ToXYTable;
# Get the tool.
tool = app.Tools.CreateNew("To XY table")

Unit conversion

The Unit conversion tool converts a time series into a new variable/unit. The operation is performed on a clone of the input item, and hence no changes are made to the input items. If multiple input items are selected, they will all be converted to the same variable/unit. When the target variable has been set, the target unit has to be set to one of the valid units for the selected variable.

Tool Info Unit conversion
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IUnitConversionTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • TargetUnit: Gets or sets the unit that the input items shall be converted to. The unit shall be a valid unit for the selected target variable.
  • VariableType: Gets or sets the common variable type for the input items.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Unit conversion") as DHI.Solutions.TimeseriesManager.Tools.Processing.UnitConversionTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.TargetUnit = "/d";
tool.VariableType = "Rainfall";
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Value type conversion

The Convert To Value tool allows the user to convert the value type of a Time Series between the five possible value types: Instantaneous, Mean Step Accumulated, Reverse Mean Step Accumulated and Step Accumulated. When a series is converted from either I, MSA, RMSA to either A or SA, the tool attempts to integrate the unit as well (e.g. m3/s -> m3). When going from A, SA to I, MSA or RMSA the tool will attempt to differentiate the unit as well (m3 -> m3/s). If this conversion is not successful, the unit will be set to undefined. ///

Tool Info Value type conversion
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.Processing
API Reference DHI.Solutions.TimeseriesManager.Tools.Processing.IConvertToValueTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • ItemValueType: Gets or sets the target Item Value Type.

Code Sample

// Get the tool
var tool = application.Tools.CreateNew("Value type conversion") as DHI.Solutions.TimeseriesManager.Tools.Processing.ConvertToValueTool;

// Set the tool properties and execute.
tool.InputItems.Add(ts_in);
tool.ItemValueType = DHI.Solutions.Generic.DataSeriesValueType.Instantaneous;
tool.Execute();

// Get the output of the tool.
var ds_out = tool.OutputItems[0] as DHI.Solutions.Generic.IDataSeries;

Within Year Statistic

The Within-year statistics tool calculates the specified statics for a relative time period (Analysis time step). The output is a time series that covers a single year with the statistics calculated on the specified time step. The tool can be used to calculate e.g. the average flow for Jan, feb, ... Dec based on a time series that spans several years. The input series must cover at least one full year.

Tool Info Within Year Statistic
NuGet Package DHI.MikeOperations.TimeseriesManager.Tools.AdvancedStatistics
API Reference DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IWithinYearStatsTool
Input Items One or more time series
Output Items A time series

Tool Properties

  • PeriodUnit: Gets or sets period unit
  • PeriodLenght: Gets or sets period length
  • StartDate: Gets or sets start date
  • StatisticalMethod: Gets or sets statistical method
  • Surffix: Gets or sets the value of suffix
  • Quantile: Gets or sets the value of quantile
  • LowerBoundary: Gets or sets the value of lower boundary
  • UpperBoundary: Gets or sets the value of upper boundary
  • UseBoundary: Gets or sets the value of use boundary

Code Sample

// Get the tool.
var tool = application.Tools.CreateNew("Within Year Statistic") as DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IWithinYearStatsTool;
# Get the tool.
tool = app.Tools.CreateNew("Within Year Statistic")
# Get the tool.
tool = DHI.Solutions.TimeseriesManager.Tools.AdvancedStatistics.IWithinYearStatsTool(app.Tools.CreateNew("Within Year Statistic"))