KMarkert / GEOGloWS.jl

Julia package to request data from the GEOGloWS streamflow service API
https://kmarkert.github.io/GEOGloWS.jl/dev/
MIT License
2 stars 1 forks source link

api HistoricSimulation not found #2

Open kongdd opened 2 years ago

kongdd commented 2 years ago
using GEOGloWS
df = GEOGloWS.historic_simulation(26.1807, 91.7108)

I got the following error:

ERROR: HTTP.Exceptions.StatusError(404, "GET", "/api\\HistoricSimulation\\?return_format=csv&lat=26.1807&lon=91.7108", HTTP.Messages.Response:
"""
HTTP/1.1 404 Not Found
Date: Mon, 29 Aug 2022 18:49:17 GMT
Content-Type: application/json
Content-Length: 98
Connection: keep-alive
Access-Control-Allow-Origin: *
X-Cluster: efas-prod-cluster

{"error":"API Endpoint not found: /api\\HistoricSimulation\\ -> Check spelling and the API docs"}
""")
Stacktrace:
  [1] (::HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}})(stream::HTTP.Streams.Stream{HTTP.Messages.Response, HTTP.ConnectionPool.Connection}; status_exception::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
KMarkert commented 2 years ago

This is interesting...I tried it out locally and it worked:

julia> using GEOGloWS
julia> df = GEOGloWS.historic_simulation(26.1807, 91.7108)
15857×2 DataFrame
   Row │ datetime             streamflow_m^3/s
       │ DateTime             Float64
───────┼───────────────────────────────────────
     1 │ 1979-01-01T00:00:00           0.0
     2 │ 1979-01-02T00:00:00           3.41469
     3 │ 1979-01-03T00:00:00          26.3249
     4 │ 1979-01-04T00:00:00          68.7416
     5 │ 1979-01-05T00:00:00         121.594
     6 │ 1979-01-06T00:00:00         196.347
     7 │ 1979-01-07T00:00:00         320.986
     8 │ 1979-01-08T00:00:00         451.13
   ⋮   │          ⋮                  ⋮
 15850 │ 2022-05-24T00:00:00       45581.5
 15851 │ 2022-05-25T00:00:00       44243.7
 15852 │ 2022-05-26T00:00:00       43961.4
 15853 │ 2022-05-27T00:00:00       42890.6
 15854 │ 2022-05-28T00:00:00       39572.5
 15855 │ 2022-05-29T00:00:00       34668.8
 15856 │ 2022-05-30T00:00:00       30049.9
 15857 │ 2022-05-31T00:00:00       26715.1
                             15841 rows omitted

Also, the docs are showing the correct endpoint: https://geoglows.ecmwf.int/documentation#/default/get_HistoricSimulation_

The only thing I can think of is that this might be a small Windows issue in how the url is generated. I see \\ in the generated url for the query which I believe should be / which is making think it is a Windows thing. Which OS are you using?

kongdd commented 2 years ago

Thanks for your quick response, @KMarkert. I am using Windows. Really weird problem.

kongdd commented 2 years ago

Indeed, it is the problem of joinpath. This is my solution. Hope that helps. https://github.com/jl-spatial/GEOGloWS.jl/blob/main/src/tools.jl#L38-L39

kongdd commented 2 years ago

Hi @KMarkert,

Do you have any plan to immigrate VIC hydrology model into julia. If so, I can help.

I am the maintainer of VIC5 in R language https://github.com/rpkgs/VIC5. I gradually realized that R is hard to interface the C version VIC, and it is of low computing efficiency. Julia might be a better option.

Regards, Dongdong

KMarkert commented 2 years ago

Indeed, it is the problem of joinpath. This is my solution. Hope that helps. https://github.com/jl-spatial/GEOGloWS.jl/blob/main/src/tools.jl#L38-L39

Feel free to submit a pull request with your changes! Happy to have you contributions

KMarkert commented 2 years ago

Do you have any plan to immigrate VIC hydrology model into julia. If so, I can help.

I have thought about doing this but haven't had the time to tackle it. I agree Julia is a good language to do this with and feel it has a broader role to play in computational hydrology (fast but also interactive for science exploration). I thought about creating an org (i.e. JuliaHydrology) similar to JuliaGeo where hydrology models and code can live and others can contribute too. Let me know if that is of interest and I am happy to collaborate with you on it and try to build a community. Also, this kind of org would be a great place to have these kind of discussions

kongdd commented 2 years ago

This sounds great. I am glad to involve in.

Feel free to submit a pull request with your changes! Happy to have you contributions

About this issue, I will to submit as soon as possible.