earthobservations / wetterdienst

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

Add DMO examples to the documentation #1300

Closed aikitori closed 2 weeks ago

aikitori commented 1 month ago

Describe the bug I try to get dmo data via the restapi, but i don't now which combination of url-parmaters i should use

Are there any examples available, like here: https://wetterdienst.readthedocs.io/en/latest/usage/restapi.html

I can help writing some examples for the documentation, when i know how to do it.

I tryed the urls e.g.:

http://127.0.0.1:7890/api/values?provider=dwd&network=dmo&parameter=temperature_air_mean_200&resolution=hourly&date=2024-05-27

http://127.0.0.1:7890/api/values?provider=dwd&network=dmo&parameter=temperature_air_mean_200&resolution=hourly&date=2024-05-27&stations=4411

{
  "detail": "type object 'DwdDmoParameter' has no attribute 'SHORT'"
}

http://127.0.0.1:7890/api/values?provider=dwd&network=dmo&parameter=temperature_air_mean_200&date=2024-05-27&resolution=icon-eu&coordinates=52,8&rank=1 result:

{
  "detail": "invalid series dtype: expected `String`, got `null`"
}

To Reproduce Install vio docker-compose:

version: '3'
services:
  wetterdienst:
    image: ghcr.io/earthobservations/wetterdienst:0.84.0
    command: wetterdienst restapi --listen 0.0.0.0:7890
    restart: always
    ports:
      - "7890:7890"

enter url and hit enter

Expected behavior

Getting dmo/icon data

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

gutzbenj commented 1 month ago

Dear @aikitori ,

thanks for reporting this! There was an issue with the request class of DMO which is now fixed.

A possible request should look like this:

http://127.0.0.1:7890/api/values?provider=dwd&network=dmo&parameter=temperature_air_mean_200&resolution=icon&date=2024-05-27&station=01001

See that I am using icon as resolution (other option would be icon_eu) as DMO does have a fixed resolution but two different datasets for ICON/ICON-EU.

I'd be happy seeing a PR by you!

aikitori commented 1 month ago

Is there a reason, why there a spaces instead if slashes in th urls? And why there are double equal signs? sorry for asking, i'm not very familar sphinx and rst. i have check the docs. https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks

e.g. http localhost:7890/api/dwd/observation/values stations==1048,4411 parameter==kl resolution==daily period==recent

gutzbenj commented 1 month ago

First

I'm just seeing that those examples are outdated! Would you mind setting up another PR with updated examples?

E.g. stations call

http localhost:7890/api/dwd/observation/stations parameter==kl resolution==daily period==recent

should become

http localhost:7890/api/stations provider==dwd network==observation parameter==kl resolution==daily period==recent

values call

http localhost:7890/api/dwd/observation/values stations==1048,4411 parameter==kl resolution==daily period==recent

should become

http localhost:7890/api/values provider==dwd network==observation station==1048,4411 parameter==kl resolution==daily period==recent

Second

The examples you are seeing are based off of the library httpie (https://github.com/httpie/cli), that allows the user to make some really nice human looking requests. You see those == being used for GET request parameters while = would be used for a POST request sending data.

If you'd be up for the PR it would be good to have a link to httpie in the top.

What do you think?

aikitori commented 1 month ago

I can update all the links and add some new ones.

Yeah link to httpie should be good. Otherwiese, i like curl-command, which you can copy into the browser for scanning large result sets

gutzbenj commented 1 month ago

That'd be great! I agree with curl and is already installed on Linux, but I would just leave it as is.

gutzbenj commented 2 weeks ago

Just added the examples to the docs. Thanks again for the hint!