planner: climate tile client library - #2346
Merged
Merged
Conversation
Decode both climate archive levels per specs/planner-climate-tiles.md, look up cells, sample a route from the overview level, correct temperatures with the two lapse rates, read terrain heights from the map's Terrarium tiles, and derive wet days, relative rain, wind mode, steadiness, split winds and head/cross/tail chances. Pure functions for the Weather and Wind year-slider rows of a route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…e local archive test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Snow opens its archive with openTileArchive. The 52-column date bar and the climate lookup share weekOf, the week of the climate bake. The route rows keep their own distance weight, since data-layer no longer has one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
This PR adds the client library for the climate layers (Weather and Wind, issue #2329). It is pure TypeScript. It has no UI wiring and no Svelte components. The layer UI comes in a later PR.
This PR builds on #2345 (spec and bake), which is merged. The new files are all in
builder/app/src/lib/planner/layers/.map-style.tsnow exportsDEM_TILEandDEM_MAX_ZOOM. The terrain source and the terrain helper both use them, so the helper requests only tiles that the hillshade loads.climate.tsclimate-source.tssampleLineclimate-route.tsclimate-terrain.tstile-archive.tssnow-layer.svelte.tsno longer has its own opener. Snow behaviour is unchanged.data-layer.tshasweekOf, the week of the climate bake: days 7w to 7w + 6 of the date's own year, and week 51 also holds the last one or two days.dateColumn(date, 52)andcolumnDate(column, year, 52)use it, so the 52-column date bar and the climate lookup always select the same week (4 March 2024 is week 9 in both). The 183-column snow grid still folds 29 February onto 28 February.Definitions
7 × wet_share ÷ 100(for example, 2.4 of 7).first_year). In the overview means, it has the mean over the archive years. Drier is below 1/1.25, wetter is above 1.25.Measurements
public, max-age=31536000, immutable. A fetch from a worker (the same path that MapLibre uses) fills the HTTP cache, and a later fetch from the main thread gets the tile in 1.6–3.6 ms.Thresholds (owner to confirm)
BIMODAL_RATIO = 0.6,BIMODAL_SHARE = 0.65: chosen on the BW archive. They mark the Lake Constance shore in 11 of 12 months and the northern Upper Rhine in spring. They mark no month at the Feldberg, on the Swabian Alb or at Stuttgart. This is 18 % of the BW cell-months.WETTER_RATIO = 1.25: in the BW ten-year means, 25 % of the cell weeks are drier and about 17 % are wetter.Public docs changed: no
Requirements: none
Checks
npx vitest run src/lib/planner src/components/planner: 29 files, 182 tests pass. Synthetic tiles built from the spec cover the decoding. The BW figures above came from a one-time run on the local archive; that test is not in the PR.svelte-check: no errors in the new files. The 15 errors that remain are wasmpkg/modules that are not built in this checkout.obc suites check: OK.npm run test:planner(tests/browser): 1 passed. The request budget is unchanged.🤖 Generated with Claude Code