Ok, found it. It is in the temporalCapabilities...

So given a loaded netcdf/mesh with time.
Easiest is the firstTimeStepDuration(i) of 
QgsMeshDataProviderTemporalCapabilities:

 >>> p = iface.activeLayer().dataProvider().temporalCapabilities()
 >>> p
 <qgis._core.QgsMeshDataProviderTemporalCapabilities object at 0x7fa958267e20>
 >>> p.timeExtent()
 <QgsDateTimeRange:[2022-11-07T07:00:00Z, 2022-11-08T06:00:00Z]>
 >>> p.temporalUnit()
 <TemporalUnit.Hours: 3>   <<< ?????
 # datasetTime() Returns the relative time in milliseconds of the dataset
 >>> p.datasetTime(QgsMeshDatasetIndex(0,0))
 3600000
 >>> p.datasetTime(QgsMeshDatasetIndex(0,1))
 7200000
 >>> p.datasetTime(QgsMeshDatasetIndex(0,2))
 10800000
 # firstTimeStepDuration() Returns the duration of the first time step of the 
dataset group with index \a group
 # in milliseconds
 p.firstTimeStepDuration(0)
 3600000  == 3600 s = 1 hours
 p.firstTimeStepDuration(0)
 21600000  == 21600 s == 360 minute == 6 hours

Only strange thing is that the temporalUnit() always returns 'hours', while the 
actual data time is relative in minutes...

Regards,

Richard Duivenvoorde

On 3/8/23 10:46, Richard Duivenvoorde via QGIS-User wrote:
Hi,

(trying here too, sorry for cross posting)

When loading (temporal) Netcdf files (as MeshLayers), the 'timestep'
that you see in the Temporal Controller does not change.

I had a look at the api, but could not find any indication of knowledge
by the QgsMeshLayer of the size of the timesteps of the data.

Within netcdf's it is common to define the timesteps as something like:
"minutes since 2022-11-27 16:00:00.0Z"
then the first set has 0, and then the next one for example 60 for
hourly data or 10 for 10-minute data.

Question: IS a temporal mesh layer aware of the timesteps used?

Or if not: I seem not to be able to inspect the data array of the 'time'
dimension. Should/can I?

IF so, we could we could deduct from the first 2 or 3 timesteps, the
size of the timestep.

Anybody a hint or idea?

Regards,

Richard Duivenvoorde

_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to