[Paraview] Annotate time filter - regard real time - error in code after test
Madalena S. Malhadas
nenasantos at hotmail.com
Tue Mar 3 04:33:39 EST 2015
Thank you very much.
Date: Tue, 3 Mar 2015 09:30:19 +0100
From: felipe.bordeu at ec-nantes.fr
To: paraview at paraview.org
Subject: Re: [Paraview] Annotate time filter - regard real time - error in code after test
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Please keep the discussion to the mailing list so others can
benefit-from/contribute-to the conversion.
the code I send is for the programmable filter!!!
if you are using a python script these are the lines to use
(generated with python trace in ParaView):
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.
#--- begin code ---
# create a new 'Programmable Filter'
programmableFilter1 = ProgrammableFilter(Input=waterPropertiesnc)
# Properties modified on programmableFilter1
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'
programmableFilter1.RequestInformationScript = ''
programmableFilter1.RequestUpdateExtentScript = ''
programmableFilter1.PythonPath = ''
annotateGlobalData1 = AnnotateGlobalData(Input=programmableFilter1)
# show data in view
annotateGlobalData1Display = Show(annotateGlobalData1, renderView1)
#--- end code ---
don’t forget to do the time conversion in the script!!!
Felipe
Le 02/03/2015 17:09, Madalena S. Malhadas a écrit :
> Hi Felipe,
>
> I am a new user of paraview/python, so i Have dificult to
understand where i have to place the code in my script.
>
> 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)
>
> Then i include your code after call annotate time filter but
i get an error.
>
> 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.
>
> Thank you very much
>
> Madalena
>
> -------------------------
> From: nenasantos at hotmail.com
> To: felipe.bordeu at ec-nantes.fr
> Date: Mon, 2 Mar 2015 15:49:15 +0000
> CC: paraview at paraview.org
> Subject: Re: [Paraview] Annotate time filter - regard real
time
>
> Thank you very much! I will test now.
>
> Kind regards
>
> -------------------------
> Date: Mon, 2 Mar 2015 16:46:32 +0100
> From: felipe.bordeu at ec-nantes.fr
> CC: paraview at paraview.org
> Subject: Re: [Paraview] Annotate time filter - regard real
time
>
>
> to generate a string from you field data (using a
ProgrammableFilter):
>
> script:
>
> pdo = self.GetOutput();
> pdo.ShallowCopy(self.GetInput());
> a =
self.GetInput().GetInformation().Get(pdo.DATA_TIME_STEP());
> # this is your convertion routine
> time_label = "Days from 12/12/1800 = " + str(a*100) + ":" +
str((a*100)%2) + " ...days"
> label = vtk.vtkStringArray();
> label.SetNumberOfComponents(1);
> label.Resize(1);
> label.SetName("TimeLabel");
> label.SetValue(0,time_label);
> pdo.GetFieldData().AddArray(label)
>
> del label
>
> then you use a AnnotateGlobalData Filter.
>
> Done
>
>
>
>
> Le 02/03/2015 15:07, Madalena S. Malhadas a écrit :
> > But how do I do it? Can you explain the steps please?
>
> > Regards
> > Madalena
>
> > -------------------------
> > From: felipe.bordeu at ec-nantes.fr
<mailto:felipe.bordeu at ec-nantes.fr>
> > Date: Mon, 2 Mar 2015 14:18:06 +0100
> > CC: paraview at paraview.org
<mailto:paraview at paraview.org>
> > Subject: Re: [Paraview] Annotate time filter - regard
real time
>
> > you can use the python programable filter to create a
field data with the date (in string) and use a annotate field data
filter.
>
> > Felipe
> > Le 27 févr. 2015 à 14:50, Madalena S. Malhadas
<nenasantos at hotmail.com <mailto:nenasantos at hotmail.com>
<mailto:nenasantos at hotmail.com>
<mailto:nenasantos at hotmail.com>> a écrit :
>
>
> > Dear paraview users,
>
> > 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
> > 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
> > 4-8-2003, 00:00 etc. and it shows big number like
19521, 19522.
>
> > Does anyone have some idea how to solve the problem?
>
> > Thanks a lot!
>
> > Madalena
> > _______________________________________________
> > Powered by www.kitware.com
<http://www.kitware.com> <http://www.kitware.com/>
<http://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
>
>
>
> > _______________________________________________ Powered
by www.kitware.com <http://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
>
>
>
>
> _______________________________________________ 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
>
> _______________________________________________ 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
- --
Felipe Bordeu Weldt
Ingénieur de Recherche
- -------------------------------------
Tél. : 33 (0)2 40 37 16 57
Fax. : 33 (0)2 40 74 74 06
Felipe.Bordeu at ec-nantes.fr
Institut GeM - UMR CNRS 6183
École Centrale Nantes
1 Rue de La Noë, 44321 Nantes, FRANCE
- -------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJU9XEOAAoJEE/fMfNgU9/DWf4H/1J8KiRnj8bVjVQ9+4zw8Ne6
VQHw4Ibt+SQjq2LI400aNxbew92A3h7wY1Hd6PkV1hMmJt7lTRync6NJ27GAMnfZ
P2mLEggin2r4ZEbSdOavA26wWSs2+yXs6sjQIOcivmsPHFGwY2+XpAAUwN1nIcxZ
egqPEGyokauxkO3C3EKGcT6thl+6GXTZKh+5j/JfcoB0G54pxJjLeXqWdCIJiQ0X
tuWHpx7kGdLdRMNH1Dm8KEd/C8iJneHKCYntK5b1U3kiCJZoiXccNszfTRO+xgFl
3hBv34eXPEiSk2q2+NW4S3mo2W9h+mB/gGswrX4zyyD/P6UFtIoS16POFcPu3Lw=
=p6E1
-----END PGP SIGNATURE-----
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150303/325ad572/attachment.html>
More information about the ParaView
mailing list