Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
beautifulsoup4==4.14.3
numpy==2.4.2
pandas==2.3.3
pandas==3.0.1
protobuf==6.33.5
requests==2.32.5
5 changes: 2 additions & 3 deletions src/siphon/simplewebservice/ndbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,11 @@ def _parse_cwind(content):
df['gust_direction'] = df['gust_direction'].replace(999, np.nan)
df['wind_gust'] = df['wind_gust'].replace(99.0, np.nan)
df['time'] = pd.to_datetime(df[['year', 'month', 'day', 'hour', 'minute']], utc=True)
df['hours'] = np.floor(df['gust_time'] / 100)
df['hours'] = df['gust_time'] // 100
df['minutes'] = df['gust_time'] - df['hours'] * 100
df['hours'] = df['hours'].replace(99, np.nan)
df['minutes'] = df['minutes'].replace(99, np.nan)
df['gust_time'] = pd.to_datetime(df[['year', 'month', 'day', 'hours', 'minutes']],
utc=True)
df['gust_time'] = df['gust_time'].where(df['hours'] != 99, pd.NaT)
df = df.drop(columns=['year', 'month', 'day', 'hour', 'minute',
'hours', 'minutes'])
with warnings.catch_warnings():
Expand Down
2 changes: 2 additions & 0 deletions tests/test_ndbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import numpy as np
from numpy.testing import assert_almost_equal, assert_equal
import pandas as pd
import pytest

from siphon.http_util import utc
Expand Down Expand Up @@ -93,6 +94,7 @@ def test_ndbc_realtime_cwind():
assert_almost_equal(df['wind_gust'][0], 9.0, 1)
assert df['gust_time'][0] == datetime(2018, 8, 1, 14, 49, 0, tzinfo=utc)
assert df['time'][0] == datetime(2018, 8, 1, 14, 50, 0, tzinfo=utc)
assert pd.isna(df['gust_time'][1])

assert df.units['wind_direction'] == 'degrees'
assert df.units['wind_speed'] == 'meters/second'
Expand Down