Repository navigation
docs: the Getting Started page runs when the docs are built - #218
Merged
Merged
Conversation
receptor.plot.map() called ax.legend(fontsize=8), which is loc="best". matplotlib then tries every candidate spot against every point on the axes, and warns "Creating legend with loc="best" can be slow with large amounts of data" when that takes over a second. sim.plot.map() draws the receptor after the particles, so a simulation's particles trigger it, and a docs build that treats warnings as errors fails on it. Both legends now sit in the upper right corner. The test fails on the old code: it checks that drawing the legend never searches for a position, since the warning depends on how fast the machine is, not on a count. Part of #116.
The page's steps are `.. ipython:: python` blocks, so it shows what the
code prints and the maps it draws: the particles, the footprint, and the
same receptor run as a project. It runs a real simulation on the HRRR
files the tests cache (14 and 15 January 2021, cropped around Salt
Lake), in a temporary folder. About 95 s of the docs build.
- The receptor moves from 15 July 2023 18:00 UTC to 15 January 2021
08:00 UTC, inside the cached met; the output layout and the command
line example use the same time.
- Running it corrected the text. The footprint is not "summed over all 24
hours": with this small met crop every particle leaves it after about
12 hours, and the page now says so and prints how many. It also says the
footprint stretches away from the receptor, which the map shows, in
place of "most influence near the receptor", which it does not.
`foot.sum("time")` printed a screen of zeros and now prints the shape.
- The second footprint differs a little from the first because each run
draws its own random numbers (krand 4); the page says so.
- docs.yml restores the tests' HRRR cache (same key), fetches it on a
miss as tests.yml does, and saves it. AGENTS.md says the page needs the
met files locally (STILT_TEST_MET_DIR) and how to fetch them.
- test_docs_examples.py compiles the docs' `code-block` examples; the 7
blocks that now run in the build are no longer among them.
Part of #116.
Codecov Report✅ All modified and coverable lines are covered by tests.
|
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.
The Getting Started page now runs when the docs are built, so it shows what the code prints and the maps it draws: the particles, the footprint, and the same receptor run as a project. Part of #116.
It runs a real simulation on the HRRR files the tests already cache (14 and 15 January 2021, cropped around Salt Lake), in a temporary folder. A docs build takes about 95 s instead of 60 s on a compute node (the run is 17 s for trajectories, 2.5 s for the footprint, and 17 s again for the project). The steps are
.. ipython:: pythonblocks from python-template v1.2.0; a block that raises or warns fails the build. The code a reader copies is what the page shows. The setup it needs (where the met is, a temporary working folder) is a hidden block.Running it corrected the text. The page said the map shows the footprint "summed over all 24 hours", and that you should see "the most influence near the receptor". With this met crop, every particle leaves the met region after about 12 hours and its run stops there, so the footprint has about 12 hourly maps; and the map shows the footprint stretching away from the receptor, not peaking at it. The page now says that, and prints how many hours the particles went (the number changes from build to build, because the default
krand: 4draws a different seed for each run, so the prose has none).foot.sum("time")printed a screen of zeros; it now prints the shape. The page also says why the project's footprint differs a little from the one before it.The receptor moved from 15 July 2023 18:00 UTC to 15 January 2021 08:00 UTC, inside the cached met. The output layout and the command-line example use the same time.
Workflow.
docs.ymlrestores the tests' HRRR cache (same keymet-hrrr-2021-v1), fetches it on a miss the waytests.ymldoes, and saves it, so a docs run onmain, a pull request, or a tag finds it. zizmor passes. Building the docs locally now needs those files:STILT_TEST_MET_DIRpoints at them, and AGENTS.md has the one command that fetches them.Legend fix, in its own commit.
sim.plot.map()drew a legend withloc="best", which matplotlib warns about when the search takes over a second, as it does with a simulation's particles on the map. That warning fails the build, and it is a nuisance for anyone plotting a simulation. Both legends now sit in the upper right corner. The new test fails on the old code: it checks that drawing the legend never searches for a position, because the warning depends on how fast the machine is.tests/test_docs_examples.pycompiles the docs'code-blockexamples, so its count drops by 7: the blocks that now run in the build.just quality-check(1,301 tests, the import contracts, 99% docstrings) and a cleanjust build-docspass, as do all the pre-commit hooks.