Click or drag to resize

IDfsTemporalAxis Interface

Interface specifying the temporal axis of the file.

Use the TimeAxisType to get the exact type. Depending on this type, the temporal axis can be cast to one of: IDfsNonEqCalendarAxisIDfsEqCalendarAxisIDfsNonEqTimeAxisIDfsEqTimeAxis

If the time axis in the file is Undefined indicates an illegally written file, and should not happen. An exception will/should be thrown when reading the file.

The unit of the time axis can vary. To convert between a time value in the unit of the time axis and a time value in seconds, there is a number of convenience static extension methods in the DfsExtensions class, as e.g. the method ToSecondsFactor(IDfsTemporalAxis) will return a factor to use when converting a value from the specified unit to seconds.

Namespace:  DHI.Generic.MikeZero.DFS
Assembly:  DHI.Generic.MIKEZero.DFS (in DHI.Generic.MIKEZero.DFS.dll) Version: 19.0.0.0 (11.1.1.1111)
Syntax
public interface IDfsTemporalAxis

The IDfsTemporalAxis type exposes the following members.

Properties
  NameDescription
Public propertyFirstTimeStepIndex
Index of first time step. Currently not used, always zero.
Public propertyNumberOfTimeSteps
Number of time steps in the file
Public propertyStartTimeOffset
Start time in TimeUnit for the first time step in the file.

This can only be set for the equidistant type axes.

For the non-equidistant type time axis this is for information, returning the time of the first time step relative to the start time.

Public propertyTimeAxisType
Time axis type. Based on this, the class must implement one of the sub-types.
Public propertyTimeUnit
Unit of time axis.
Top
Extension Methods
  NameDescription
Public Extension MethodGetDateTimes
Return an array of DateTimes which are the times for each timestep.

For non-equidistant axis, only the first and the last time are populated correctly. The rest are populated with MinValue.

For a complete list of DateTimes, also for non-equidistant axis, use the GetDateTimes(IDfsFile, DateTime, Boolean).

For time type axis, first time is StartTimeOffsetInSeconds(IDfsTemporalAxis) after MinValue.

(Defined by DfsExtensions.)
Public Extension MethodGetRelativeSeconds
Return an array of doubles which are the the number of seconds since the start time for each timestep.

For non-equidistant axis, only the first and the last time are populated correctly. The rest are populated with -1

For time type axis, first time is StartTimeOffsetInSeconds(IDfsTemporalAxis)

(Defined by DfsExtensions.)
Public Extension MethodIsCalendar
Returns true if the temporal axis is a calendar axis
(Defined by DfsExtensions.)
Public Extension MethodIsEquidistant
Returns true if the temporal axis is equidistant.
(Defined by DfsExtensions.)
Public Extension MethodSetStartDateTime
Set the start time of a calendar axis.

Will throw an exception in case of a time axis

(Defined by DfsExtensions.)
Public Extension MethodSetTimeStepInSeconds
Sets the time step in seconds for an equidistant temporal axis.

If the time axis is not equidistant, an exception is thrown

If the time axis unit can not be converted to seconds, an exception is thrown

(Defined by DfsExtensions.)
Public Extension MethodStartDateTime
Get the start time of a calendar axis.

Will throw an exception in case of a time axis

(Defined by DfsExtensions.)
Public Extension MethodStartTime
Get the start time of a calendar axis.

Will throw an exception in case of a time axis

(Defined by DfsExtensions.)
Public Extension MethodStartTimeOffsetInSeconds
Return the start time offset in seconds
(Defined by DfsExtensions.)
Public Extension MethodTimeSpan
Time span of all data in file, in unit described by TimeUnit.

The StartTimeOffset is not included in the span. The span starts at the time of the StartTimeOffset

Convenience method that returns/calculates the time span consistently for all types of time axes,

(Defined by DfsExtensions.)
Public Extension MethodTimeSpanAsTimeSpan
Calculate the time span as a System.TimeSpan
(Defined by DfsExtensions.)
Public Extension MethodTimeSpanInSeconds
Calculate the time span in seconds
(Defined by DfsExtensions.)
Public Extension MethodTimeStepInSeconds
Calculate the time step in seconds for an equidistant temporal axis.

If the time axis is not equidistant, zero is returned.

If the time axis unit can not be converted to seconds, an exception is thrown

(Defined by DfsExtensions.)
Public Extension MethodToDateTime
Returns the relativeTime as a DateTime. The time axis must be a calendar type axis.
(Defined by DfsExtensions.)
Public Extension MethodToRelativeSeconds
Returns the dateTime in relative seconds from the start time of the time axis, in the unit used by the file. The time axis must be a calendar type axis.

Note that for the equidistant axes, the first time step may be offset (see StartTimeOffset), however the time returned here is relative to the start time and not the first time step. This is matching the time returned by the read methods (Time).

(Defined by DfsExtensions.)
Public Extension MethodToRelativeTime(Double)Overloaded.
Converts a time value in seconds to a time value in the unit of the temporal axis.
(Defined by DfsExtensions.)
Public Extension MethodToRelativeTime(DateTime)Overloaded.
Returns the dateTime in relative time from the start time of the time axis, in the unit used by the file. The time axis must be a calendar type axis.

Note that for the equidistant axes, the first time step may be offset (see StartTimeOffset), however the time returned here is relative to the start time and not the first time step. This is matching the time returned by the read methods (Time).

(Defined by DfsExtensions.)
Public Extension MethodToSeconds
Converts a time value in the unit of the temporal axis (TimeUnit) to a time value in seconds.
(Defined by DfsExtensions.)
Public Extension MethodToSecondsFactor
Returns a factor for converting from a time value in the specified time unit to a time value in seconds.

For month and year time units, the factor is not uniquely defined, and may not return the value you want to use.

(Defined by DfsExtensions.)
Top
See Also