<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div>Dear all,</div><div><br></div><div>I tryed to make the time conversion in the script but i have an error. When i put this </div><div><br></div><div>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'</div><div><br></div><div>in the script box via paraview i get error. Do you know how to solve the error.</div><div><br></div>Madalena<br><div><hr id="stopSpelling">From: nenasantos@hotmail.com<br>To: felipe.bordeu@ec-nantes.fr; paraview@paraview.org<br>Date: Tue, 3 Mar 2015 09:33:39 +0000<br>Subject: Re: [Paraview] Annotate time filter - regard real time - error in code after test<br><br>
<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}
.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}
--></style>
<div dir="ltr">Thank you very much.<br><br><div><hr id="ecxstopSpelling">Date: Tue, 3 Mar 2015 09:30:19 +0100<br>From: felipe.bordeu@ec-nantes.fr<br>To: paraview@paraview.org<br>Subject: Re: [Paraview] Annotate time filter - regard real time - error in code after test<br><br></div><div><br></div><div><br></div><div><br></div><div><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="ecxmoz-txt-link-abbreviated" href="mailto:nenasantos@hotmail.com">nenasantos@hotmail.com</a><br>
> To: <a class="ecxmoz-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="ecxmoz-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="ecxmoz-txt-link-abbreviated" href="mailto:felipe.bordeu@ec-nantes.fr">felipe.bordeu@ec-nantes.fr</a><br>
> CC: <a class="ecxmoz-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="ecxmoz-txt-link-abbreviated" href="mailto:felipe.bordeu@ec-nantes.fr">felipe.bordeu@ec-nantes.fr</a>
<a class="ecxmoz-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="ecxmoz-txt-link-abbreviated" href="mailto:paraview@paraview.org">paraview@paraview.org</a>
<a class="ecxmoz-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="ecxmoz-txt-link-abbreviated" href="mailto:nenasantos@hotmail.com">nenasantos@hotmail.com</a> <a class="ecxmoz-txt-link-rfc2396E" href="mailto:nenasantos@hotmail.com"><mailto:nenasantos@hotmail.com></a>
<a class="ecxmoz-txt-link-rfc2396E" href="mailto:nenasantos@hotmail.com"><mailto:nenasantos@hotmail.com></a>
<a class="ecxmoz-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="ecxmoz-txt-link-abbreviated" href="http://www.kitware.com" target="_blank">www.kitware.com</a>
<a class="ecxmoz-txt-link-rfc2396E" href="http://www.kitware.com" target="_blank"><http://www.kitware.com></a> <a class="ecxmoz-txt-link-rfc2396E" href="http://www.kitware.com/" target="_blank"><http://www.kitware.com/></a>
<a class="ecxmoz-txt-link-rfc2396E" href="http://www.kitware.com/" target="_blank"><http://www.kitware.com/></a><br>
><br>
> > Visit other Kitware open-source projects at
<a class="ecxmoz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> > Please keep messages on-topic and check the ParaView
Wiki at: <a class="ecxmoz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
><br>
> > Search the list archives at:
<a class="ecxmoz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
><br>
> > Follow this link to subscribe/unsubscribe:<br>
> > <a class="ecxmoz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
><br>
><br>
> > _______________________________________________ Powered
by <a class="ecxmoz-txt-link-abbreviated" href="http://www.kitware.com" target="_blank">www.kitware.com</a> <a class="ecxmoz-txt-link-rfc2396E" href="http://www.kitware.com" target="_blank"><http://www.kitware.com></a> Visit other
Kitware open-source projects at
<a class="ecxmoz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a> Please keep
messages on-topic and check the ParaView Wiki at:
<a class="ecxmoz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a> Search the list archives at:
<a class="ecxmoz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView" target="_blank">http://markmail.org/search/?q=ParaView</a> Follow this link to
subscribe/unsubscribe:
<a class="ecxmoz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
><br>
><br>
><br>
> _______________________________________________ Powered by
<a class="ecxmoz-txt-link-abbreviated" href="http://www.kitware.com" target="_blank">www.kitware.com</a> Visit other Kitware open-source projects at
<a class="ecxmoz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a> Please keep
messages on-topic and check the ParaView Wiki at:
<a class="ecxmoz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a> Search the list archives at:
<a class="ecxmoz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView" target="_blank">http://markmail.org/search/?q=ParaView</a> Follow this link to
subscribe/unsubscribe:
<a class="ecxmoz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
> _______________________________________________ Powered by
<a class="ecxmoz-txt-link-abbreviated" href="http://www.kitware.com" target="_blank">www.kitware.com</a> Visit other Kitware open-source projects at
<a class="ecxmoz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a> Please keep
messages on-topic and check the ParaView Wiki at:
<a class="ecxmoz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a> Search the list archives at:
<a class="ecxmoz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView" target="_blank">http://markmail.org/search/?q=ParaView</a> Follow this link to
subscribe/unsubscribe:
<a class="ecxmoz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">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="ecxmoz-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>
<br>_______________________________________________
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</div> </div>
<br>_______________________________________________
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</div> </div></body>
</html>