Pangu-Weather¶
None
None
None
# Download sample input data
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/input_surface.npy -P ./data
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/input_upper.npy -P ./data
# Download pretrain model weight
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/pangu_weather_1.onnx -P ./inference
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/pangu_weather_3.onnx -P ./inference
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/pangu_weather_6.onnx -P ./inference
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/pangu_weather_24.onnx -P ./inference
# 1h interval-time model inference
python predict.py INFER.export_path=inference/pangu_weather_1
# 3h interval-time model inference
python predict.py INFER.export_path=inference/pangu_weather_3
# 6h interval-time model inference
python predict.py INFER.export_path=inference/pangu_weather_6
# 24h interval-time model inference
python predict.py INFER.export_path=inference/pangu_weather_24
1. Background Introduction¶
Pangu-Weather is the first AI method whose accuracy exceeds that of traditional numerical forecasting methods. It provides pre-trained models with 1-hour interval, 3-hour interval, 6-hour interval, and 24-hour interval. The data used includes five meteorological elements (temperature, humidity, geopotential, longitude and latitude wind speeds) on 13 different pressure layers in vertical height, and four meteorological elements on the earth's surface (2-meter temperature, 10-meter wind speed in longitude and latitude directions, sea level pressure). The prediction accuracy from 1 hour to 7 days is higher than that of traditional numerical methods (i.e., operational IFS of the European Meteorological Centre).
At the same time, the Pangu-Weather model can complete a 24-hour global weather forecast in just 1.4 seconds on a V100 graphics card, which is more than 10,000 times faster than traditional numerical forecasting.
2. Model Principle¶
This chapter only briefly introduces the principle of the Pangu-Weather model. For detailed theoretical derivation, please read Pangu-Weather: A 3D High-Resolution System for Fast and Accurate Global Weather Forecast.
The overall structure of the model is shown in the figure:
Its main idea is to use a 3D variant of a visual transformer to process complex and uneven meteorological elements. Due to the high resolution of meteorological data, compared with common vision transformer methods, researchers reduced the encoder and decoder of the network to 2 levels (8 blocks), and adopted the sliding window attention mechanism of Swin transformer to reduce the computation of the network.
The model uses pre-trained weights for inference. Next, the inference process of the model will be introduced.
3. Model Construction¶
In this case, PanguWeatherPredictor is implemented for inference of the ONNX model:
Among them, input_file and input_surface_file represent the upper-air meteorological data and surface meteorological data input to the network model respectively.
4. Result Visualization¶
First convert the data from npy to NetCDF format, then use ncvue for visualization
-
Install dependencies
-
Use script for data conversion
-
Use ncvue to open the converted NetCDF file. For detailed instructions on ncvue, see ncvue official documentation
5. Complete Code¶
| examples/pangu_weather/predict.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
6. Result Display¶
The figure below shows the temperature prediction results of the model. More indicators can be viewed using ncvue.

