Loading ASCII VTK data
Hi all, I'm trying to load in some data from an ASCII VTK file (attached for reference) that I created following the guidelines here: http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf. I can load this file into Visit and I was hoping that to load it into yt would be as simple as : ds = yt.load("lid_driven_cavity_20.vtk") When I try that however I get the error message: Traceback (most recent call last): File "visualization.py", line 3, in <module> ds = yt.load("lid_driven_cavity_20.vtk") File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\convenience.py", line 84, in load return candidates[0](*args, **kwargs) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 470, in __init__ Dataset.__init__(self, filename, dataset_type, units_override=units_override) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\data_objects\static_output.py", line 190, in __init__ self._parse_parameter_file() File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 528, in _parse_parameter_file self.domain_left_edge = grid['left_edge'] KeyError: 'left_edge' Is it possible to load in such a file to yt? If not, since I'm writing my own data file, how could I edit it to make it readable by yt? Thanks in advance, Lukas
On Mon, May 16, 2016 at 9:04 PM, Lukas Bystricky
Hi all,
I'm trying to load in some data from an ASCII VTK file (attached for reference) that I created following the guidelines here: http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf. I can load this file into Visit and I was hoping that to load it into yt would be as simple as :
ds = yt.load("lid_driven_cavity_20.vtk")
When I try that however I get the error message:
Traceback (most recent call last): File "visualization.py", line 3, in <module> ds = yt.load("lid_driven_cavity_20.vtk") File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\convenience.py", line 84, in load return candidates[0](*args, **kwargs) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 470, in __init__ Dataset.__init__(self, filename, dataset_type, units_override=units_override) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\data_objects\static_output.py", line 190, in __init__ self._parse_parameter_file() File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 528, in _parse_parameter_file self.domain_left_edge = grid['left_edge'] KeyError: 'left_edge'
Is it possible to load in such a file to yt?
We can read the VTK format output by the Athena code, which seems to be similar but not identical to the file you're reading.
If not, since I'm writing my own data file, how could I edit it to make it readable by yt?
If the data are small enough to fit in memory, you could load them in using the stream frontend: http://yt-project.org/docs/dev/examining/generic_array_data.html In the long term, we should think about adding a frontend for the data format described in the PDF you linked to. It could probably be based on the Athena frontend. If you wanted to work on that, there are two other people who are actively working on writing frontends right now for their codes, so they should be able to help answer questions.
Thanks in advance,
Lukas
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Lukas, So I was actually able to convert your file to binary VTK and get started with it in yt, but I hit a roadblock. Your data is “vertex-centered” in our parlance, but we don’t as of yet support vertex-centered data. If you can convert to cell-centered data, we can probably support you out of the box, but for now vertex-centered data is not yet implemented. For example, here is what the header for an Athena VTK file looks like: # vtk DataFile Version 3.0 PRIMITIVE vars at time= 2.700111e+03, level= 0, domain= 0 BINARY DATASET STRUCTURED_POINTS DIMENSIONS 257 257 257 ORIGIN -2.000000e+00 -2.000000e+00 -2.000000e+00 SPACING 1.562500e-02 1.562500e-02 1.562500e-02 CELL_DATA 16777216 SCALARS density float LOOKUP_TABLE default Let us know… John
On May 16, 2016, at 10:04 PM, Lukas Bystricky
wrote: Hi all,
I'm trying to load in some data from an ASCII VTK file (attached for reference) that I created following the guidelines here: http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf. I can load this file into Visit and I was hoping that to load it into yt would be as simple as :
ds = yt.load("lid_driven_cavity_20.vtk")
When I try that however I get the error message:
Traceback (most recent call last): File "visualization.py", line 3, in <module> ds = yt.load("lid_driven_cavity_20.vtk") File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\convenience.py", line 84, in load return candidates[0](*args, **kwargs) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 470, in __init__ Dataset.__init__(self, filename, dataset_type, units_override=units_override) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\data_objects\static_output.py", line 190, in __init__ self._parse_parameter_file() File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 528, in _parse_parameter_file self.domain_left_edge = grid['left_edge'] KeyError: 'left_edge'
Is it possible to load in such a file to yt? If not, since I'm writing my own data file, how could I edit it to make it readable by yt?
Thanks in advance,
Lukas
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi John,
Yes, sorry it is vertex centered, I forgot to mention that. The data comes
from a staggered grid however, (the velocities and pressures defined on
separate grids); currently I'm just interpolating everything to the same
grid. In principle I could interpolate everything to a cell centered grid
(which is the native grid for the pressure), but I'd have to think about
how to handle boundary conditions in that case. Does YT handle staggered
grids in a natural way?
Thanks again,
Lukas
On Thu, Jun 2, 2016 at 3:49 PM, John Zuhone
Hi Lukas,
So I was actually able to convert your file to binary VTK and get started with it in yt, but I hit a roadblock.
Your data is “vertex-centered” in our parlance, but we don’t as of yet support vertex-centered data.
If you can convert to cell-centered data, we can probably support you out of the box, but for now vertex-centered data is not yet implemented.
For example, here is what the header for an Athena VTK file looks like:
# vtk DataFile Version 3.0 PRIMITIVE vars at time= 2.700111e+03, level= 0, domain= 0 BINARY DATASET STRUCTURED_POINTS DIMENSIONS 257 257 257 ORIGIN -2.000000e+00 -2.000000e+00 -2.000000e+00 SPACING 1.562500e-02 1.562500e-02 1.562500e-02 CELL_DATA 16777216 SCALARS density float LOOKUP_TABLE default
Let us know…
John
On May 16, 2016, at 10:04 PM, Lukas Bystricky
wrote: Hi all,
I'm trying to load in some data from an ASCII VTK file (attached for reference) that I created following the guidelines here: http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf. I can load this file into Visit and I was hoping that to load it into yt would be as simple as :
ds = yt.load("lid_driven_cavity_20.vtk")
When I try that however I get the error message:
Traceback (most recent call last): File "visualization.py", line 3, in <module> ds = yt.load("lid_driven_cavity_20.vtk") File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\convenience.py", line 84, in load return candidates[0](*args, **kwargs) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 470, in __init__ Dataset.__init__(self, filename, dataset_type, units_override=units_override) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\data_objects\static_output.py", line 190, in __init__ self._parse_parameter_file() File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 528, in _parse_parameter_file self.domain_left_edge = grid['left_edge'] KeyError: 'left_edge'
Is it possible to load in such a file to yt? If not, since I'm writing my own data file, how could I edit it to make it readable by yt?
Thanks in advance,
Lukas
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Lukas, At the moment, to my knowledge we do not handle staggered grids at all, unfortunately. Interpolating everything to the cell-centered grid would make the most sense at least for yt. I suppose then the VTK file would have to be “structured_points” or something similar. Best, John
On Jun 2, 2016, at 4:47 PM, Lukas Bystricky
wrote: Hi John,
Yes, sorry it is vertex centered, I forgot to mention that. The data comes from a staggered grid however, (the velocities and pressures defined on separate grids); currently I'm just interpolating everything to the same grid. In principle I could interpolate everything to a cell centered grid (which is the native grid for the pressure), but I'd have to think about how to handle boundary conditions in that case. Does YT handle staggered grids in a natural way?
Thanks again,
Lukas
On Thu, Jun 2, 2016 at 3:49 PM, John Zuhone
mailto:jzuhone@gmail.com> wrote: Hi Lukas, So I was actually able to convert your file to binary VTK and get started with it in yt, but I hit a roadblock.
Your data is “vertex-centered” in our parlance, but we don’t as of yet support vertex-centered data.
If you can convert to cell-centered data, we can probably support you out of the box, but for now vertex-centered data is not yet implemented.
For example, here is what the header for an Athena VTK file looks like:
# vtk DataFile Version 3.0 PRIMITIVE vars at time= 2.700111e+03, level= 0, domain= 0 BINARY DATASET STRUCTURED_POINTS DIMENSIONS 257 257 257 ORIGIN -2.000000e+00 -2.000000e+00 -2.000000e+00 SPACING 1.562500e-02 1.562500e-02 1.562500e-02 CELL_DATA 16777216 SCALARS density float LOOKUP_TABLE default
Let us know…
John
On May 16, 2016, at 10:04 PM, Lukas Bystricky
mailto:lukasbystricky@gmail.com> wrote: Hi all,
I'm trying to load in some data from an ASCII VTK file (attached for reference) that I created following the guidelines here: http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf. I can load this file into Visit and I was hoping that to load it into yt would be as simple as :
ds = yt.load("lid_driven_cavity_20.vtk")
When I try that however I get the error message:
Traceback (most recent call last): File "visualization.py", line 3, in <module> ds = yt.load("lid_driven_cavity_20.vtk") File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\convenience.py", line 84, in load return candidates[0](*args, **kwargs) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 470, in __init__ Dataset.__init__(self, filename, dataset_type, units_override=units_override) File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\data_objects\static_output.py", line 190, in __init__ self._parse_parameter_file() File "C:\Users\Dave\Anaconda2\lib\site-packages\yt\frontends\athena\data_structures.py", line 528, in _parse_parameter_file self.domain_left_edge = grid['left_edge'] KeyError: 'left_edge'
Is it possible to load in such a file to yt? If not, since I'm writing my own data file, how could I edit it to make it readable by yt?
Thanks in advance,
Lukas
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org mailto:yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org mailto:yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (4)
-
John Zuhone
-
John ZuHone
-
Lukas Bystricky
-
Nathan Goldbaum