Skip to content

Commit

Permalink
define dtype for station info lat-lon
Browse files Browse the repository at this point in the history
  • Loading branch information
kgoebber committed Sep 12, 2023
1 parent c0826bc commit d378bf5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/metpy/io/station_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ def key_finder(df):

df['latitude'] = None
df['longitude'] = None
df = df.astype({'latitude': np.float64,
'longitude': np.float64})

if stn_var is None:
stn_var = key_finder(df)
for stn in df[stn_var].unique():
Expand Down
1 change: 1 addition & 0 deletions tests/io/test_station_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_add_lat_lon_station_data():
assert_almost_equal(df.loc[df.station == 'KDEN'].longitude.values[0], -104.65)
assert_almost_equal(df.loc[df.station == 'PAAA'].latitude.values[0], np.nan)
assert_almost_equal(df.loc[df.station == 'PAAA'].longitude.values[0], np.nan)
assert df['longitude'].dtype == np.float64


def test_add_lat_lon_station_data_optional():
Expand Down

0 comments on commit d378bf5

Please sign in to comment.