← Retour au téléchargeur GRIB
Comment les fichiers GRIB sont produits
Interpolation et reprojection des données du Service météorologique du Canada sur une grille commune
Objectif
Les modèles de prévision du Service météorologique du Canada (SMC) produisent leurs données
sur différentes grilles (souvent des grilles tournées latitude-longitude) et dans différents formats
(GRIB2 en grille tournée, NetCDF). Or, certains logiciels de routage et de météo pour la voile
, comme le logiciel libre OpenCPN, sont incapables de lire le format NetCDF ou d'interpréter
les grilles latitude-longitude tournées. Ils nécessitent des fichiers GRIB2 sur une grille
régulière latitude-longitude standard.
Pour répondre à ce besoin, nous reprojetons toutes ces données sur une
grille régulière latitude-longitude commune, qui est une sous-grille du système CIOPS
(Coastal Ice Ocean Prediction System) couvrant le golfe du Saint-Laurent et la côte de la Colombie-Britanique.
La grille cible
Golfe du Saint-Laurent
Couverture
45.05°N à 51.91°N / 75.035°W à 54.995°W
Résolution
0.03° en longitude × 0.02° en latitude
Région
Golfe du Saint-Laurent et estuaire
Format de sortie
GRIB2 (grille régulière lat/lon)
Côte Ouest — Colombie-Britannique (BC)
Couverture
47.49°N à 54.81°N / 134.315°W à 122.015°W
Résolution
0.03° en longitude × 0.02° en latitude
Région
Côte de la C.-B. (Détroit de Juan de Fuca à Dixon Entrance)
Format de sortie
GRIB2 (grille régulière lat/lon)
La résolution en longitude (0.03°) est 1.5 fois plus grande qu'en latitude (0.02°)
pour compenser la convergence des méridiens à ~50°N, donnant des pixels approximativement carrés.
Processus général
Chaque fichier source passe par un processus de reprojection en plusieurs étapes :
1
Lecture du fichier source
GRIB2 (grille tournée) ou NetCDF selon le modèle. GDAL détecte automatiquement la géolocalisation de la grille source.
2
Reprojection avec gdalwarp
Interpolation de la grille source vers la grille cible régulière. Méthode bilinéaire pour les champs continus, plus proche voisin pour les directions et champs discrets.
3
Conversion en GRIB2
Le résultat intermédiaire (NetCDF ou GeoTIFF) est converti en format GRIB2 avec préservation des métadonnées (discipline, catégorie, paramètre WMO) et gestion des valeurs manquantes.
GRIB2 (grille tournée) ou NetCDF (CIOPS)
| |
v v
gdalwarp (reprojection) gdalwarp (reprojection)
interpolation interpolation
bilinéaire ou voisin plus proche voisin
| |
v v
NetCDF intermédiaire GeoTIFF intermédiaire
| |
v v
GDAL Translate GDAL Translate
+ métadonnées GRIB2 + métadonnées GRIB2
| |
v v
GRIB2 final (grille régulière lat/lon)
Les modèles traités
HRDPS — Système haute résolution de prévision déterministe
Résolution source : ~2.5 km (grille tournée lat/lon)
Format source : GRIB2
Particularité : La direction du vent est interpolée en plus proche voisin pour éviter les moyennes d'angles.
Horizon : 1 à 48 heures
RDPS — Système régional de prévision déterministe
Résolution source : 10 km
Format source : GRIB2
Horizon : 0 à 48 heures
CIOPS — Système côtier de prévision glace-océan
Résolution source : ~0.03° × 0.02° (grille régulière)
Format source : NetCDF
Particularité : La grille cible étant une sous-grille de CIOPS, l'interpolation est essentiellement une extraction (plus proche voisin).
Horizon : 1 à 48 heures
RDWPS — Système régional déterministe de prévision de vagues
Résolution source : ~2.5 km (grille tournée lat/lon)
Format source : GRIB2
Horizon : 1 à 48 heures
Méthodes d'interpolation
Deux méthodes sont utilisées selon la nature de la variable :
Interpolation bilinéaire
Utilisée pour les champs continus : pression, hauteur de vagues, période de vagues, CAPE. Produit des transitions lisses entre les points de grille.
Plus proche voisin
Utilisée pour les champs où la moyenne n'a pas de sens physique : directions de champs vectoriels (exemple direction du vent) (extraction de sous-grille). Évite les artefacts d'interpolation sur les angles.
Gestion des valeurs manquantes
Les modèles océaniques et de vagues contiennent des points terrestres sans données.
Le système préserve ces masques terre/mer en utilisant l'encodage COMPLEX_PACKING du GRIB2,
qui supporte nativement les bitmaps de valeurs manquantes.
Taille des fichiers découpés (zoom)
Lorsque vous sélectionnez un sous-domaine (zoom) dans le téléchargeur, la découpe
est effectuée par l'outil wgrib2. Or, wgrib2 utilise un encodage
simple packing pour écrire le fichier découpé, qui est moins efficace
que le complex packing utilisé dans les fichiers originaux produits par GDAL.
En pratique, le fichier découpé est environ 1.7 fois plus gros par point de grille
que le fichier original. Cela signifie qu'un sous-domaine couvrant plus d'environ
60 % de la grille complète (1/1.7) produira un fichier plus volumineux
que le fichier couvrant toute la grille.
En revanche, en deçà de 60 % du domaine, la découpe réduit bel et bien
la taille du fichier téléchargé. Plus le sous-domaine est petit, plus le gain est important.
Même au-delà de ce seuil, le zoom reste utile si votre objectif est de limiter
la quantité de données à afficher dans votre logiciel de routage ou de météo,
plutôt que de réduire la taille du téléchargement.
Outils utilisés
GDAL / gdalwarp
eccodes
wgrib2
netCDF4
Python 3
NumPy
← Back to GRIB Downloader
How GRIB Files are Produced
Interpolation and reprojection of Canadian Meteorological Service data onto a common grid
Objective
The forecast models of the Canadian Meteorological Service (CMS/SMC) produce their data on
different grids (often rotated latitude-longitude grids) and in different formats (rotated-grid
GRIB2, NetCDF). However, some sailing routing and weather software, such as the free software
OpenCPN, cannot read NetCDF format or interpret rotated latitude-longitude grids. They require
GRIB2 files on a standard regular latitude-longitude grid.
To meet this need, we reproject all this data onto a
common regular latitude-longitude grid, which is a sub-grid of the CIOPS
(Coastal Ice Ocean Prediction System) covering the Gulf of Saint Lawrence and the British Columbia coast.
The Target Grid
Gulf of Saint Lawrence
Coverage
45.05°N to 51.91°N / 75.035°W to 54.995°W
Resolution
0.03° longitude × 0.02° latitude
Region
Gulf of Saint Lawrence and estuary
Output format
GRIB2 (regular lat/lon grid)
West Coast — British Columbia (BC)
Coverage
47.49°N to 54.81°N / 134.315°W to 122.015°W
Resolution
0.03° longitude × 0.02° latitude
Region
BC coast (Juan de Fuca Strait to Dixon Entrance)
Output format
GRIB2 (regular lat/lon grid)
The longitude resolution (0.03°) is 1.5 times larger than the latitude resolution (0.02°)
to compensate for meridian convergence at ~50°N, giving approximately square pixels.
General Process
Each source file goes through a multi-step reprojection process:
1
Reading the source file
GRIB2 (rotated grid) or NetCDF depending on the model. GDAL automatically detects the georeferencing of the source grid.
2
Reprojection with gdalwarp
Interpolation from the source grid to the regular target grid. Bilinear method for continuous fields, nearest neighbor for directions and discrete fields.
3
Conversion to GRIB2
The intermediate result (NetCDF or GeoTIFF) is converted to GRIB2 format with metadata preservation (WMO discipline, category, parameter) and missing value handling.
GRIB2 (rotated grid) or NetCDF (CIOPS)
| |
v v
gdalwarp (reprojection) gdalwarp (reprojection)
interpolation interpolation
bilinear or nearest nearest neighbor
| |
v v
Intermediate NetCDF Intermediate GeoTIFF
| |
v v
GDAL Translate GDAL Translate
+ GRIB2 metadata + GRIB2 metadata
| |
v v
Final GRIB2 (regular lat/lon grid)
Processed Models
HRDPS — High Resolution Deterministic Prediction System
Source resolution: ~2.5 km (rotated lat/lon grid)
Source format: GRIB2
Special feature: Wind direction is interpolated using nearest neighbor to avoid angle averaging.
Forecast horizon: 1 to 48 hours
RDPS — Regional Deterministic Prediction System
Source resolution: 10 km
Source format: GRIB2
Forecast horizon: 0 to 48 hours
CIOPS — Coastal Ice Ocean Prediction System
Source resolution: ~0.03° × 0.02° (regular grid)
Source format: NetCDF
Special feature: Since the target grid is a sub-grid of CIOPS, interpolation is essentially an extraction (nearest neighbor).
Forecast horizon: 1 to 48 hours
RDWPS — Regional Deterministic Wave Prediction System
Source resolution: ~2.5 km (rotated lat/lon grid)
Source format: GRIB2
Forecast horizon: 1 to 48 hours
Interpolation Methods
Two methods are used depending on the nature of the variable:
Bilinear interpolation
Used for continuous fields: pressure, wave height, wave period, CAPE. Produces smooth transitions between grid points.
Nearest neighbor
Used for fields where averaging makes no physical sense: directions of vector fields (e.g., wind direction) and sub-grid extraction. Avoids interpolation artifacts on angles.
Missing Value Handling
Ocean and wave models contain land points with no data.
The system preserves these land/sea masks using GRIB2 COMPLEX_PACKING encoding,
which natively supports missing value bitmaps.
Clipped File Size (Zoom)
When you select a subdomain (zoom) in the downloader, the clipping is performed by the
wgrib2 tool. However, wgrib2 uses simple packing encoding
to write the clipped file, which is less efficient than the complex packing
used in the original files produced by GDAL.
In practice, the clipped file is approximately 1.7 times larger per grid point
than the original file. This means a subdomain covering more than about 60 % of the
full grid (1/1.7) will produce a file larger than the file covering the entire grid.
On the other hand, below 60 % of the domain, clipping does reduce the size of the
downloaded file. The smaller the subdomain, the greater the gain.
Even beyond this threshold, zooming is still useful if your goal is to limit the amount
of data displayed in your routing or weather software, rather than reducing the download size.
Tools Used
GDAL / gdalwarp
eccodes
wgrib2
netCDF4
Python 3
NumPy