In this post, I present some simple programs written in Python for post-processing the flexpart-wrf output.
It mainly contains several aspects, data merging, data processing and data visualization. I will also show some tips tp creat self-defined colormaps for nice plots.
PS: All th codes are also uploaded in my GitHub respority PyFlex
Merging datasets
In the output path, the result (e.g., flxout_d01_20160304_030000.nc ) for each run was saved as an independent file. It would be inconvenient to loop them for every post-processing function. Therefore, I zip them into a hdf5 file.
Here is the code and some instructions.
1 | """pre-reading an template file for capture the geogrid information""" |
Then, we can download the “.hdf5” file for further analysis.
Colormap setting
A good colormap can really improve the representability for the figure. Here, I recommend and generate three colormaps using different approaches.
- cmap1: generated by user-defined RGB values
- cmap2: subsets of an existing
1 | ## CMAP1 from pflexible.py on https://git.nilu.no/ |
1 | ## CMAP2 extracted from an existing colormap |
cmap3 is an interesting colormap which I clipped from an existing figure.
I cut the colorbar from the above figure, read its RGB values, and generate a new colormap
1 | ## CMAP3 from a current colorbar |
1 | # plotting them |
Finally, we can read and visualize the datasets.
1 | # reading the hdf5 data |
Kommentare