Skip to content

Bug: Radar tiles are geographically misplaced, error grows with distance from configured location #7

Description

@gundersleben

Bug: Radar tiles are geographically misplaced, error grows with distance from configured location

Description

The radar tile rendering (tile_server.py / latlon_to_grid() in dwd_radar.py) shows precipitation shapes that look structurally plausible (smooth, radar-typical patterns) but are placed at the wrong geographic location. Confirmed via side-by-side comparison with the official DWD WarnWetter app at the same timestamp:

  • Near the configured home location (~51.30°N, 10.77°E), the map showed a rain cell offset by roughly 5-10 km from where the DWD app showed no precipitation at all (clear sky confirmed visually on the ground).
  • Near Lüneburg (~53.25°N, 10.41°E), the DWD app showed a small, well-defined rain cell (yellow, starting ~14:10). The integration's map showed a large blue area north of Lüneburg instead — unrelated to the actual cell — while the area south toward Hannover (where a simple constant offset would have placed it) showed nothing.

This rules out a simple constant lat/lon offset. The error appears to scale with distance from the polar-stereographic projection center, which points to either the grid origin constant or the grid resolution constant being wrong (or both, compounding).

Suspect 1 — DE1200_RESOLUTION_KM in const.py

DE1200_RESOLUTION_KM = 1.1

The DWD DE1200 composite is generally documented as a 1 km² raster. If the true resolution is 1.0 km rather than 1.1, every grid-index calculation in latlon_to_grid() would be off by ~10%, and — critically — that error scales with pixel distance from the grid origin, not with a fixed offset. This matches the empirical behavior described above (small/plausible error near the config location, large/unrelated error near Lüneburg, ~250 km away).

Suspect 2 — _GRID_ORIGIN_Y in dwd_radar.py

_GRID_ORIGIN_X = -523.462
_GRID_ORIGIN_Y = -4808.645

_GRID_ORIGIN_X matches the commonly cited RADOLAN national-composite origin x-coordinate. _GRID_ORIGIN_Y, however, looks suspicious — some public RADOLAN references cite a y-origin around -4658.6 km for the national composite grid, which is exactly 150 km different from the value here. I was not able to fully verify which value is correct for the specific DE1200/RV product from a primary source, so I'm flagging it rather than asserting it's wrong.

What I'd suggest

Since I don't have access to the authoritative DE1200 product documentation to confirm the exact origin/resolution constants with certainty, I didn't want to guess-patch a projection formula that's already structurally correct (the polar-stereographic math itself, with phi0=60°N, lambda0=10°E, matches the standard RADOLAN formula). This would benefit from someone checking the constants against the official DWD RADOLAN/RADVOR-OP Kompositformat documentation, or against the grid metadata embedded in a downloaded DE1200 RV file's header (if the format includes it).

Happy to test a candidate fix (e.g. DE1200_RESOLUTION_KM = 1.0) against known reference points if that's useful, or to open a PR once the correct values are confirmed.


Found with the help of an AI assistant (Claude) while comparing the integration's radar map against the DWD WarnWetter app side by side — happy to share the comparison screenshots if helpful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions