How to Use
This page describes the typical usage flow of CPFA, from preparing input data to running predictions, visualization, and evaluation.
Step 1: Prepare Input Data
CPFA expects a surface input file with the following structure:
File name:
input_surface.npyLocation:
download_datafolderShape:
(4, 721, 1440)Order of variables:
Mean sea level pressure (MSLP)
10m u-component of wind (U10)
10m v-component of wind (V10)
2m temperature (T2M)
File name:
input_upper.npyLocation:
download_datafolderShape:
(5, 13, 721, 1440)Order of variables:
z(Geopotential)
q(Specific humidity)
t(Temperature)
u(Zonal wind)
v(Meridional wind)
ERA5 Download Guide
Visit the Copernicus Climate Data Store (CDS)
Sign up and log in.
Navigate to: input_surface.npy → ERA5 hourly data on single levels from 1940 to present input_upper.npy → ERA5 hourly data on pressure levels from 1940 to present
Use the following settings:
input_surface.npy
Product type: Reanalysis
Variables (in this order):
Mean sea level pressure
10m u-component of wind
10m v-component of wind
2m temperature
Year / Month / Day / Time: select the desired range
Geographical area: global coverage
Data format: NetCDF4 (experimental)
Download format: unarchived file
- input_upper.npy
Product type: Reanalysis
Variables (in this order): 1. Geopotential 2. Specific humidity 3. Temperature 4. U-component of wind 5. V-component of wind
Pressure level: 1000hPa, 925hPa, 850hPa, 700hPa, 600hPa, 500hPa, 400hPa, 300hPa, 250hPa, 200hPa, 150hPa, 100hPa and 50hPa in the exact order
Year / Month / Day / Time: select the desired range
Geographical area: global coverage
Data format: NetCDF4 (experimental)
Download format: unarchived file
Accept the terms of use, submit the form, and download the file.
Place the downloaded ERA5 files in the
download_datafolder.
Step 2: Transformate file
Run .. code-block:: bash
python transform_nc_to_npy.py
Check whether the newly generated data has been successfully created in the input_data folder.
Step 3: Run the Prediction
With the virtual environment activated and input data prepared, move to the project root in Anaconda Prompt and run:
python prediction.py
This script performs the following tasks:
Loads
input_surface.npyfrominput_dataLoads the appropriate Pangu-Weather ONNX model (e.g. 1, 3, 6, or 24-hour)
Executes the forward prediction
Stores prediction results in the
output_datafolder
Step 4: Visualization
After predictions are generated, you can visualize the results using:
python visualization.py
This script typically reads data from output_data and produces
figures such as:
Global maps of temperature or pressure
Spatial plots of wind components
Time series at specific grid points (depending on implementation)
The plots are usually saved as image files (e.g. PNG)
Step 5: Evaluation
To evaluate model performance against ERA5 data, run:
python evaluation.py
This script:
Loads CPFA prediction outputs
Loads reference ERA5 data
Computes basic verification metrics (for example, mean error or other statistics depending on the implementation)
Optionally saves summary tables or plots
Recommended Editor
CPFA can be run entirely from Anaconda Prompt, but using Visual Studio Code (VS Code) is recommended for easier script execution, debugging, and inspection of outputs.