earthobservations / wetterdienst

Open weather data for humans.
https://wetterdienst.readthedocs.io/
MIT License
358 stars 55 forks source link

Length mismatch: Expected axis has 33 elements, new values have 6 elements #964

Closed a-schiffer closed 1 year ago

a-schiffer commented 1 year ago
from wetterdienst.provider.dwd.mosmix import DwdMosmixRequest, DwdMosmixType
allstations = DwdMosmixRequest(parameter='small', mosmix_type=DwdMosmixType.SMALL, start_date='2023-06-23', end_date='2023-06-25')
stations = allstations.filter_by_station_id(station_id=['K2920'])

This code worked fine until six hours ago. Now the last command ("filter_by_station_id()") throws the exception "Length mismatch: Expected axis has 33 elements, new values have 6 elements". I assume that the DWD data format has changed slightly.

The call stack is

  File "wetterdienst\core\timeseries\request.py", line 641, in filter_by_station_id
    df = self.all().df
  File "wetterdienst\core\timeseries\request.py", line 621, in all
    df = self._all().copy().reset_index(drop=True)
  File "wetterdienst\provider\dwd\mosmix\api.py", line 510, in _all
    df.columns = [
  File "pandas\core\generic.py", line 5915, in __setattr__
    return object.__setattr__(self, name, value)
  File "pandas\_libs\properties.pyx", line 69, in pandas._libs.properties.AxisProperty.__set__
  File "pandas\core\generic.py", line 823, in _set_axis
    self._mgr.set_axis(axis, labels)
  File "pandas\core\internals\managers.py", line 230, in set_axis
    self._validate_set_axis(axis, new_labels)
  File "pandas\core\internals\base.py", line 70, in _validate_set_axis
    raise ValueError(
ValueError: Length mismatch: Expected axis has 33 elements, new values have 6 elements

I hope you can reproduce and fix it. Thanks in advance.

mark-feldmann commented 1 year ago

Same error message here for different input of stations. Is there a work around until we get a fix?

kumamt commented 1 year ago

I also got the same error message:

ValueError: Length mismatch: Expected axis has 33 elements, new values have 6 elements

TobiasBraeutigam commented 1 year ago

For me it is already working again. I guess it was some issue @ DWD.

a-schiffer commented 1 year ago

For me, it fails 3 or 4 times with the mentioned exception, then it works again once or twice, but after that it starts failing again...

amotl commented 1 year ago

Hi. We did not find time to investigate yet, but from your reports, it indeed sounds like an intermittent issue. For some of you, clearing the cache may resolve the issue thoroughly. Please let us know if it keeps persisting. Thank you.

On 23 June 2023 17:07:24 CEST, a-schiffer @.***> wrote:

For me, it fails 3 or 4 times with the mentioned exception, then it works again once or twice, but after that it starts failing again...

-- Reply to this email directly or view it on GitHub: https://github.com/earthobservations/wetterdienst/issues/964#issuecomment-1604419417 You are receiving this because you are subscribed to this thread.

Message ID: @.***> -- Sent from my mind. This might have been typed on a mobile device, so please excuse my brevity.

a-schiffer commented 1 year ago

The problem didn't show up anymore in the last two days...

gutzbenj commented 1 year ago

@a-schiffer lucky us! We had few situations where the schema of the station listing changed in the past and we would obviously try to push an updated version of wetterdienst that respects the new schema asap! Thanks for reporting anyway! Closing this for now.