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

CDA inventory problems with underscores #94

Closed jgieseler closed 8 months ago

jgieseler commented 1 year ago

Description

It seems to me that the CDA inventory has problems obtaining data if there are _ in the name. At some point, they are transformed into -, and then they are not recognized any more.

What I Did

>>> import speasy as spz
>>> cda_tree = spz.inventories.data_tree.cda
>>> solo_swa = spz.get_data(cda_tree.Solar_Orbiter.SOLO.SWA_PAS.SOLO_L2_SWA_PAS_GRND_MOM, "2021-11-3", "2021-11-4")
ValueError: Unknown parameter: SOLO_L2_SWA-PAS-GRND-MOM
>>> solo_ept = spz.get_data(cda_tree.Solar_Orbiter.SOLO.EPD_EPT_NORTH_RATES.SOLO_L2_EPD_EPT_NORTH_RATES, "2021-11-3", "2021-11-4")
ValueError: Unknown parameter: SOLO_L2_EPD-EPT-NORTH-RATES
jeandet commented 1 year ago

@jgieseler, I thought at first that it was a regression, but you are trying to get a dataset from CDAWeb, this is not supported for CDAWeb with Speasy. The error message is misleading, I have to improve this.

In [6]: cda_tree.Solar_Orbiter.SOLO.SWA_PAS.SOLO_L2_SWA_PAS_GRND_MOM.N
Out[6]: <ParameterIndex: N>

In [7]: cda_tree.Solar_Orbiter.SOLO.SWA_PAS.SOLO_L2_SWA_PAS_GRND_MOM
Out[7]: <DatasetIndex: SOLO_L2_SWA_PAS_GRND_MOM>

In [8]: cda_tree.Solar_Orbiter.SOLO.EPD_EPT_NORTH_RATES.SOLO_L2_EPD_EPT_NORTH_RATES
Out[8]: <DatasetIndex: SOLO_L2_EPD_EPT_NORTH_RATES>

It works with a parameter as expected:

In [3]: solo_swa = spz.get_data(cda_tree.Solar_Orbiter.SOLO.SWA_PAS.SOLO_L2_SWA_PAS_GRND_MOM.N, "2021-11-3", "2021-11-4")

In [4]: solo_swa
Out[4]: <speasy.products.variable.SpeasyVariable at 0x7f3c6c81c340>
jgieseler commented 1 year ago

Oh, that's good to know! I just assumed CDAWeb would work the same way as for AMDA. But yes, a clear error message should be enough for starters.