DedalusProject / dedalus

A flexible framework for solving PDEs with modern spectral methods.
http://dedalus-project.org/
GNU General Public License v3.0
489 stars 115 forks source link

dist.remedy_scales broken for ndarrays #279

Closed csskene closed 7 months ago

csskene commented 7 months ago

After updating to the newest version of Dedalus I am getting the following error when using load_from_hdf5

Traceback (most recent call last):
  File ".../load_from/rb.py", line 94, in <module>
    state_variable.load_from_hdf5(file,0)
  File ".../opt/miniconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/field.py", line 710, in load_from_hdf5
    self.load_from_global_grid_data(dset, pre_slices=(index,))
  File ".../opt/miniconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/field.py", line 718, in load_from_global_grid_data
    self.preset_scales(scales)
  File ".../opt/miniconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/field.py", line 481, in preset_scales
    new_scales = self.dist.remedy_scales(scales)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../opt/miniconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/distributor.py", line 190, in remedy_scales
    if 0 in scales:
       ^^^^^^^^^^^
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I'm wondering if something has changed with scales or the distributor to cause this. Thanks!

kburns commented 7 months ago

Thanks, this should be fixed with https://github.com/DedalusProject/dedalus/commit/d2532390b6164e537b9dc41bea359860abac6c83.