LBL-EESA / fastkde

Other
52 stars 11 forks source link

xarray fails for 1D #35

Closed taobrienlbl closed 6 months ago

taobrienlbl commented 6 months ago

in v2.0.0, xarray fails when applied to 1D data.

Consider the following simple test:

import numpy as np
from scipy import stats
import fastkde

def test_simple_1D_with_xarray():
    np.random.seed(42)
    N = int(2e5)
    var1 = 50 * np.random.normal(size=N) + 0.1

    # Do the self-consistent density estimate
    myPDF = fastkde.pdf(var1, use_xarray=True)

Expected: pass when running pytest with the above test

Actual: ValueError: dimension 'var0' already exists as a scalar variable