When you’ve got the all the files from WRF simulations, you might want to merge them without the spin-up frames (to reach a balanced state with the boundary conditions, i.e., 12 hours for a 5-day simulation). Meanwhile, the variables/grids which are not focused on can be ignore. Therefore, a general workflow in pythonic way is presented. I will also rewritten this function as my first Python Package. Please note the updates on my website.
1. Pretreatment
In this post, the technique applied here is to extracting five meteorological variables for several grids. Those variables contain wind speed (ws), wind direction (wd), relative humidity (RH), planetal boundary layer height (PBLH), Temperature at 2 m above ground (T2) and precipitation (PREP). Noticed that ws, wd and rh are not directly derived from standard output, some essential steps should be implemented.
1 | """ |
Those functions were wrote in an independent file (function_lib.py) for further importing.
2. Main function
Now that we have the pre-defined tools, we can proceed to read and merge all the outputs into one hdf5 file.
1 | from netCDF4 import Dataset |
And after those scripts completed successfully, we have merged all the targetd variables for the spots of interest. In our furture post, the technique dealing with a 2-d griided system (i.e., a city) will be presented.
Kommentare