SciQLop / speasy

Space Physics made EASY! A simple Python package to deal with main Space Physics WebServices (CDA,SSC,AMDA,..)
Other
24 stars 7 forks source link

Scalar timeseries dimension #149

Open Beforerr opened 3 weeks ago

Beforerr commented 3 weeks ago

Description

The scalar timeseries data should only have one dimension. But ndim is 2. I am not sure if this is a bug or feature.

What I Did

products = "cda/THB_L2_MOM/thb_peim_densityQ"
timerage = ["2016-05-20T17:47:00", "2016-05-20T17:53:40"]
d = spz.get_data(products, timerage)
d.ndim == 2
jeandet commented 3 weeks ago

@Beforerr, yes this was a design choice I made at the beginning to be consistent with what Pandas does.

Beforerr commented 3 weeks ago

Thanks for explanation. Then is there any reliable way to tell one time series is of scalar type?

On Sun, Aug 18, 2024 at 2:59 PM Alexis Jeandet @.***> wrote:

@Beforerr https://github.com/Beforerr, yes this was a design choice I made at the beginning to be consistent with what Pandas does.

— Reply to this email directly, view it on GitHub https://github.com/SciQLop/speasy/issues/149#issuecomment-2295387953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOAN2QPWYFTZMK6VH7EGGRLZSEDJJAVCNFSM6AAAAABMWAQ3SWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGM4DOOJVGM . You are receiving this because you were mentioned.Message ID: @.***>

jeandet commented 3 weeks ago

I would say:

def is_scalar(v):
    return len(v.shape)==2 and v.shape[1]==1