These GridUtility methods act on GridData objects in place within program memory. They do not create new objects or store their results in DSS records. To create a new DSS record with the new time, you will need to use either a GriddedData object or the storeGridToDss method described above.

GridUtilities.SetTimeByEnd


This method sets the start and end time of a GridData object, using the time specified in the arguments as the end time. For an instantaneous-type grid (Instantaneous Value or Instantaneous Cumulative) the start and end times will both be set to the same value. For a period-type grid (Period Cumulative or Period Average) the original time interval will be preserved.
Int GridUtilities.setTimeByStart(
GridData theGrid,
HecTime startTime)
The possible return values and their meanings are listed below.
0 – Grid's time stamps were successfully changed.
-1 – The grid's data type is FREQUENCY or INVALID.

GridUtilities.SetTimeByStart


This method sets the start and end time of a GridData object, using the time specified in the arguments as the start time. For an instantaneous-type grid (Instantaneous Value or Instantaneous Cumulative) the start and end times will both be set to the same value. For a period-type grid (Period Cumulative or Period Average) the original time interval will be preserved.
int GridData GridUtilities.setTimeByEnd(
GridData theGrid,
HecTime startTime)
The possible return values and their meanings are listed below.
0 – Grid's time stamps were successfully changed.
-1 – The grid's data type is FREQUENCY or INVALID.

Notes on Time-Setting Methods for Grids


For instantaneous data, setTimeByEnd and setTimeByStart produce identical results.
For period-type data (Period Cumulative or Period Average) setTimeByEnd and setTimeByStart calculate the time difference between the GridData object's original start and end times, the set the start or end time and then add or subtract the difference to set the end or start time. The difference is calculated to the nearest minute.
For grids with a data type that is neither instantaneous nor period, that is, for grids with data type of FREQUENCY or INVALID, setTimeByEnd and setTimeByStart do not change the GridData object and return a status value of -1.