Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DMO examples to the documentation #1300

Closed
aikitori opened this issue May 27, 2024 · 6 comments · Fixed by #1315
Closed

Add DMO examples to the documentation #1300

aikitori opened this issue May 27, 2024 · 6 comments · Fixed by #1315

Comments

@aikitori
Copy link

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.:

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

https://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'"
}

https://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):

  • OS: [Linux Debian 12]

Additional context
Add any other context about the problem here.

@gutzbenj
Copy link
Member

gutzbenj commented May 29, 2024

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:

https://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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

aikitori commented Jun 3, 2024

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

  • Coverage
    • http localhost:7890/api/coverage
  • list of dmo stations
    • http localhost:7890/api/stations provider==dwd network==dmo parameter==temperature_air_mean_200 resolution==icon period==recent all==true
  • mosmix
    • ToDO
  • dmo icon data
    • ToDo http localhost :7890/api/values provider==dwd network==dmo parameter==temperature_air_mean_200 resolution==icon date== 2024-05-27 station=01001
    • ! station are dmo stations!

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
Copy link
Member

gutzbenj commented Jun 3, 2024

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

@gutzbenj
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants