Error in Loading vtk Files
Dear yt Dev Team, Hope this email finds you well! I am writing to seek assistance regarding an issue I encountered while attempting to load vtk files. Specifically, I am trying to extract data from vtk files generated by athena simulations using the ds.load function. However, the code returned the following error message, Traceback (most recent call last): File "/home/wkal2/rds/hpc-work/project/code/plot.py", line 13, in <module> ds = yt.load(vtk_filename,parameters=parameters) File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/_maintenance/deprecation.py", line 69, in inner return func(*args, **kwargs) File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/loaders.py", line 144, in load return cls(fn, *args, **kwargs) File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/frontends/athena/data_structures.py", line 488, in __init__ Dataset.__init__( File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/data_objects/static_output.py", line 293, in __init__ self._parse_parameter_file() File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/frontends/athena/data_structures.py", line 572, in _parse_parameter_file self.domain_dimensions[2] = np.int32(1) ValueError: assignment destination is read-only I would greatly appreciate any insights you can provide on what might be causing this issue with the code. For your reference, I am using yt version 4.3.0. Thank you for your attention and I look forward to hearing from you! Best regards, Amelie Lam
Hi Amelie, Thanks for the report! I think I have a fix for you. I've just issued this pull request: https://github.com/yt-project/yt/pull/4815 If you're able to pull it and test, have a go, but otherwise, you can make the changes (which are small and self-contained) yourself to: /home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/frontends/athena/data_structures.py If it works for you, please report on the pull request and we can have it included -- or update to fix it. -Matt On Sat, Feb 10, 2024 at 7:54 PM A. Lam <wkal2@cam.ac.uk> wrote:
Dear yt Dev Team,
Hope this email finds you well! I am writing to seek assistance regarding an issue I encountered while attempting to load vtk files. Specifically, I am trying to extract data from vtk files generated by athena simulations using the ds.load function. However, the code returned the following error message,
Traceback (most recent call last):
File "/home/wkal2/rds/hpc-work/project/code/plot.py", line 13, in <module>
ds = yt.load(vtk_filename,parameters=parameters)
File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/_maintenance/deprecation.py", line 69, in inner
return func(*args, **kwargs)
File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/loaders.py", line 144, in load
return cls(fn, *args, **kwargs)
File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/frontends/athena/data_structures.py", line 488, in __init__
Dataset.__init__(
File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/data_objects/static_output.py", line 293, in __init__
self._parse_parameter_file()
File "/home/wkal2/ENTER/envs/ml/lib/python3.9/site-packages/yt/frontends/athena/data_structures.py", line 572, in _parse_parameter_file
self.domain_dimensions[2] = np.int32(1)
ValueError: assignment destination is read-only
I would greatly appreciate any insights you can provide on what might be causing this issue with the code. For your reference, I am using yt version 4.3.0. Thank you for your attention and I look forward to hearing from you!
Best regards,
Amelie Lam _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: matthewturk@gmail.com
Hi Matt, Many thanks for your help! I tried using the pull request, however, it is giving me another error message, which I have quoted below, Traceback (most recent call last): File "/home/wkal2/rds/hpc-work/project/code/plot_full_output.py", line 17, in <module> ds = yt.load(vtk_filename,parameters=parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/wkal2/yt/yt/_maintenance/deprecation.py", line 69, in inner return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/wkal2/yt/yt/loaders.py", line 145, in load return cls(fn, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/wkal2/yt/yt/frontends/athena/data_structures.py", line 502, in __init__ self.index File "/home/wkal2/yt/yt/data_objects/static_output.py", line 606, in index self._instantiated_index = self._index_class( ^^^^^^^^^^^^^^^^^^ File "/home/wkal2/yt/yt/frontends/athena/data_structures.py", line 134, in __init__ GridIndex.__init__(self, ds, dataset_type) File "/home/wkal2/yt/yt/geometry/geometry_handler.py", line 39, in __init__ self._setup_geometry() File "/home/wkal2/yt/yt/geometry/grid_geometry_handler.py", line 41, in _setup_geometry self._parse_index() File "/home/wkal2/yt/yt/frontends/athena/data_structures.py", line 335, in _parse_index self.dataset.domain_dimensions[2] = 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ ValueError: assignment destination is read-only Exception ignored in: <function GridIndex.__del__ at 0x1466b3fdb420> Traceback (most recent call last): File "/home/wkal2/yt/yt/geometry/grid_geometry_handler.py", line 67, in __del__ del self.grids ^^^^^^^^^^ AttributeError: 'AthenaHierarchy' object has no attribute 'grids' Thanks, Amelie
participants (3)
-
A. Lam
-
Matthew Turk
-
wkal2@cam.ac.uk