Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error from etc/plot.py #12

Open
hjjvandam opened this issue Dec 15, 2023 · 10 comments
Open

Error from etc/plot.py #12

hjjvandam opened this issue Dec 15, 2023 · 10 comments

Comments

@hjjvandam
Copy link
Contributor

hjjvandam commented Dec 15, 2023

I am trying etc/plot.py to extract ExaEpi results. I have update AMReX, ExaEpi, and installed yt from source. But I still get the error:

(pyamrex) [hvandam@lpo-170127 plt00000]$ python ../../../etc/plot.py .
yt : [INFO     ] 2023-12-15 13:37:25,009 Parameters: current_time              = 0.0
yt : [INFO     ] 2023-12-15 13:37:25,009 Parameters: domain_dimensions         = [150 149   1]
yt : [INFO     ] 2023-12-15 13:37:25,009 Parameters: domain_left_edge          = [0. 0. 0.]
yt : [INFO     ] 2023-12-15 13:37:25,009 Parameters: domain_right_edge         = [1. 1. 1.]
Traceback (most recent call last):
  File "/home/hvandam/Documents/AMReX/ExaEpi/examples/test-pbar+1/plt00000/../../../etc/plot.py", line 10, in <module>
    ad = ds.all_data()
         ^^^^^^^^^^^^^
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/data_objects/static_output.py", line 1194, in all_data
    self.index
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/data_objects/static_output.py", line 606, in index
    self._instantiated_index = self._index_class(
                               ^^^^^^^^^^^^^^^^^^
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/frontends/boxlib/data_structures.py", line 926, in __init__
    super().__init__(ds, dataset_type)
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/frontends/boxlib/data_structures.py", line 345, in __init__
    GridIndex.__init__(self, ds, dataset_type)
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/geometry/geometry_handler.py", line 42, in __init__
    self._setup_data_io()
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/frontends/boxlib/data_structures.py", line 568, in _setup_data_io
    self.io = io_registry[self.dataset_type](self.dataset)
              ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'boxlib_native'
(pyamrex) [hvandam@lpo-170127 plt00000]$ 

As far as I can see boxlib is much more common that boxlib_native but I don't know enough about the details to be able to judge how similar these keys are.

@atmyers
Copy link
Member

atmyers commented Dec 19, 2023

Hi @hjjvandam, I just tried this and couldn't reproduce the error with my version of yt. What is the output of the yt version command for you? Also, if you go to the yt source code, what is the git hash of the code you built?

Thanks,
Andrew

@hjjvandam
Copy link
Contributor Author

Hi @atmyers,
Thanks for looking into this. Running "yt version" gives "Version = 4.3.0".
Running "git rev-parse --short HEAD" in the "yt" repo gives "e8d92aeb8".
Huub

@atmyers
Copy link
Member

atmyers commented Dec 20, 2023

Oh, I see the issue. The version is fine, but could you try running it one directory back, so that plt00000 is in the directory you run plot.py from?

@hjjvandam
Copy link
Contributor Author

hjjvandam commented Dec 20, 2023 via email

@atmyers
Copy link
Member

atmyers commented Dec 20, 2023

You should run it one directory back from that, so from /home/hvandam/Documents/AMReX/ExaEpi/examples/test-pbar+1/ in the above example.

@hjjvandam
Copy link
Contributor Author

OK, unfortunately that doesn't change much:

(pyamrex) [hvandam@lpo-170127 test-pbar+1]$ python ../../etc/plot.py plt00000
yt : [INFO     ] 2023-12-20 22:13:37,759 Parameters: current_time              = 0.0
yt : [INFO     ] 2023-12-20 22:13:37,759 Parameters: domain_dimensions         = [150 149   1]
yt : [INFO     ] 2023-12-20 22:13:37,759 Parameters: domain_left_edge          = [0. 0. 0.]
yt : [INFO     ] 2023-12-20 22:13:37,759 Parameters: domain_right_edge         = [1. 1. 1.]
Traceback (most recent call last):
  File "/home/hvandam/Documents/AMReX/ExaEpi/examples/test-pbar+1/../../etc/plot.py", line 10, in <module>
    ad = ds.all_data()
         ^^^^^^^^^^^^^
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/data_objects/static_output.py", line 1194, in all_data
    self.index
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/data_objects/static_output.py", line 606, in index
    self._instantiated_index = self._index_class(
                               ^^^^^^^^^^^^^^^^^^
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/frontends/boxlib/data_structures.py", line 926, in __init__
    super().__init__(ds, dataset_type)
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/frontends/boxlib/data_structures.py", line 345, in __init__
    GridIndex.__init__(self, ds, dataset_type)
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/geometry/geometry_handler.py", line 42, in __init__
    self._setup_data_io()
  File "/home/hvandam/pyamrex/lib64/python3.11/site-packages/yt/frontends/boxlib/data_structures.py", line 568, in _setup_data_io
    self.io = io_registry[self.dataset_type](self.dataset)
              ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'boxlib_native'
(pyamrex) [hvandam@lpo-170127 test-pbar+1]$

@hjjvandam
Copy link
Contributor Author

Hmmm, it seems like I have a mixture of yt-4.4.dev0 and yt-4.3.0 on my machine. That could cause trouble I guess. Let me create a new and clean Python environment and see how that goes.

@hjjvandam
Copy link
Contributor Author

OK, rebuilding the environment from scratch did not fix the issue either. The one thing that does is to add

from yt.frontends.boxlib.api import (
    AMReXDataset,
    CastroDataset,
    MaestroDataset,
    NyxDataset,
    OrionDataset,
    WarpXDataset,
)

to yt/__init__.py. In ExaEpi/etc/plot.py I then just need to change line 16 to change the shape so that the size matches the size of ad["total"] and it all works. One thing I don't understand is why line 2 in plot.py does not sort the boxlib_native thing out. I.e. what is the difference between importing from yt.frontends.boxlib.data_structures and from yt.frontends.boxlib.api?

@hjjvandam
Copy link
Contributor Author

OK, so changing line 2 in plot.py from

from yt.frontends.boxlib.data_structures import AMReXDataset

to

from yt.frontends.boxlib.api import AMReXDataset

without the changes to the yt/__init__.py also fixes the issue. Shall I generate a pull request for that change?

@atmyers
Copy link
Member

atmyers commented Dec 22, 2023

Yes, could you make that change please?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants