You put together a "Programmable Source" to do that. Attached is  a Plugin
with such a Programmable source/reader. Load it using "Tools | Plugins".
Then when you open the csv file, you'll be promped to choose a reader,
choose the ""CSV Reader With Time Column".

On Wed, Nov 9, 2016 at 7:15 PM, andrealphus <[email protected]> wrote:

> I have a database of earthquakes in a csv file formatted as;
>
> x,y,z,M,time
> 344914.339004,4153503.07632,-7703,1.22,441772084.24
> 337090.052527,4158668.87752,-10404,1.06,441774936.69
> 335085.941364,4156934.63971,-7245,0.72,441789441.37
> 337111.336138,4167120.16812,-8539,0.76,441790442.57
> 335024.848735,4159463.38774,-4032,0.71,441801083.1
> 338135.588075,4159856.10709,-4160,1.17,441821076.16
>
> where time is in unix seconds.
>
> Normally I plot this by table_to_points, as spherical glpyhs, colored
> by time and sized by "M" (magnitude), see image;
> http://tinyurl.com/neaxe7n
>
>
> But it would be nice to step through these points with time. I just
> cant figure out how to actually get paraview to recognize my time
> column in my table (or my point attribute).
>
> Normally I would either reformat this to a netcdf or create individual
> file at each time step, but for this case these are not suitable
> options.
>
> Any suggestions?
> _______________________________________________
> 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
>
<ServerManagerConfiguration>
  <ProxyGroup name="sources">
    <SourceProxy name="TemporalCSVReader" class="vtkPythonProgrammableFilter" label="TemporalCSVReader">
      <Documentation
        long_help="CVS Reader with time"
        short_help="CVS Reader with time">
      </Documentation>

      <StringVectorProperty
        name="Filename"
        label="Filename"
        initial_string="filename"
        command="SetParameter"
        animateable="1"
        default_values="/tmp/foo.1csv"
        number_of_elements="1">
        <Documentation></Documentation>
        <FileListDomain name="files" />
      </StringVectorProperty>

      <!-- Output data type: "Table" -->
      <IntVectorProperty command="SetOutputDataSetType"
        default_values="19"
        name="OutputDataSetType"
        number_of_elements="1"
        panel_visibility="advanced">
        <Documentation>The value of this property determines the dataset type
          for the output of the programmable filter.</Documentation>
      </IntVectorProperty>


      <StringVectorProperty
        name="Script"
        command="SetScript"
        number_of_elements="1"
        default_values="# Code for 'Script'&#xA;def GetUpdateTimestep ( algorithm ):&#xA;    &quot;&quot;&quot; Returns the requested time value , or None if not present &quot;&quot;&quot;&#xA;    executive = algorithm . GetExecutive ()&#xA;    outInfo = executive . GetOutputInformation (0)&#xA;    return outInfo . Get ( executive . UPDATE_TIME_STEP () ) \&#xA;        if outInfo . Has ( executive . UPDATE_TIME_STEP () ) else None&#xA;&#xA;def find_nearest(array,value):&#xA;    &quot;&quot;&quot;find for nearest value&quot;&quot;&quot;&#xA;    idx = (np.abs(array-value)).argmin()&#xA;    return array[idx]&#xA;&#xA;# This is the requested time-step. This may not be exactly equal to the&#xA;# timesteps published in RequestInformation(). Your code must handle that&#xA;# correctly&#xA;req_time = GetUpdateTimestep (self)&#xA;&#xA;import numpy as np&#xA;data = np.genfromtxt(filename, dtype=None, names=True, delimiter=',', autostrip=True)&#xA;&#xA;timesteps = np.unique(data[&quot;time&quot;])&#xA;req_time = find_nearest(timesteps, req_time)&#xA;data = data[data[&quot;time&quot;] == req_time]&#xA;&#xA;for name in data.dtype.names:&#xA;  array = data[name]&#xA;  output.RowData.append(array, name)&#xA;"
        panel_visibility="advanced">
        <Hints>
          <Widget type="multi_line" syntax="python" />
        </Hints>
        <Documentation>This property contains the text of a python program that
          the programmable source runs.</Documentation>
      </StringVectorProperty>

      <StringVectorProperty
        name="InformationScript"
        label="RequestInformation Script"
        command="SetInformationScript"
        number_of_elements="1"
        default_values="# Code for 'RequestInformation Script'.&#xA;filename = &quot;/tmp/foo1.csv&quot;&#xA;&#xA;def setOutputTimesteps ( algorithm , timesteps ):&#xA;    &quot; helper routine to set timestep information &quot;&#xA;    executive = algorithm . GetExecutive ()&#xA;    outInfo = executive . GetOutputInformation (0)&#xA;    outInfo.Remove ( executive . TIME_STEPS () )&#xA;    for timestep in timesteps :&#xA;        outInfo.Append ( executive . TIME_STEPS () , timestep )&#xA;        outInfo.Remove ( executive . TIME_RANGE () )&#xA;        outInfo.Append ( executive . TIME_RANGE () , timesteps [0])&#xA;        outInfo.Append ( executive . TIME_RANGE () , timesteps [ -1])&#xA;&#xA;import numpy as np&#xA;data = np.genfromtxt(filename, dtype=None, names=True, delimiter=',', autostrip=True)&#xA;timesteps = np.unique(data[&quot;time&quot;])&#xA;setOutputTimesteps(self, timesteps)&#xA;"
        panel_visibility="advanced">
        <Hints>
          <Widget type="multi_line" syntax="python" />
        </Hints>
        <Documentation>This property is a python script that is executed during
          the RequestInformation pipeline pass. Use this to provide information
          such as WHOLE_EXTENT to the pipeline downstream.</Documentation>
      </StringVectorProperty>

      <DoubleVectorProperty information_only="1"
        name="TimestepValues"
        repeatable="1">
        <TimeStepsInformationHelper />
        <Documentation>Available timestep values.</Documentation>
      </DoubleVectorProperty>

      <Hints>
        <!-- View can be used to specify the preferred view for the proxy -->
        <View type="SpreadSheetView" />
        <ReaderFactory extensions="csv txt CSV TXT"
          file_description="Delimited Text With Time" />
      </Hints>
    </SourceProxy>
  </ProxyGroup>
</ServerManagerConfiguration>
_______________________________________________
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

Reply via email to