<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Please keep the discussion to the mailing list so others can<br>
benefit-from/contribute-to the conversion.<br>
<br>
the code I send is for the programmable filter!!!<br>
<br>
if you are using a python script these are the lines to use
(generated with python trace in ParaView):<br>
the code in the Script variable of the programmable filter is always
very ugly. you can put the source in a file extra file and use the
execfile() function of python to call it.<br>
<br>
#--- begin code ---<br>
# create a new 'Programmable Filter'<br>
programmableFilter1 = ProgrammableFilter(Input=waterPropertiesnc)<br>
<br>
# Properties modified on programmableFilter1<br>
programmableFilter1.Script = 'pdo =
self.GetOutput();\npdo.ShallowCopy(self.GetInput());\na =
self.GetInput().GetInformation().Get(pdo.DATA_TIME_STEP());\n# this
is your convertion routine\ntime_label = "Days from 12/12/1800 = " +
str(a*100) + ":" + str((a*100)%2) + " ...days"\nlabel =
vtk.vtkStringArray();\nlabel.SetNumberOfComponents(1);\nlabel.Resize(1);\nlabel.SetName("TimeLabel");\nlabel.SetValue(0,time_label);\npdo.GetFieldData().AddArray(label)\n'<br>
<br>
programmableFilter1.RequestInformationScript = ''<br>
programmableFilter1.RequestUpdateExtentScript = ''<br>
programmableFilter1.PythonPath = ''<br>
<br>
annotateGlobalData1 = AnnotateGlobalData(Input=programmableFilter1)<br>
<br>
# show data in view<br>
annotateGlobalData1Display = Show(annotateGlobalData1, renderView1)<br>
<br>
#--- end code ---<br>
<br>
don’t forget to do the time conversion in the script!!!<br>
<br>
<br>
Felipe<br>
<br>
Le 02/03/2015 17:09, Madalena S. Malhadas a écrit :<br>
<span style="white-space: pre;">> Hi Felipe, <br>
><br>
> I am a new user of paraview/python, so i Have dificult to
understand where i have to place the code in my script.<br>
><br>
> My script read a nc file, then i use the annotate time filter
to extract the time in file, but apears numbers (equivalent to
seconds)<br>
><br>
> Then i include your code after call annotate time filter but
i get an error.<br>
><br>
> Attached i send my scritp and if possible can you see the
part of the time conversions and understand what ihave wrong. For
me is to difficult to understand since i am novate in programming.<br>
><br>
> Thank you very much<br>
><br>
> Madalena<br>
><br>
> -------------------------<br>
> From: <a class="moz-txt-link-abbreviated" href="mailto:nenasantos@hotmail.com">nenasantos@hotmail.com</a><br>
> To: <a class="moz-txt-link-abbreviated" href="mailto:felipe.bordeu@ec-nantes.fr">felipe.bordeu@ec-nantes.fr</a><br>
> Date: Mon, 2 Mar 2015 15:49:15 +0000<br>
> CC: <a class="moz-txt-link-abbreviated" href="mailto:paraview@paraview.org">paraview@paraview.org</a><br>
> Subject: Re: [Paraview] Annotate time filter - regard real
time<br>
><br>
> Thank you very much! I will test now.<br>
><br>
> Kind regards<br>
><br>
> -------------------------<br>
> Date: Mon, 2 Mar 2015 16:46:32 +0100<br>
> From: <a class="moz-txt-link-abbreviated" href="mailto:felipe.bordeu@ec-nantes.fr">felipe.bordeu@ec-nantes.fr</a><br>
> CC: <a class="moz-txt-link-abbreviated" href="mailto:paraview@paraview.org">paraview@paraview.org</a><br>
> Subject: Re: [Paraview] Annotate time filter - regard real
time<br>
><br>
><br>
> to generate a string from you field data (using a
ProgrammableFilter):<br>
><br>
> script:<br>
><br>
> pdo = self.GetOutput();<br>
> pdo.ShallowCopy(self.GetInput());<br>
> a =
self.GetInput().GetInformation().Get(pdo.DATA_TIME_STEP());<br>
> # this is your convertion routine<br>
> time_label = "Days from 12/12/1800 = " + str(a*100) + ":" +
str((a*100)%2) + " ...days"<br>
> label = vtk.vtkStringArray();<br>
> label.SetNumberOfComponents(1);<br>
> label.Resize(1);<br>
> label.SetName("TimeLabel");<br>
> label.SetValue(0,time_label);<br>
> pdo.GetFieldData().AddArray(label)<br>
><br>
> del label<br>
><br>
> then you use a AnnotateGlobalData Filter.<br>
><br>
> Done<br>
><br>
><br>
><br>
><br>
> Le 02/03/2015 15:07, Madalena S. Malhadas a écrit :<br>
> > But how do I do it? Can you explain the steps please?<br>
><br>
> > Regards<br>
> > Madalena<br>
><br>
> > -------------------------<br>
> > From: <a class="moz-txt-link-abbreviated" href="mailto:felipe.bordeu@ec-nantes.fr">felipe.bordeu@ec-nantes.fr</a>
<a class="moz-txt-link-rfc2396E" href="mailto:felipe.bordeu@ec-nantes.fr"><mailto:felipe.bordeu@ec-nantes.fr></a><br>
> > Date: Mon, 2 Mar 2015 14:18:06 +0100<br>
> > CC: <a class="moz-txt-link-abbreviated" href="mailto:paraview@paraview.org">paraview@paraview.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:paraview@paraview.org"><mailto:paraview@paraview.org></a><br>
> > Subject: Re: [Paraview] Annotate time filter - regard
real time<br>
><br>
> > you can use the python programable filter to create a
field data with the date (in string) and use a annotate field data
filter.<br>
><br>
> > Felipe<br>
> > Le 27 févr. 2015 à 14:50, Madalena S. Malhadas
<<a class="moz-txt-link-abbreviated" href="mailto:nenasantos@hotmail.com">nenasantos@hotmail.com</a> <a class="moz-txt-link-rfc2396E" href="mailto:nenasantos@hotmail.com"><mailto:nenasantos@hotmail.com></a>
<a class="moz-txt-link-rfc2396E" href="mailto:nenasantos@hotmail.com"><mailto:nenasantos@hotmail.com></a>
<a class="moz-txt-link-rfc2396E" href="mailto:nenasantos@hotmail.com"><mailto:nenasantos@hotmail.com></a>> a écrit :<br>
><br>
><br>
> > Dear paraview users,<br>
><br>
> > I have a question over the use of Annotate time
filter in Paraview. I have a paraview script that read netcdf data
which has time axis given as "days since 1970-01-01<br>
> > 00:00" (Epoch Time). This gives problem if I want to
show the real time of the data in the animation window. What I
would like to have shown are the date as<br>
> > 4-8-2003, 00:00 etc. and it shows big number like
19521, 19522.<br>
><br>
> > Does anyone have some idea how to solve the problem?<br>
><br>
> > Thanks a lot!<br>
><br>
> > Madalena<br>
> > _______________________________________________<br>
> > Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
<a class="moz-txt-link-rfc2396E" href="http://www.kitware.com"><http://www.kitware.com></a> <a class="moz-txt-link-rfc2396E" href="http://www.kitware.com/"><http://www.kitware.com/></a>
<a class="moz-txt-link-rfc2396E" href="http://www.kitware.com/"><http://www.kitware.com/></a><br>
><br>
> > Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> > Please keep messages on-topic and check the ParaView
Wiki at: <a class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a><br>
><br>
> > Search the list archives at:
<a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView">http://markmail.org/search/?q=ParaView</a><br>
><br>
> > Follow this link to subscribe/unsubscribe:<br>
> > <a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
><br>
><br>
> > _______________________________________________ Powered
by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a> <a class="moz-txt-link-rfc2396E" href="http://www.kitware.com"><http://www.kitware.com></a> Visit other
Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a> Please keep
messages on-topic and check the ParaView Wiki at:
<a class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a> Search the list archives at:
<a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView">http://markmail.org/search/?q=ParaView</a> Follow this link to
subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
><br>
><br>
><br>
> _______________________________________________ Powered by
<a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a> Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a> Please keep
messages on-topic and check the ParaView Wiki at:
<a class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a> Search the list archives at:
<a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView">http://markmail.org/search/?q=ParaView</a> Follow this link to
subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
> _______________________________________________ Powered by
<a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a> Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a> Please keep
messages on-topic and check the ParaView Wiki at:
<a class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a> Search the list archives at:
<a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView">http://markmail.org/search/?q=ParaView</a> Follow this link to
subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview">http://public.kitware.com/mailman/listinfo/paraview</a></span><br>
<br>
- -- <br>
Felipe Bordeu Weldt<br>
Ingénieur de Recherche<br>
- -------------------------------------<br>
Tél. : 33 (0)2 40 37 16 57<br>
Fax. : 33 (0)2 40 74 74 06<br>
<a class="moz-txt-link-abbreviated" href="mailto:Felipe.Bordeu@ec-nantes.fr">Felipe.Bordeu@ec-nantes.fr</a><br>
Institut GeM - UMR CNRS 6183<br>
École Centrale Nantes<br>
1 Rue de La Noë, 44321 Nantes, FRANCE<br>
- -------------------------------------<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1<br>
<br>
iQEcBAEBAgAGBQJU9XEOAAoJEE/fMfNgU9/DWf4H/1J8KiRnj8bVjVQ9+4zw8Ne6<br>
VQHw4Ibt+SQjq2LI400aNxbew92A3h7wY1Hd6PkV1hMmJt7lTRync6NJ27GAMnfZ<br>
P2mLEggin2r4ZEbSdOavA26wWSs2+yXs6sjQIOcivmsPHFGwY2+XpAAUwN1nIcxZ<br>
egqPEGyokauxkO3C3EKGcT6thl+6GXTZKh+5j/JfcoB0G54pxJjLeXqWdCIJiQ0X<br>
tuWHpx7kGdLdRMNH1Dm8KEd/C8iJneHKCYntK5b1U3kiCJZoiXccNszfTRO+xgFl<br>
3hBv34eXPEiSk2q2+NW4S3mo2W9h+mB/gGswrX4zyyD/P6UFtIoS16POFcPu3Lw=<br>
=p6E1<br>
-----END PGP SIGNATURE-----<br>
<br>
</body>
</html>