fix: omit the placeholder year from meter timeseries date labels - #147
Open
eastagiletracker wants to merge 1 commit into
Open
Conversation
Load profiles are typical-year data, so the year on the meter timeseries axis and hover (2001 for the simulated library profiles) carries no meaning and is easily read as the emission scenario year. Format date labels as month/day, with time of day when the aggregation is hourly, and keep the year off the axis at every zoom level via tickformatstops.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes formatting the meter timeseries date labels so they show month and day instead of the placeholder year carried by the load profiles (Fixes #137). We include this PR work along with a full history of your repo at https://eastagiletracker.com/projects/217. You can sign in with your GitHub ID to claim ownership of the project.
What happens today
The library load profiles are typical-year data — the simulated rows in
data/input/load_data_full.parquetare stamped 2001 — so the year on the Results page meter timeseries describes nothing about the results, and next to the emission scenario years it reads as if the simulation ran in 2001.plot_meter_timeseriessets no date format on the x axis, so Plotly falls back to its own date ticks, which include the year, and the hover template hard-codesTime: %{x|%Y-%m-%d %H:%M}.Reproduced on
mainat4fa67fb, driving the same functionpages/results_page.pycalls from theupdate_meter_plotcallback:Rendered, that is the axis from your report —
Jan 2001 … Jan 2002:The change
src/visuals.pygains one date-format table and applies it inplot_meter_timeseries. The x axis getstickformatstopscovering every zoom range —%b %d, %H:%Mbelow daily ticks,%b %dfrom daily to monthly,%babove — so the year stays off the axis whether the user is looking at the whole year or has zoomed into a week. The hover format now follows the aggregation dropdown instead of being fixed:%b %d, %H:%Mfor hourly,%b %dfor daily and weekly,%Bfor monthly. Nothing else moves — the underlying timestamps, the resampling and the plotted values are untouched, so downloads and every other chart are unaffected.The same profile after the change, and zoomed to a week of hourly data:
Verification
tests/test_visuals.pyis new and covers both the line and stacked variants: the axis carries a format at every zoom level and none of them contains%Y, the zoom ranges are contiguous, the hover format matches each aggregation the dropdown offers, and — as controls — the daily sums, the x values and the gas toggle behave exactly as before. Six of the ten fail without the two behaviour lines inplot_meter_timeseries(revert them and keep the format table to see it), which is what pins the fix rather than the constant.python -m pytestgoes from 19 passing onmainto 29 passing here, with no test failing that passed before.ruff check .andruff format --check .report exactly what they report onmain(one pre-existingRUF013inutils/tooltips.py, 38 files formatted). The three images above are real renders of the figure this code returns, so the format strings are checked the way the browser reads them, not just as text.One judgement call worth your review: the year is now dropped for user-uploaded measured data too. That follows the report, and within a plot the year is near-constant since measured data is limited to one year, but if you would rather keep it for uploads it is a one-line branch in the format table.
How this was managed
This work was tracked as Datetime shows irrelevant year on timeseries plots on the board at https://eastagiletracker.com/projects/217, which was built by importing this repository's issues and pull requests (146 stories, 11 labels).
If you'd rather not receive contributions like this, reply
no-more-prson this pull request and we won't open any further ones on your repositories.Lawrence W. Sinclair
CEO / East Agile
linkedin.com/in/lwsinclair/
eastagile.com