Closed JohannaSte closed 3 years ago
Dear Johanna,
thanks for reporting this and for using Wetterdienst.
While we tried hard to reproduce your observations, we are not able to see any problems on our end. As we are still regularly refining our API, the most likely cause that something croaks on your end is that you might be using an outdated example program.
So, I want to humbly ask you to verify MOSMIX data acquisition with Wetterdienst 0.11.1 using the example program matching the respective version [1].
In order to make sure the example programs are always valid, we recently started to include them into the test harness which is checking the whole code base in order to be confident that we don't put out releases with wrong code examples - it happened before and we are always aiming to get better.
Please let us know if this will already resolve the issue for you. While we are sorry that things might regularly break while we are still on 0.xx versions, we are still committed to make our users happy and listen to them.
With kind regards, Andreas.
[1] https://github.com/earthobservations/wetterdienst/blob/v0.11.1/example/mosmix_forecasts.py
Hi again,
if my suggestion to use the respective example program won't help, please try to purge the local cache folder of Wetterdienst. You can find its location by invoking
python -c 'import appdirs; print(appdirs.user_cache_dir(appname="wetterdienst"))'
We are seeing different problems with the current cache implementation and will replace it by a better alternative within one of the next iterations, see also #243.
With kind regards, Andreas.
Dear Johanna, it seems you were running roughly such kind of code sample
from wetterdienst.dwd.forecasts.metadata.dates import DWDForecastDate
from wetterdienst.dwd.forecasts import DWDMosmixData, DWDMosmixType
from wetterdienst.util.cli import setup_logging
mosmix = DWDMosmixData(
station_ids=["01001", "01008"],
parameters=["DD", "ww"],
start_date=DWDForecastDate.LATEST, # automatically set if left empty
mosmix_type=DWDMosmixType.LARGE,
tidy_data=True,
humanize_column_names=True,
)
response = mosmix.collect_data()
print(response.metadata)
The collect_data method is written as a generator, which means it returns chunk by chunk of whatever was requested. This behavior is mainly to reduce occupied RAM which may by full at some point. To use the generator there are two main options which are
respose = next(mosmix.collect_data())
which would return only one next chunk. To draft all data coming from the generator you may instead use the iterator in to go through the whole generator and return whatever is found e.g.
for response in mosmix.collect_data():
print(response.metadata)
I hope that those two code samples will fix your problem and if not please come back to us.
Hey everyone,
I was trying to get the mosmix data in Python using your example. It states the following:
I was running the code of the mosmix_forecasts.py in the example folder.
Desktop:
Any ideas what goes wrong or how I could fix it?
Best regards