Skip to content

Commit 708fb7f

Browse files
committed
fix #62, again
1 parent b44a579 commit 708fb7f

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/synoptic/json_parsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def station_metadata_to_dataframe(STATION: list[dict]):
9292
df = df.with_columns(
9393
pl.col("STID").cast(pl.String),
9494
pl.col("ID", "MNET_ID").cast(pl.UInt32),
95-
pl.col("ELEVATION", "LATITUDE", "LONGITUDE").cast(pl.Float64),
95+
pl.col("ELEVATION", "LATITUDE", "LONGITUDE").str.strip_chars().cast(pl.Float64),
9696
is_active=pl.when(pl.col("STATUS") == "ACTIVE")
9797
.then(True)
9898
.otherwise(pl.when(pl.col("STATUS") == "INACTIVE").then(False)),

tests/test_services/test_TimeSeries.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,17 @@ def test_utah_ozone():
9090
vars="ozone_concentration",
9191
).df()
9292
assert len(df)
93+
94+
95+
def test_convert_LATITUDE_with_white_space():
96+
"""Test cast LATITUDE data to float when white space is present.
97+
98+
The value " 42.870000" is present in this test case.
99+
"""
100+
df = TimeSeries(
101+
bbox=[-90, 40, -85, 44],
102+
start=datetime(2024, 8, 24, 00, 00, 00),
103+
end=datetime(2024, 8, 24, 1, 00, 00),
104+
).df()
105+
106+
assert len(df)

0 commit comments

Comments
 (0)