noaaplotter 1.1.1__tar.gz → 1.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/PKG-INFO +2 -2
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/README.md +1 -1
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/figures/plotly_daily.py +9 -3
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter.egg-info/PKG-INFO +2 -2
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/pyproject.toml +1 -1
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/tests/test_plotly_figures.py +43 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/LICENSE +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/__init__.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/__main__.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/cli/__init__.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/figures/__init__.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/figures/plotly_heatmap.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/figures/plotly_monthly.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/figures/plotly_stripes.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/noaaplotter.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/scripts/download_data.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/scripts/plot_daily.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/scripts/plot_monthly.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/sources/__init__.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/sources/base.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/sources/cds.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/sources/open_meteo.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/utils/__init__.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/utils/config.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/utils/dataset.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/utils/download_utils.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/utils/plot_utils.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter/utils/utils.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter.egg-info/SOURCES.txt +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter.egg-info/dependency_links.txt +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter.egg-info/entry_points.txt +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter.egg-info/requires.txt +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/noaaplotter.egg-info/top_level.txt +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/setup.cfg +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/tests/test_cds_source.py +0 -0
- {noaaplotter-1.1.1 → noaaplotter-1.1.2}/tests/test_polars_parity.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: noaaplotter
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: Package to plot fancy climate/weather data of NOAA
|
|
5
5
|
Author-email: Ingmar Nitze <ingmar.nitze@awi.de>
|
|
6
6
|
License: MIT
|
|
@@ -45,7 +45,7 @@ A python package to create fancy plots with NOAA weather data (stations) and ERA
|
|
|
45
45
|
|
|
46
46
|
<p align="center">
|
|
47
47
|
<a href="https://pypi.org/project/noaaplotter/">
|
|
48
|
-
<img src="https://img.shields.io/badge/version-v1.1.
|
|
48
|
+
<img src="https://img.shields.io/badge/version-v1.1.2-31ad52" alt="version">
|
|
49
49
|
</a>
|
|
50
50
|
<a href="https://pypi.org/project/noaaplotter/">
|
|
51
51
|
<img src="https://img.shields.io/pypi/pyversions/noaaplotter" alt="Python versions">
|
|
@@ -3,7 +3,7 @@ A python package to create fancy plots with NOAA weather data (stations) and ERA
|
|
|
3
3
|
|
|
4
4
|
<p align="center">
|
|
5
5
|
<a href="https://pypi.org/project/noaaplotter/">
|
|
6
|
-
<img src="https://img.shields.io/badge/version-v1.1.
|
|
6
|
+
<img src="https://img.shields.io/badge/version-v1.1.2-31ad52" alt="version">
|
|
7
7
|
</a>
|
|
8
8
|
<a href="https://pypi.org/project/noaaplotter/">
|
|
9
9
|
<img src="https://img.shields.io/pypi/pyversions/noaaplotter" alt="Python versions">
|
|
@@ -334,12 +334,18 @@ def make_daily_figure(df_obs, x_dates, x_dates_short, y_clim, y_clim_hi, y_clim_
|
|
|
334
334
|
" - %{customdata[1]:.1f} m/s<extra>WIND</extra>"
|
|
335
335
|
)
|
|
336
336
|
custom = list(zip(np.round(wdir, 0), np.round(wspd, 1)))
|
|
337
|
-
# per-dot rgb fill (no colorscale on the trace -> NO colorbar)
|
|
337
|
+
# per-dot rgb fill (no colorscale on the trace -> NO colorbar).
|
|
338
|
+
# plotly rejects None elements in a marker.color LIST ("Invalid
|
|
339
|
+
# element(s) received for the 'color' property of scatter.marker"),
|
|
340
|
+
# so missing-speed dots use a fully transparent colour instead.
|
|
338
341
|
fill = [
|
|
339
|
-
|
|
342
|
+
"rgba(0,0,0,0)" if not np.isfinite(v) else _scale_color(scale, v / vmax)
|
|
340
343
|
for v in wspd
|
|
341
344
|
]
|
|
342
|
-
outline = [
|
|
345
|
+
outline = [
|
|
346
|
+
"rgba(0,0,0,0)" if c == "rgba(0,0,0,0)" else _dark_rgb(c)
|
|
347
|
+
for c in fill
|
|
348
|
+
]
|
|
343
349
|
fig.add_trace(go.Scatter(
|
|
344
350
|
x=dates, y=list(pd.Series(wdir).where(pd.notna(wdir))),
|
|
345
351
|
mode="lines+markers", name="WIND",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: noaaplotter
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: Package to plot fancy climate/weather data of NOAA
|
|
5
5
|
Author-email: Ingmar Nitze <ingmar.nitze@awi.de>
|
|
6
6
|
License: MIT
|
|
@@ -45,7 +45,7 @@ A python package to create fancy plots with NOAA weather data (stations) and ERA
|
|
|
45
45
|
|
|
46
46
|
<p align="center">
|
|
47
47
|
<a href="https://pypi.org/project/noaaplotter/">
|
|
48
|
-
<img src="https://img.shields.io/badge/version-v1.1.
|
|
48
|
+
<img src="https://img.shields.io/badge/version-v1.1.2-31ad52" alt="version">
|
|
49
49
|
</a>
|
|
50
50
|
<a href="https://pypi.org/project/noaaplotter/">
|
|
51
51
|
<img src="https://img.shields.io/pypi/pyversions/noaaplotter" alt="Python versions">
|
|
@@ -259,6 +259,49 @@ def test_wind_row_present_when_wspd_wdir_exist(tmp_path):
|
|
|
259
259
|
assert str(wind.marker.color[0]).startswith("rgb(")
|
|
260
260
|
|
|
261
261
|
|
|
262
|
+
def test_wind_gap_days_use_transparent_color(tmp_path):
|
|
263
|
+
# Regression: WSPD has null days (ERA5 windows). marker.color is a LIST,
|
|
264
|
+
# and plotly rejects None elements there ("Invalid element(s) received
|
|
265
|
+
# for the 'color' property of scatter.marker"). Missing-speed dots must
|
|
266
|
+
# use a fully transparent rgb colour instead, fill AND outline alike.
|
|
267
|
+
import numpy as np
|
|
268
|
+
import pandas as pd
|
|
269
|
+
|
|
270
|
+
dates = pd.date_range("1981-01-01", "2010-12-31", freq="D")
|
|
271
|
+
rng = np.random.default_rng(11)
|
|
272
|
+
wspd = rng.exponential(4, dates.size) + 0.5
|
|
273
|
+
wdir = rng.uniform(0, 360, dates.size).round()
|
|
274
|
+
mask = (dates >= pd.Timestamp("2009-03-01")) & (dates < pd.Timestamp("2009-03-10"))
|
|
275
|
+
wspd = np.where(mask, np.nan, wspd) # wind-less stretch INSIDE the window
|
|
276
|
+
wdir = np.where(mask, np.nan, wdir)
|
|
277
|
+
df = pd.DataFrame({
|
|
278
|
+
"STATION": "GHCND:TEST04",
|
|
279
|
+
"NAME": "Synthetic",
|
|
280
|
+
"DATE": dates.strftime("%Y-%m-%d"),
|
|
281
|
+
"TMAX": rng.normal(10, 5, dates.size),
|
|
282
|
+
"TMIN": rng.normal(0, 5, dates.size),
|
|
283
|
+
"TAVG": None,
|
|
284
|
+
"PRCP": rng.poisson(1, dates.size).astype(float),
|
|
285
|
+
"SNOW": None,
|
|
286
|
+
"WSPD": wspd,
|
|
287
|
+
"WDIR": wdir,
|
|
288
|
+
})
|
|
289
|
+
path = tmp_path / "wind_gaps.parquet"
|
|
290
|
+
df.to_parquet(path)
|
|
291
|
+
|
|
292
|
+
n = NOAAPlotter(str(path), location="Synthetic")
|
|
293
|
+
# before the fix this raised a plotly ValidationError on None colours
|
|
294
|
+
fig = n.plot_weather_series(
|
|
295
|
+
start_date="2009-01-01", end_date="2010-12-31",
|
|
296
|
+
engine="plotly", show_plot=False, plot_extrema=True,
|
|
297
|
+
)
|
|
298
|
+
wind = next(t for t in fig.data if t.name == "WIND")
|
|
299
|
+
colors = list(wind.marker.color)
|
|
300
|
+
assert "rgba(0,0,0,0)" in colors, "null-wind days must render transparent"
|
|
301
|
+
assert all(c is not None for c in colors)
|
|
302
|
+
assert None not in list(wind.marker.line.color)
|
|
303
|
+
|
|
304
|
+
|
|
262
305
|
def test_no_wind_row_when_source_lacks_wind(tmp_path):
|
|
263
306
|
# NOAA-style data with no WSPD/WDIR columns -> figure stays at 2 rows
|
|
264
307
|
# (regression guard: the wind row must not be invented).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|