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

Should getWindAt return twd in radians or degrees? And potential related problems with concurrency. #12

Open
kingkong-cmd opened this issue Sep 21, 2024 · 5 comments

Comments

@kingkong-cmd
Copy link

Hi,

I've been playing around with this a bit, but got a bit confused about the getWindAt() function. It says in "docs" that twd should be in radians, but then I see this code where you use math.radians(twd) on the twd returned from getWindAt(). math.radians() converts degrees to radians, no?

Secondly, even if i change getWindAt to return twd in degrees, the twd in the Isopoint in the results are really small (like e-37) which makes me think there might be something wrong with the concurrency where it recursively does math.radians(twd) until it becomes really small in the end.

Any chance you are willing to take a look?

LINE  247 in routing.py
try:
    (twd, tws) = self.grib.getWindAt(t, p.pos[0], p.pos[1])
except Exception as e:
    raise RoutingNoWindException() from e

for twa in range(-180, 180, 5):
    twa = math.radians(twa)
    twd = math.radians(twd)
    brg = utils.reduce360(twd + twa)
@dakk
Copy link
Owner

dakk commented Sep 23, 2024

GetWindAt should returns degrees, I fixed it.

Regarding the second problem, can you please code a minimal example reproducing the issue?

@kingkong-cmd
Copy link
Author

Not sure what code to show, since it was basically just following the example in docs. But maybe it was not the concurrency, but instead my incorrect use of (lon, lat) that messed up the twds. If its working for you its probably just a me-problem.

@dakk
Copy link
Owner

dakk commented Sep 24, 2024

I wasn't saying I'm not having the problem (I didn't tried the example in the docs); but if you provide me the code you are running I can verify if it happen in my env, and if so I'm able to fix and verify it.

@dakk dakk reopened this Sep 24, 2024
@kingkong-cmd
Copy link
Author

Ok, I will try to reproduce and get back to you. PS. I didn't mean literally following the example, since I used my own getwindat, and a self made track when this happened.

@dakk
Copy link
Owner

dakk commented Sep 24, 2024

Oki thanks; anyway, try to reduce your code to the minimum needed to reproduce the issue (y)

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

No branches or pull requests

2 participants