Ingenjorsarbete-For-Klimatet / ifk-smhi

SMHI climate data client.
https://ingenjorsarbeteforklimatet.se/ifk-smhi/
MIT License
8 stars 1 forks source link

fix data and _ mismatch line 169 #90

Closed docNord closed 5 months ago

docNord commented 5 months ago

Closes #89

mgcth commented 5 months ago

How do you call

https://github.com/Ingenjorsarbete-For-Klimatet/ifk-smhi/blob/403f521b920e9701babe3cd10085ae0b80ac298e/src/smhi/smhi.py#L131

to provoke the error reported in #89?

I can only manage to provoke another error from some non-thorough testing

c.get_data(2, 6057, interpolate=0)
docNord commented 5 months ago

How do you call

https://github.com/Ingenjorsarbete-For-Klimatet/ifk-smhi/blob/403f521b920e9701babe3cd10085ae0b80ac298e/src/smhi/smhi.py#L131

to provoke the error reported in #89?

I can only manage to provoke another error from some non-thorough testing

c.get_data(2, 6057, interpolate=0)

Hmm, that is odd. I now get an error from MetObs when calling any station. MetObs is complaining that "Datum" is not included in the output from the SMHI API. I dowloaded a file manually to see if the format has changed somehow, but that does not seem to be the case. Any ideas on what is going on @mgcth ?

docNord commented 5 months ago

Update: It seems there is a different return format specifically for parameter 2 @mgcth . I propose that you approve this PR and then we open a new issue to solve that problem. You should be able to recreate the issue reported with this code:

from smhi import smhi
s=smhi.SMHI()
data, _ = s.get_data(8,180960,interpolate=40)
mgcth commented 5 months ago

I'd like to reproduce the error here before I approve. How should I call get_data to reproduce the issue in #89 which you are fixing here?

docNord commented 5 months ago

Did you try the snippet in my previous comment @mgcth ?

mgcth commented 5 months ago

Sorry, missed it. Do we have tests for this function? Looks like we don't. I'm thinking, it's probably a good time to add a unit test for it here. Though, the function is somewhat complex and could be refactored.