[392] | 1 | ************************************** |
---|
| 2 | ************************************** |
---|
| 3 | ************************************** |
---|
| 4 | PLANETOPLOT TUTORIAL EXAMPLES |
---|
| 5 | ************************************** |
---|
| 6 | Authors : AC + AS |
---|
| 7 | ************************************** |
---|
| 8 | DON'T FORGET YOUR BEST FRIEND IS |
---|
| 9 | pp.py -h [or] pp.py --help |
---|
| 10 | ************************************** |
---|
| 11 | ************************************** |
---|
| 12 | ************************************** |
---|
[378] | 13 | |
---|
[723] | 14 | The program pp.py works on virtually any NETCDF file. |
---|
| 15 | If not, please contact us, it is usually an easy fix to make it work. |
---|
| 16 | |
---|
[944] | 17 | NB: To use the movie capability, you will have to install mencoder. |
---|
| 18 | NB: To use advance interpolation methods for GCM and mesoscale files, you will have to compile fortran routines with f2py (or compile those independently). |
---|
| 19 | |
---|
[504] | 20 | ************************************ |
---|
| 21 | SIMPLE EXAMPLES on a SAMPLE GCM FILE |
---|
| 22 | ************************************ |
---|
[394] | 23 | Goal: The simplest, most minimal example. Mapping topography. |
---|
[392] | 24 | pp.py -f diagfired.nc |
---|
[378] | 25 | |
---|
[392] | 26 | Goal: I would like finer contours. |
---|
| 27 | pp.py -f diagfired.nc --div 30 |
---|
[378] | 28 | |
---|
[394] | 29 | Goal: I would like wind vectors. |
---|
| 30 | pp.py -f diagfired.nc -W |
---|
| 31 | |
---|
[392] | 32 | Goal: I would like more vectors [i.e. lower the stride]. |
---|
[394] | 33 | pp.py -f diagfired.nc -W -s 1 |
---|
[392] | 34 | |
---|
| 35 | Goal: I want to map a given field (surface temperature). |
---|
[394] | 36 | pp.py -f diagfired.nc -v tsurf |
---|
[392] | 37 | |
---|
| 38 | Goal: I want to map two fields next to one another (topography and tauice). |
---|
[394] | 39 | pp.py -f diagfired.nc -v phisinit,tauice |
---|
[392] | 40 | |
---|
| 41 | Goal: I want to map two fields, tauice shaded, topography contoured, same plot. |
---|
[394] | 42 | pp.py -f diagfired.nc -v tauice -w phisinit |
---|
[392] | 43 | |
---|
| 44 | Goal: I want to map a field but projected on the sphere. |
---|
[394] | 45 | pp.py -f diagfired.nc -v tauice -p ortho |
---|
[392] | 46 | |
---|
| 47 | Goal: I want to redefine the minimum and maximum values shown. |
---|
[394] | 48 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 |
---|
[392] | 49 | |
---|
| 50 | Goal: I want to insert holes wherever values are lower than 0.2 and higher than 0.9 |
---|
[394] | 51 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H |
---|
[392] | 52 | |
---|
| 53 | Goal: I want to fill holes with an background image of Mars [you have to be connected to Internet] |
---|
[394] | 54 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires |
---|
[392] | 55 | |
---|
| 56 | Goal: I want the same map, but projected on the sphere |
---|
[394] | 57 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p ortho |
---|
[392] | 58 | |
---|
[504] | 59 | Goal: I want the same map, but projected on the sphere and centered on longitude 100° |
---|
| 60 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p ortho --blon -100 |
---|
| 61 | |
---|
[392] | 62 | Goal: I want the same map, but projected with north polar stereographic view |
---|
[394] | 63 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p npstere |
---|
[392] | 64 | |
---|
[453] | 65 | Goal: I want the same map, but with a transparent field to see background image |
---|
| 66 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p npstere --trans 0.6 |
---|
| 67 | |
---|
[392] | 68 | Goal: I want to save this in PNG format |
---|
[394] | 69 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p ortho -S png |
---|
[392] | 70 | |
---|
[511] | 71 | Goal: I want to animate this along time axis |
---|
| 72 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p ortho -S avi |
---|
| 73 | |
---|
[436] | 74 | Goal: I want to animate this along time axis with fps=12 |
---|
| 75 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p ortho --rate 12 |
---|
| 76 | |
---|
[392] | 77 | Goal: I want to plot results from two simulation files next to one another |
---|
[424] | 78 | pp.py -f diagfired.nc,diagfired.nc -v tsurf |
---|
[392] | 79 | |
---|
[424] | 80 | Goal: I want to plot results for two different times in the file next to one another |
---|
[504] | 81 | pp.py -f diagfired.nc -v tsurf --time 0.5 --time 0.9 |
---|
[424] | 82 | |
---|
| 83 | Goal: I want to plot averaged results in the file from one time to another time |
---|
[504] | 84 | pp.py -f diagfired.nc -v tsurf --time 0.5,0.9 |
---|
[424] | 85 | |
---|
[483] | 86 | Goal: I want to plot the minimum/maximum value over times stored in the file |
---|
[504] | 87 | pp.py -f diagfired.nc -v tsurf --redope mint |
---|
| 88 | pp.py -f diagfired.nc -v tsurf --redope maxt |
---|
[483] | 89 | |
---|
[504] | 90 | Goal: I want to plot a section of temperature at longitude 0 |
---|
| 91 | pp.py -f diagfired.nc --var temp --lon 0 --time 0.5 |
---|
| 92 | |
---|
| 93 | Goal: I want to plot a section of zonally-averaged temperature |
---|
| 94 | pp.py -f diagfired.nc -v temp --lon -180,180 --time 0.5 |
---|
| 95 | |
---|
| 96 | Goal: I want to plot a section of zonally-averaged temperature with contours of zonally-averaged zonal wind |
---|
| 97 | pp.py -f diagfired.nc -v temp -w u --lon -180,180 --time 0.5 |
---|
| 98 | |
---|
| 99 | Goal: I want to plot a section of zonally-averaged temperature and zonally-averaged zonal wind |
---|
| 100 | pp.py -f diagfired.nc -v temp,u --lon -180,180 --time 0.5 |
---|
| 101 | |
---|
[475] | 102 | Goal: I want to plot a globally-averaged 1D temperature profile |
---|
[504] | 103 | pp.py -f diagfired.nc -v temp --time 0.5 --lat -90,90 --lon -180,180 |
---|
[475] | 104 | |
---|
| 105 | Goal: I want to overplot few globally-averaged 1D temperature profiles at different times |
---|
[504] | 106 | pp.py -f diagfired.nc -v temp --time 0.5 --time 0.9 --lat -90,90 --lon -180,180 |
---|
[475] | 107 | |
---|
[504] | 108 | Goal: I want to overplot lat=0,lon=0 1D temperature profiles at different times |
---|
| 109 | pp.py -f diagfired.nc -v temp --time 0.5 --time 0.9 --lat 0 --lon 0 --ymax 20 --xmin 180. |
---|
| 110 | |
---|
| 111 | ******************** [specific mesoscale] |
---|
| 112 | |
---|
[424] | 113 | Goal: I want to plot results for two different LOCAL times in the file next to one another |
---|
[504] | 114 | pp.py -f wrfout_d01_2024-05-03_01:00:00 -v TSURF --time 4 --time 7 --axtime lt |
---|
[424] | 115 | |
---|
[504] | 116 | Goal: I want to plot a section of temperature at longitude -120 between AMR altitudes 0 km and 30 km with 50 levels |
---|
| 117 | pp.py -f wrfout_d01_2024-05-03_01:00:00 -v tk --time 4 --axtime lt --lon -120 -i 3 -l 0,30,50 |
---|
| 118 | |
---|
| 119 | Goal: I want to plot a section of temperature at longitude -120 between ALS altitudes 0 km and 30 km with 50 levels |
---|
| 120 | pp.py -f wrfout_d01_2024-05-03_01:00:00 -v tk --time 4 --axtime lt --lon -120 -i 4 -l 0,30,50 |
---|
| 121 | |
---|
[451] | 122 | *********************************************************************************** |
---|
| 123 | EXAMPLE : The classic mountain GW plot |
---|
| 124 | *********************************************************************************** |
---|
[429] | 125 | pp.py -f wrfout_d01_9999-09-09_09:00:00 -v W,tpot --lat 60 --time 15 -i 4 -l 30,130,100 --div 50 |
---|
[451] | 126 | *********************************************************************************** |
---|
[429] | 127 | |
---|
[378] | 128 | *********************************************************************************** |
---|
[518] | 129 | EXAMPLE : Plotting surface temperature maps from TES |
---|
| 130 | *********************************************************************************** |
---|
| 131 | pp.py -f TES/TES.MappedClimatology.nadir.MY25.nc -v Tsurf_day -p npstere --blat 60 --trans 0.5 -b vishires --time 50 |
---|
| 132 | *********************************************************************************** |
---|
| 133 | pp.py -f /d5/emlmd/TES/TES.MappedClimatology.nadir.MY25.nc,/d5/emlmd/TES/TES.MappedClimatology.nadir.MY26.nc -p npstere -v Tsurf_day --time 90,105 --time 105,120 --time 120,135 --time 135,150 --blat 70 --div 30 -m 190 -M 270 -b vishires --trans 0.7 |
---|
| 134 | *********************************************************************************** |
---|
| 135 | pp.py -f /d5/emlmd/TES/TES.MappedClimatology.nadir.MY25.nc,/d5/emlmd/TES/TES.MappedClimatology.nadir.MY26.nc -p npstere -v Tsurf_day --time 110,130 --blat 70 --div 30 -m 190 -M 270 -b vishires --trans 0.7 -c onebar --title "Surface temperature (K)" |
---|
| 136 | *********************************************************************************** |
---|
[781] | 137 | dust from TES |
---|
| 138 | pp.py -f TES.MappedClimatology.nadir.MY25.nc -v tau_dust -p cyl -c Oranges -m 0.0 -M 2.0 --div 20 --trans 0.8 -b molabw -S avi -T |
---|
[518] | 139 | |
---|
| 140 | *********************************************************************************** |
---|
[451] | 141 | COMMENTED EXAMPLE : The globe with surface temperature and winds |
---|
| 142 | *********************************************************************************** |
---|
| 143 | pp.py -f diagfired.nc -v tsurf -w phisinit -m 120 -M 320 --div 20 -W -s 1 --vert 0 -p ortho --blat 20 --blon -80 -S html -t $W |
---|
| 144 | *********************************************************************************** |
---|
| 145 | See results here: http://www.lmd.jussieu.fr/~aslmd/EXAMPLES/LMD_GCM_movie_tsurf_UV/anim.html |
---|
| 146 | *********************************************************************************** |
---|
| 147 | pp.py -f diagfired.nc |
---|
| 148 | OK. You probably get that one. |
---|
| 149 | -v tsurf -w phisinit |
---|
| 150 | Shade surface temperature. Contour topography. |
---|
| 151 | -m 120 -M 320 --div 20 |
---|
| 152 | Surface temperature is shown with bounds 120K to 320K. Use 20 levels for shading. |
---|
| 153 | -W -s 1 |
---|
| 154 | Include wind vectors. Prescribe a stride of 1: vectors are shown at every grid point. |
---|
| 155 | --vert 0 |
---|
| 156 | Show fields in the first (lowermost) level. |
---|
| 157 | -p ortho --blat 20 --blon -80 |
---|
| 158 | Use orthographic projection ('whole sphere' view). Center view on lon -80E and lat 20N. |
---|
| 159 | -S html |
---|
| 160 | Make nice webpage with animation and controls. |
---|
| 161 | -t /u/aslmd/WWW/EXAMPLES |
---|
| 162 | Move resulting plot files to the given folder. |
---|
| 163 | |
---|
| 164 | *********************************************************************************** |
---|
| 165 | COMMENTED EXAMPLE : The dust storm section movie |
---|
| 166 | *********************************************************************************** |
---|
| 167 | pp.py -f wrfout_d01_2024-05-30_12:00:00,wrfout_d01_2024-05-30_18:00:00,wrfout_d01_2024-05-31_00\:00\:00 --operation cat -v QDUST --lat -3. -i 3 -l -1,37,100 --div 30 -c Oranges_r -m 0. -M 5.e-5 -t $W --rate 12 --xmin=5 --xmax=115 |
---|
| 168 | *********************************************************************************** |
---|
| 169 | See results here: http://www.lmd.jussieu.fr/~aslmd/EXAMPLES/LMD_MMM_d1_10km_movie_QDUST_-1000m-AMR_lat_-3_Ls134.8/anim.html |
---|
| 170 | *********************************************************************************** |
---|
| 171 | pp.py |
---|
| 172 | OK. You probably get that one. |
---|
| 173 | -f wrfout_d01_2024-05-30_12:00:00,wrfout_d01_2024-05-30_18:00:00,wrfout_d01_2024-05-31_00\:00\:00 --operation cat |
---|
| 174 | Mesoscale outputs are splitted in several files. In that case, this was 1 file per 6 simulated hours. |
---|
| 175 | The above options allow to concatenate files along time axis for 1D time series or animated movies |
---|
| 176 | [if --operation cat is omitted, this is a multiplot call, with one subplot per files in -f]. |
---|
| 177 | -v QDUST |
---|
| 178 | Choose to plot dust mass mixing ratio. |
---|
| 179 | -i 3 -l -1,37,100 |
---|
| 180 | Set a call to vertical interpolator [compiled with f2py, thereby being embedded as a Python routine] for each of the files in the -f instance. |
---|
| 181 | -i sets the kind of interpolation, 3 means Above MOLA Reference Altitude. -l sets the range for altitude levels: from -1 km to 37 km with 100 levels. |
---|
| 182 | --div 30 |
---|
| 183 | The number of contours used for shaded plots. Higher value means smoother appearance. |
---|
| 184 | -c Oranges_r |
---|
| 185 | Choose a colorbar adapted to display a dust storm. |
---|
| 186 | -m 0. -M 5.e-5 |
---|
| 187 | Choose bounds for the plotted field. This one is adapted to show dust mass mixing ratio. |
---|
| 188 | -t $W |
---|
| 189 | Put resulting figure or movie in another destination folder. |
---|
| 190 | Personally I have an environnement variable W which is somewhere in my system where the file automatically appears on the web, |
---|
| 191 | hence is easy to see from a remote place. |
---|
| 192 | --rate 12 --lat -3. |
---|
| 193 | Define prescribed axis. A section in latitude -3°N. A time animation with 12 frame per seconds. |
---|
| 194 | So the displayed field will be an altitude/longitude section. Alternative: "-S avi" instead of "--rate 12" creates a default 8 fps movie. |
---|
| 195 | Alternative II: "-S html" instead of --rate 12 creates a nice webpage. |
---|
| 196 | --xmin=5 --xmax=115 |
---|
| 197 | Define limits for the displayed section. Here we just want to get rid of transition rows where atmospheric fields are |
---|
| 198 | relaxed towards prescribed GCM fields. |
---|
| 199 | |
---|
[504] | 200 | |
---|
[451] | 201 | *********************************************************************************** |
---|
[378] | 202 | Simple 2D plot: Zonal mean. |
---|
| 203 | ********************************************************************************** |
---|
| 204 | |
---|
| 205 | Goal: |
---|
| 206 | |
---|
[504] | 207 | Plot the zonal mean temperature from a netcdf field representing one month. |
---|
[378] | 208 | |
---|
| 209 | Command: |
---|
| 210 | |
---|
[504] | 211 | pp.py -f POLAR_NIGHT_RUN/diagfi16.nc --var temp --lon 180,-180 --time 0,65 |
---|
[378] | 212 | |
---|
| 213 | Note: |
---|
| 214 | |
---|
| 215 | The --time, --lat, --lon and --vert command takes in input values corresponding to the unit stored in the netcdf file, and not indices ! For example, if the "Time" unit is in sol (which is common for a gcm output), --time 2 means sol 2.0 and not index 2 along the time direction. Consequently, one can ask --time 2.5 for temperatures at 12:00 on sol 2. |
---|
| 216 | |
---|
| 217 | Means are easy to perform by specifying a range. Here: --time 0,65 and --lat -180,180. |
---|
| 218 | |
---|
| 219 | *********************************************************************************** |
---|
| 220 | Vertical interpolation of the field. |
---|
| 221 | *********************************************************************************** |
---|
| 222 | |
---|
| 223 | Goal: |
---|
| 224 | |
---|
| 225 | Calls to zrecast and api are built-in the python functions. One can call them using -i with the appropriate argument (see meso.py -h or gcm.py -h). Here is an example that re-interpolates data using zrecast before plotting it in a 2D contour. |
---|
| 226 | |
---|
| 227 | Command: |
---|
| 228 | |
---|
[504] | 229 | pp.py -f POLAR_NIGHT_RUN/diagfi16.nc --var temp --lon -180,180 --time 0,65 -i 4 |
---|
[378] | 230 | |
---|
| 231 | Note: |
---|
| 232 | |
---|
| 233 | All interpolation modes available in zrecast and api (pressure, AGL, distance from planet center, etc...) are theoretically possible, but may not be coded yet in the routine. See gcm.py -h or meso.py -h. |
---|
| 234 | |
---|
| 235 | For this example, the default behavior of zrecast for -i 4 is to interpolate in (m) from the local surface, between 0 and 150 km. The command will generate a reinterpolated netcdf file "POLAR_NIGHT_RUN/diagfi16_S.nc" with only the requested field, which is not deleted afterward. |
---|
| 236 | |
---|
| 237 | |
---|
| 238 | *********************************************************************************** |
---|
| 239 | 2D plot of the difference between two files. |
---|
| 240 | *********************************************************************************** |
---|
| 241 | |
---|
| 242 | Goal: |
---|
| 243 | |
---|
| 244 | Comparing two .nc files with similar dimension axis can be done in a single command, by specifying which files to compare and the comparison operator (i.e. is it a difference, an addition, etc...). When comparing data along a vertical axis, it can be wise to also ask for an interpolation of the fields to make sure the comparison is correct. |
---|
| 245 | |
---|
| 246 | Command: |
---|
| 247 | |
---|
[504] | 248 | pp.py -f POLAR_NIGHT_RUN/stats16.nc --var temp --lon -180,180 --time 1 -i 4 --fref POLAR_NIGHT_REF/stats16.nc --operation - --mope -2 --Mope 2 --title "Polar temperatures with new parametrizations" --titleref "Reference run" |
---|
[378] | 249 | |
---|
| 250 | Note: |
---|
| 251 | |
---|
| 252 | The command will output 3 plots: the field from file 1, the field from file 2, and the comparison between the two. One can specify specific names for the title of these plots by using --title and --titleref for the titles of file 1 and file 2, and can specify different plotting range for the normal field (-m -M) and the compared field (--mope --Mope). |
---|
| 253 | |
---|
| 254 | One can combine this command with projections and means, so that for example, to compare co2 depletion at the south pole: |
---|
| 255 | |
---|
[504] | 256 | pp.py -f POLAR_NIGHT_RUN/start16.nc --var co2 --vert 0,150 --proj spstere --time 1 -i 4 --fref POLAR_NIGHT_REF/start16.nc --operation - --mope -0.5 --Mope 0.5 --title "Polar co2 with new parametrizations" --titleref "Reference run" |
---|
[378] | 257 | |
---|
| 258 | *********************************************************************************** |
---|
| 259 | 2D plot of data with missing values, along a pressure axis (decreasing with height). |
---|
| 260 | *********************************************************************************** |
---|
| 261 | |
---|
| 262 | Goal: |
---|
| 263 | |
---|
| 264 | By default, python will force the y-axis of a 2D plot to be ordered by increasing values. Here is how to force it otherwise. |
---|
| 265 | |
---|
| 266 | Command: |
---|
| 267 | |
---|
[504] | 268 | pp.py -f TES.MappedClimatology.nadir.MY25.nc --var T_nadir_day --lat -76. --time 90 --ymin 500 --ymax 1 -m 128 -M 148 -H |
---|
[378] | 269 | |
---|
| 270 | Note: |
---|
| 271 | |
---|
| 272 | The axis reversal is done by specifying ymin and ymax in the right order. One can also simply use --inverty and not specify (ymin,ymax). Missing values (out of range values) are replaced by holes by the option "-H". |
---|