Closed stevavoulo closed 3 years ago
hi stevavoulo, the get_nearest_station function takes longitude as the first argument and latitude as the second. so just use station, dist = ismn_data.collection.get_nearest_station(-124.31575, 47.53786)
.
Maybe it wouldn't be bad idea to have a warning in case the input is nonsensical (like a latitude of -124°) @wpreimes @TUW-GEO/pygeogrids-developer?
sure, please go ahead @daberer and implement it. The ISMN_Interface class and functions should be as responsive as possible I think.
@stevavoulo please let us know if there is still a problem, otherwise we will close this issue when the warning is in place.
thank you very much. Problem solved.
Great. Thanks for confirming.
I seem to get only station Weslaco even if I change the coordinates to a different place...
from ismn.interface import ISMN_Interface import numpy as np import matplotlib.pyplot as plt %matplotlib inline
Either a .zip file or one folder that contains all networks
data_path = "F:\RainfallRunoff\Data_separate_files_header_19800101_20141231_8943_9sUo_20210606.zip" ismn_data = ISMN_Interface(data_path)
import pandas as pd grid = ismn_data.collection.grid gpis, lons, lats = grid.get_grid_points() pd.DataFrame(index=pd.Index(gpis, name='gpi'), data={'lon': lons, 'lat': lats}).T
station, dist = ismn_data.collection.get_nearest_station(47.53786,-124.31575) print(f'Station {station.name} is {int(dist)} metres away from the passed coordinates:') assert ismn_data.collection.station4gpi(0) == station # same result when selecting with GPI station
_Station Weslaco is 8741467 metres away from the passed coordinates: assert ismn_data.collection.station4gpi(0) == station # same result when selecting with GPI Traceback (most recent call last):
File "", line 1, in
assert ismn_data.collection.station4gpi(0) == station # same result when selecting with GPI
AssertionError_