Spaces:
Sleeping
Sleeping
Fix Skew-T labels and all input text colors
Browse files- Level labels: use paper coords computed from log(p) — bypasses
log-reversed axis annotation quirk in Plotly
- All number inputs + slider tooltips: black text on white via CSS
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
python/updraft_forcing/app.py
CHANGED
|
@@ -891,7 +891,9 @@ def _skewt_figure() -> go.Figure:
|
|
| 891 |
hovertemplate="%{text}°C @ %{y:.0f} hPa<extra>Parcel</extra>",
|
| 892 |
text=[f"{t:.1f}" for t in T_pcl_C]))
|
| 893 |
|
| 894 |
-
# Level lines —
|
|
|
|
|
|
|
| 895 |
for p_lvl, label, color in [
|
| 896 |
(p_LCL, "LCL", "#9abfff"),
|
| 897 |
(p_LFC, "LFC", "#ffaa44"),
|
|
@@ -900,14 +902,15 @@ def _skewt_figure() -> go.Figure:
|
|
| 900 |
]:
|
| 901 |
if 98 < p_lvl < 1060:
|
| 902 |
fig.add_hline(y=p_lvl, line=dict(color=color, width=0.9, dash="dot"))
|
|
|
|
| 903 |
fig.add_annotation(
|
| 904 |
x=0.01, xref="paper",
|
| 905 |
-
y=
|
| 906 |
-
text=label,
|
| 907 |
showarrow=False,
|
| 908 |
xanchor="left", yanchor="bottom",
|
| 909 |
font=dict(color=color, size=10),
|
| 910 |
-
bgcolor="rgba(10,15,26,0.
|
| 911 |
)
|
| 912 |
|
| 913 |
# Wind barbs
|
|
@@ -1042,9 +1045,8 @@ def _build_layout():
|
|
| 1042 |
dcc.Input(id="upd-delta-T", type="number", value=UPD_DEFAULTS["delta_T"],
|
| 1043 |
step=0.1, min=0.1, max=10.0,
|
| 1044 |
style={"width": "80px", "marginLeft": "8px",
|
| 1045 |
-
"
|
| 1046 |
-
"
|
| 1047 |
-
"borderRadius": "4px"}),
|
| 1048 |
], style={"display": "flex", "alignItems": "center", "marginBottom": "10px"}),
|
| 1049 |
_slider("upd-r0", "Radius (m)", 500, 5000, 100, UPD_DEFAULTS["r0"], " m",
|
| 1050 |
tip="Updraft core radius. The radial shape function tapers w and ζ "
|
|
@@ -1535,6 +1537,10 @@ table tr:nth-child(even) td { background: #161d29; }
|
|
| 1535 |
.results-center { background: #11161f; border-radius: 8px; padding: 12px; }
|
| 1536 |
.results-side { background: #11161f; border-radius: 8px; padding: 12px; }
|
| 1537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1538 |
/* Field-select dropdown — force black text inside the React-Select widget */
|
| 1539 |
#field-select .Select-value-label,
|
| 1540 |
#field-select .Select-placeholder,
|
|
|
|
| 891 |
hovertemplate="%{text}°C @ %{y:.0f} hPa<extra>Parcel</extra>",
|
| 892 |
text=[f"{t:.1f}" for t in T_pcl_C]))
|
| 893 |
|
| 894 |
+
# Level lines — manually convert pressure → paper-y so log-reversed axis never misplaces labels
|
| 895 |
+
_ylo_log = np.log10(1025.0) # matches range[0] in update_layout below
|
| 896 |
+
_yhi_log = np.log10(98.0) # matches range[1]
|
| 897 |
for p_lvl, label, color in [
|
| 898 |
(p_LCL, "LCL", "#9abfff"),
|
| 899 |
(p_LFC, "LFC", "#ffaa44"),
|
|
|
|
| 902 |
]:
|
| 903 |
if 98 < p_lvl < 1060:
|
| 904 |
fig.add_hline(y=p_lvl, line=dict(color=color, width=0.9, dash="dot"))
|
| 905 |
+
y_paper = (np.log10(float(p_lvl)) - _ylo_log) / (_yhi_log - _ylo_log)
|
| 906 |
fig.add_annotation(
|
| 907 |
x=0.01, xref="paper",
|
| 908 |
+
y=float(np.clip(y_paper, 0.01, 0.99)), yref="paper",
|
| 909 |
+
text=f" {label} ",
|
| 910 |
showarrow=False,
|
| 911 |
xanchor="left", yanchor="bottom",
|
| 912 |
font=dict(color=color, size=10),
|
| 913 |
+
bgcolor="rgba(10,15,26,0.7)",
|
| 914 |
)
|
| 915 |
|
| 916 |
# Wind barbs
|
|
|
|
| 1045 |
dcc.Input(id="upd-delta-T", type="number", value=UPD_DEFAULTS["delta_T"],
|
| 1046 |
step=0.1, min=0.1, max=10.0,
|
| 1047 |
style={"width": "80px", "marginLeft": "8px",
|
| 1048 |
+
"border": "1px solid #2d3a4b",
|
| 1049 |
+
"padding": "4px 8px", "borderRadius": "4px"}),
|
|
|
|
| 1050 |
], style={"display": "flex", "alignItems": "center", "marginBottom": "10px"}),
|
| 1051 |
_slider("upd-r0", "Radius (m)", 500, 5000, 100, UPD_DEFAULTS["r0"], " m",
|
| 1052 |
tip="Updraft core radius. The radial shape function tapers w and ζ "
|
|
|
|
| 1537 |
.results-center { background: #11161f; border-radius: 8px; padding: 12px; }
|
| 1538 |
.results-side { background: #11161f; border-radius: 8px; padding: 12px; }
|
| 1539 |
|
| 1540 |
+
/* Number inputs and slider tooltips — black text on white background */
|
| 1541 |
+
input[type="number"], input[type="text"] { color: #111 !important; background: #fff !important; }
|
| 1542 |
+
.rc-slider-tooltip-content { color: #111 !important; background: #fff !important; }
|
| 1543 |
+
|
| 1544 |
/* Field-select dropdown — force black text inside the React-Select widget */
|
| 1545 |
#field-select .Select-value-label,
|
| 1546 |
#field-select .Select-placeholder,
|