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

api.nearest_station() returning different results when using floats or strings #48

Closed
ks905383 opened this issue Nov 13, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ks905383
Copy link

ks905383 commented Nov 13, 2024

I tried grabbing a buoy close to NYC, and it seems like the nearest_station function returns different results when specifying lat/lon as floats instead of as strings.

from ndbc_api import NdbcApi

api = NdbcApi()

# Testing closest buoy to NYC
# Using string representation (returns Station 44025 on Long Island, correctly) 
print(api.station(station_id=api.nearest_station(lat='40N',lon='73W')))

# Using float representation (both return Station 46070 in the Bering Sea, incorrectly)
print(api.station(station_id=api.nearest_station(lat=40,lon=-73)))
print(api.station(station_id=api.nearest_station(lat=40,lon=180+(180-73))))

(I believe a similar issue happens in the example notebook, with the station by 38.88N, 76.43W identified as tplm2 when using strings, 23226 when using floats)

This is related to JOSS review openjournals/joss-reviews#7406

@CDJellen
Copy link
Owner

Thank you for opening this issue @ks905383 ; I will validate the handling of float-valued latitudes and longitudes shortly. This is likely a failure to properly handle East West conventions when querying the NDBC data service.

I'll work to have a fix in place and a new release up over the next few days.

@CDJellen CDJellen self-assigned this Nov 13, 2024
@CDJellen CDJellen added the bug Something isn't working label Nov 13, 2024
@ks905383
Copy link
Author

Apologies, this actually seems to have been fixed with the latest version.

I had python==3.13.0 in the environment I was testing this in, so pip and conda installed an older version instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants