TUFLOW Viewer - Isodate (Date-Time) Format
This page describes how to use date-time format for Map Outputs when using QGIS 3.16 or later. Prior versions of QGIS are not recommended for Isodate (Date-Time) format.
Be aware that all layers have individual reference times and may misalign if one is updated and the others are not (e.g. the map outputs are updated, but not the time series outputs).
Tool Description
Date-time can be toggled on by toggling Show as dates below the plot toolbar.
This will toggle the time format in the time box from relative time (hh:mm:ss) to absolute time (dd/mm/yyyy hh:mm:ss). The plot will not always update and may require refresh plot to be clicked before updating the x-axis of the time series plot.
Map Ouptuts
For QGIS v3.16+, the reference time for map outputs is controlled natively in the layer's Properties. For TUFLOW Classic and HPC simulation results, this will most likely default to 1999-12-31 14:00:00. TUFLOW FV outputs can contain a reference time specified in the .fvc file and may be correctly set on load.
The Zero Date option in Settings >> Options >> Plotting controls the relative time. Consequencely this value has no effect on the date-time displayed in the time box or plot window if Show as dates is toggled on. If Show as dates is toggled off and the Zero Time and the Reference Time are not aligned, then you may find that the relative time in the time box is offset by some value (the results should still work completely fine).
Be aware that all layers have individual reference times and may start mis-aligning if one is updated and the others are not (e.g. the map outputs are updated, but not the time series outputs). Please see relevant links at the bottom of the page on how to work with date-time format with other outputs.
Switching on Date-Time and Changing the Reference Time
Time Series Ouptuts
The Zero Date option in Settings >> Options >> Plotting controls the relative time. Consequencely this value has no effect on the date-time displayed in the time box or plot window if Show as dates is toggled on. If Show as dates is toggled off and the Zero Time and the Reference Time are not aligned, then you may find that the relative time in the time box is offset by some value (the results should still work completely fine).
Once Time Series Outputs have been loaded, it is not currently possible to change the reference time. To set the reference time, this must be done prior to loading the results into TUFLOW Viewer. This can be done either by:
- Setting Zero Date in Settings >> Options >> Plotting prior to loading the results as this will be used in-lieu of any inherent reference time contained in the results
- Users can add the following reference time line to the tpc file to set the reference time for the results:
- Reference Time == YYYY-MM-DD hh:mm:ss
- Reference Time == YYYY-MM-DD hh:mm:ss
Note: the date format doesn't have to use this exact form. Other conventions (eg. U.S. convention) can be used.
Particle Tracking Output
The Zero Date option in Settings >> Options >> Plotting controls the relative time. Consequencely this value has no effect on the date-time displayed in the time box or plot window if Show as dates is toggled on. If Show as dates is toggled off and the Zero Time and the Reference Time are not aligned, then you may find that the relative time in the time box is offset by some value (the results should still work completely fine).
Once Particle Tracking Outputs have been loaded, it is not currently possible to change the reference time. Particle results may inherently have a reference time and if this is the case, it is not possible to change unless the user updates this directly in the netCDF file (e.g. either by using Matlab or Python - example presented below using Python). If the particle results do not have a reference time, then it is possible to change the reference time by changing Zero Date in Settings >> Options >> Plotting prior to loading the results. The Zero Date will be adopted in-lieu of any reference time contained in the results.
Example Python Code to Add or Modify the Reference Time
This can be done in QGIS using the Python Console.
from netCDF4 import Dataset ptm = r"C:\TUFLOW\results\particle_output_ptm.nc" # Path to particle output netcdf file # open netcdf file and change the 'long_name' of the Time variable nc = Dataset(ptm, "r+") nc['Time'].long_name = "output time from 01/01/2000 00:00:00" # dd/mm/yyyy hh:mm:ss - if removing reference time, use 'output time' and omit the date string nc.close()
Imported User Data
If the user data is imported with dates, then these will be adopted for use when date-time format is used. If dates are not imported with the data then the reference time will be dynamic and be adopted from Settings >> Options >> Plotting >> Zero Date.
Note: unlike imported results, relative time is locked on import. So even if the import includes dates, the relative time will not dynamically update if the Zero Date is changed.
Up |
---|
Back to TUFLOW Viewer Main Page |