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

BUG: min_level and max_level are not reliably set #4545

Closed
matthewturk opened this issue Jun 27, 2023 · 0 comments · Fixed by #4547
Closed

BUG: min_level and max_level are not reliably set #4545

matthewturk opened this issue Jun 27, 2023 · 0 comments · Fixed by #4547
Milestone

Comments

@matthewturk
Copy link
Member

Some of the handlers are not correctly setting max_level, which then propagates to things like ds.r[:]. For instance:

import yt
import numpy as np
oct_mask = np.zeros(33)
oct_mask[[0,  5,  7, 16]] = 8
octree_mask = np.array(oct_mask, dtype=np.uint8)
quantities = {}
quantities["gas", "density"] = np.random.random((29, 1))
bbox = np.array([[-10.0, 10.0], [-10.0, 10.0], [-10.0, 10.0]])

ds_octree = yt.load_octree(
        octree_mask=octree_mask,
        data=quantities,
        bbox=bbox,
        num_zones=1,
        partial_coverage=0,
)
#ds_octree.max_level = 10

print(ds_octree.r[:]["ones"])

This does not actually return anything! The array is empty, because the _selector that is created has a max_level that it inherits from the ds_octree, which is set to 0. Setting it to any value at or greater than the maximum level will work to get all the values.

This is kind of a big deal I think, and probably worth being a blocker. I don't know when this was introduced.

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

Successfully merging a pull request may close this issue.

2 participants