cfs-energy / radas

Simple Python module to calculate radiation curves from OpenADAS
MIT License
4 stars 3 forks source link

Numpy 2.0 Error #11

Closed allen-adastra closed 3 months ago

allen-adastra commented 3 months ago

I tried:

python3 -m pip install radas
radas -d ./radas_dir

in an env with Numpy 2.0, and it lead to this error:

ipdb>     evaluation_times = np.logspace(
        np.log10(magnitude(convert_units(dataset.evolution_start, ureg.s))),
        np.log10(magnitude(convert_units(dataset.evolution_stop, ureg.s))),
    )

*** ValueError: dimensions () must have the same length as the number of data dimensions, ndim=1
ipdb> np.log10(magnitude(convert_units(dataset.evolution_start, ureg.s)))
<xarray.DataArray 'evolution_start' ()> Size: 8B
array(-8.)
Coordinates:
    dim_evolution_start  float64 8B 1e-08
    dim_evolution_stop   float64 8B 100.0
Attributes:
    units:    second
ipdb> np.log10(magnitude(convert_units(dataset.evolution_stop, ureg.s)))
<xarray.DataArray 'evolution_stop' ()> Size: 8B
array(2.)
Coordinates:
    dim_evolution_start  float64 8B 1e-08
    dim_evolution_stop   float64 8B 100.0
Attributes:
    units:    second
ipdb> 

Downgrading Numpy with the following command solved the issue:

python3 -m pip install "numpy<2.0"
allen-adastra commented 3 months ago

Likely this issue: https://github.com/pydata/xarray/issues/9043

tbody-cfs commented 3 months ago

Can you try the latest main and see if this fixes the issue? Suggest: closed in #10