Dear all, I have a question on how to convert a time in hours since 0001-01-01 00:00:00 to a normal date time string. In Python a routine is avaiable in the netCDF4 library, so I thought I used that.
I want to use PythonAnnotate eventually to plot the date time. So know I have to following steps in my pipeline browser 1: load a netcdf4 file with a Lat/Lon spherical coordinates and a time in as a float giving the number of hourse since 0001 2 A ProgrammableFilter with the following settings Output Data Set Type: vtkTable Script: import sys sys.path.append("C://Apps/Anaconda/Anaconda2/envs/paraview/Lib/site-packages/") import netCDF4 as nc t = inputs[0].GetInformation().Get(vtk.vtkDataObject.DATA_TIME_STEP()) date_time = nc.num2date(t, units="hours since 0001-01-01 00:00:00", calendar="gregorian") output.RowData.append(date_time, "datetime") This all works. If I create a print statement in the script I see that the time is indeed correctly converted to a date/time string, eg. 17671944.0 is now 2017-01-01-00:00:00 The point is: I want to store this resulting datatime value into a vtkTable so that I can use it to plot it to the screen using the Python annotation (which I do with the RowData.append line) In the python annotation, however, I cannot get the value for datatime rom the RowDATa I now have for the pythonannotation expression the following Array Association: Row Data Expression: "{}".format(input.RowData) But this gives me just a reference to the row data, not the string of the date/time I just stored My question is: 1) How can I get the rowdata which I stored in the ProgrammableFilter in the vtkTable 2) Is there a better way to do this: convert a float into a date/time string which you can print Hopefully anybody can give me a hint
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview