Urgent.News

What's breaking now, across thousands of outlets.

Tech

How barometer.today draws its isobars

barometer.today shows air pressure for any city: the reading now, the change since yesterday, and the week ahead. It also has a world isobar map, animated hour by hour from a day back to four days ahead. This post explains what isobars are and the algorithms that we use to draw them. The code is Python with numpy, scipy, contourpy and shapely, and anyone drawing contour maps from gridded data…

barometer.today displays air pressure for various cities, including a world isobar map. Isobars are lines connecting places with equal air pressure. When air pressure varies rapidly over a short distance, the isobars are close together, indicating strong winds. When the isobars are spaced further apart, the air is calmer. The map uses sea-level pressure, which is the pressure a barometer would show if placed at sea level, regardless of the location's elevation.

The data for the map comes from the ECMWF global forecast model, which provides a grid of sea-level pressure values every 0.25 degrees (approximately 28 km) across the entire planet. The model updates four times a day, with each update producing 120 frames per hour. To improve the accuracy of the isobars, barometer.today employs several techniques.

First, it applies a Gaussian blur with a sigma of one cell (28 km) to smooth out the jagged edges between cells in the raw model grid. However, a Gaussian blur can also flatten extreme values, such as the core of a hurricane. To address this, the map uses a normalized convolution, which blurs a mask of ones and zeros the same way as the field, and then divides the two results.

This ensures that the output cell is the weighted mean of only the valid cells nearby, preventing inflated values from spreading into the real field around high plateaus. Additionally, the map identifies regions above 2,500 meters and marks the isobars as dashed lines in these areas. This indicates that the values are extrapolated rather than directly measured.

The isobars are traced using the marching squares algorithm, which identifies the corners of each grid cell as either above or below a specific level (e.g., 1012 hPa). The algorithm then determines where the line enters and leaves each cell by linearly interpolating between the corner values. This process creates continuous lines for each level, which are then combined to form the complete world map.

The map also handles the challenge of longitude wrapping around the globe by padding the grid with two degrees of columns copied from the opposite edge and then clipping the lines back to the world boundaries.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

My Wife’s Steam Deck Is a Server Now. She Doesn’t Know Yet. 🫠

Hey tech adventurers! 👋 What if the hardware you already own could become part of your homelab? That spare Linux box. An old Mac. A mini PC sitting under the TV. Or, in my case, my wife’s Steam Deck.

  • Husband repurposes wife's Steam Deck as server
  • Deck runs virtual machines and AI models
  • Guide provides step-by-step instructions

More from Monday 7 September →