[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 | |
---|
[451] | 14 | ***************************************************************** |
---|
| 15 | MAPMODE 1... MAPPING MODE... SIMPLE EXAMPLES on a SAMPLE GCM FILE |
---|
| 16 | ***************************************************************** |
---|
[394] | 17 | Goal: The simplest, most minimal example. Mapping topography. |
---|
[392] | 18 | pp.py -f diagfired.nc |
---|
[378] | 19 | |
---|
[392] | 20 | Goal: I would like finer contours. |
---|
| 21 | pp.py -f diagfired.nc --div 30 |
---|
[378] | 22 | |
---|
[394] | 23 | Goal: I would like wind vectors. |
---|
| 24 | pp.py -f diagfired.nc -W |
---|
| 25 | |
---|
[392] | 26 | Goal: I would like more vectors [i.e. lower the stride]. |
---|
[394] | 27 | pp.py -f diagfired.nc -W -s 1 |
---|
[392] | 28 | |
---|
| 29 | Goal: I want to map a given field (surface temperature). |
---|
[394] | 30 | pp.py -f diagfired.nc -v tsurf |
---|
[392] | 31 | |
---|
| 32 | Goal: I want to map two fields next to one another (topography and tauice). |
---|
[394] | 33 | pp.py -f diagfired.nc -v phisinit,tauice |
---|
[392] | 34 | |
---|
| 35 | Goal: I want to map two fields, tauice shaded, topography contoured, same plot. |
---|
[394] | 36 | pp.py -f diagfired.nc -v tauice -w phisinit |
---|
[392] | 37 | |
---|
| 38 | Goal: I want to map a field but projected on the sphere. |
---|
[394] | 39 | pp.py -f diagfired.nc -v tauice -p ortho |
---|
[392] | 40 | |
---|
| 41 | Goal: I want to redefine the minimum and maximum values shown. |
---|
[394] | 42 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 |
---|
[392] | 43 | |
---|
| 44 | Goal: I want to insert holes wherever values are lower than 0.2 and higher than 0.9 |
---|
[394] | 45 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H |
---|
[392] | 46 | |
---|
| 47 | Goal: I want to fill holes with an background image of Mars [you have to be connected to Internet] |
---|
[394] | 48 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires |
---|
[392] | 49 | |
---|
| 50 | Goal: I want the same map, but projected on the sphere |
---|
[394] | 51 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p ortho |
---|
[392] | 52 | |
---|
| 53 | Goal: I want the same map, but projected with north polar stereographic view |
---|
[394] | 54 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p npstere |
---|
[392] | 55 | |
---|
[453] | 56 | Goal: I want the same map, but with a transparent field to see background image |
---|
| 57 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p npstere --trans 0.6 |
---|
| 58 | |
---|
[392] | 59 | Goal: I want to save this in PNG format |
---|
[394] | 60 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p ortho -S png |
---|
[392] | 61 | |
---|
[436] | 62 | Goal: I want to animate this along time axis with fps=12 |
---|
| 63 | pp.py -f diagfired.nc -v tauice -m 0.2 -M 0.9 -H -b vishires -p ortho --rate 12 |
---|
| 64 | |
---|
[392] | 65 | Goal: I want to plot results from two simulation files next to one another |
---|
[424] | 66 | pp.py -f diagfired.nc,diagfired.nc -v tsurf |
---|
[392] | 67 | |
---|
[424] | 68 | Goal: I want to plot results for two different times in the file next to one another |
---|
[448] | 69 | pp.py -f diagfi.nc -v tsurf --time 4 --time 7 |
---|
[424] | 70 | |
---|
| 71 | Goal: I want to plot averaged results in the file from one time to another time |
---|
| 72 | pp.py -f diagfi.nc -v tsurf --time 4,7 |
---|
| 73 | |
---|
[451] | 74 | [only mesoscale for the moment] |
---|
[424] | 75 | Goal: I want to plot results for two different LOCAL times in the file next to one another |
---|
| 76 | pp.py -f wrfout**** -v TSURF --time -4 -- time -7 |
---|
| 77 | |
---|
[451] | 78 | *********************************************************************************** |
---|
| 79 | EXAMPLE : The classic mountain GW plot |
---|
| 80 | *********************************************************************************** |
---|
[429] | 81 | 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] | 82 | *********************************************************************************** |
---|
[429] | 83 | |
---|
[378] | 84 | *********************************************************************************** |
---|
[451] | 85 | COMMENTED EXAMPLE : The globe with surface temperature and winds |
---|
| 86 | *********************************************************************************** |
---|
| 87 | 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 |
---|
| 88 | *********************************************************************************** |
---|
| 89 | See results here: http://www.lmd.jussieu.fr/~aslmd/EXAMPLES/LMD_GCM_movie_tsurf_UV/anim.html |
---|
| 90 | *********************************************************************************** |
---|
| 91 | pp.py -f diagfired.nc |
---|
| 92 | OK. You probably get that one. |
---|
| 93 | -v tsurf -w phisinit |
---|
| 94 | Shade surface temperature. Contour topography. |
---|
| 95 | -m 120 -M 320 --div 20 |
---|
| 96 | Surface temperature is shown with bounds 120K to 320K. Use 20 levels for shading. |
---|
| 97 | -W -s 1 |
---|
| 98 | Include wind vectors. Prescribe a stride of 1: vectors are shown at every grid point. |
---|
| 99 | --vert 0 |
---|
| 100 | Show fields in the first (lowermost) level. |
---|
| 101 | -p ortho --blat 20 --blon -80 |
---|
| 102 | Use orthographic projection ('whole sphere' view). Center view on lon -80E and lat 20N. |
---|
| 103 | -S html |
---|
| 104 | Make nice webpage with animation and controls. |
---|
| 105 | -t /u/aslmd/WWW/EXAMPLES |
---|
| 106 | Move resulting plot files to the given folder. |
---|
| 107 | |
---|
| 108 | *********************************************************************************** |
---|
| 109 | COMMENTED EXAMPLE : The dust storm section movie |
---|
| 110 | *********************************************************************************** |
---|
| 111 | 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 |
---|
| 112 | *********************************************************************************** |
---|
| 113 | See results here: http://www.lmd.jussieu.fr/~aslmd/EXAMPLES/LMD_MMM_d1_10km_movie_QDUST_-1000m-AMR_lat_-3_Ls134.8/anim.html |
---|
| 114 | *********************************************************************************** |
---|
| 115 | pp.py |
---|
| 116 | OK. You probably get that one. |
---|
| 117 | -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 |
---|
| 118 | Mesoscale outputs are splitted in several files. In that case, this was 1 file per 6 simulated hours. |
---|
| 119 | The above options allow to concatenate files along time axis for 1D time series or animated movies |
---|
| 120 | [if --operation cat is omitted, this is a multiplot call, with one subplot per files in -f]. |
---|
| 121 | -v QDUST |
---|
| 122 | Choose to plot dust mass mixing ratio. |
---|
| 123 | -i 3 -l -1,37,100 |
---|
| 124 | 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. |
---|
| 125 | -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. |
---|
| 126 | --div 30 |
---|
| 127 | The number of contours used for shaded plots. Higher value means smoother appearance. |
---|
| 128 | -c Oranges_r |
---|
| 129 | Choose a colorbar adapted to display a dust storm. |
---|
| 130 | -m 0. -M 5.e-5 |
---|
| 131 | Choose bounds for the plotted field. This one is adapted to show dust mass mixing ratio. |
---|
| 132 | -t $W |
---|
| 133 | Put resulting figure or movie in another destination folder. |
---|
| 134 | Personally I have an environnement variable W which is somewhere in my system where the file automatically appears on the web, |
---|
| 135 | hence is easy to see from a remote place. |
---|
| 136 | --rate 12 --lat -3. |
---|
| 137 | Define prescribed axis. A section in latitude -3°N. A time animation with 12 frame per seconds. |
---|
| 138 | So the displayed field will be an altitude/longitude section. Alternative: "-S avi" instead of "--rate 12" creates a default 8 fps movie. |
---|
| 139 | Alternative II: "-S html" instead of --rate 12 creates a nice webpage. |
---|
| 140 | --xmin=5 --xmax=115 |
---|
| 141 | Define limits for the displayed section. Here we just want to get rid of transition rows where atmospheric fields are |
---|
| 142 | relaxed towards prescribed GCM fields. |
---|
| 143 | |
---|
| 144 | *********************************************************************************** |
---|
[378] | 145 | Simple 2D plot: Zonal mean. |
---|
| 146 | ********************************************************************************** |
---|
| 147 | |
---|
| 148 | Goal: |
---|
| 149 | |
---|
| 150 | Plot the zonal mean temperature from a netcdf fiel representing one month. |
---|
| 151 | |
---|
| 152 | Command: |
---|
| 153 | |
---|
| 154 | gcm.py -f POLAR_NIGHT_RUN/diagfi16.nc --var temp --lon 180,-180 --time 0,65 |
---|
| 155 | |
---|
| 156 | Note: |
---|
| 157 | |
---|
| 158 | 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. |
---|
| 159 | |
---|
| 160 | Means are easy to perform by specifying a range. Here: --time 0,65 and --lat -180,180. |
---|
| 161 | |
---|
| 162 | *********************************************************************************** |
---|
| 163 | Vertical interpolation of the field. |
---|
| 164 | *********************************************************************************** |
---|
| 165 | |
---|
| 166 | Goal: |
---|
| 167 | |
---|
| 168 | 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. |
---|
| 169 | |
---|
| 170 | Command: |
---|
| 171 | |
---|
| 172 | gcm.py -f POLAR_NIGHT_RUN/diagfi16.nc --var temp --lon -180,180 --time 0,65 -i 4 |
---|
| 173 | |
---|
| 174 | Note: |
---|
| 175 | |
---|
| 176 | 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. |
---|
| 177 | |
---|
| 178 | 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. |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | *********************************************************************************** |
---|
| 182 | 2D plot of the difference between two files. |
---|
| 183 | *********************************************************************************** |
---|
| 184 | |
---|
| 185 | Goal: |
---|
| 186 | |
---|
| 187 | 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. |
---|
| 188 | |
---|
| 189 | Command: |
---|
| 190 | |
---|
| 191 | gcm.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" |
---|
| 192 | |
---|
| 193 | Note: |
---|
| 194 | |
---|
| 195 | 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). |
---|
| 196 | |
---|
| 197 | One can combine this command with projections and means, so that for example, to compare co2 depletion at the south pole: |
---|
| 198 | |
---|
| 199 | gcm.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" |
---|
| 200 | |
---|
| 201 | *********************************************************************************** |
---|
| 202 | 2D plot of data with missing values, along a pressure axis (decreasing with height). |
---|
| 203 | *********************************************************************************** |
---|
| 204 | |
---|
| 205 | Goal: |
---|
| 206 | |
---|
| 207 | 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. |
---|
| 208 | |
---|
| 209 | Command: |
---|
| 210 | |
---|
| 211 | gcm.py -f TES.MappedClimatology.nadir.MY25.nc --var T_nadir_day --lat -76. --time 90 --ymin 500 --ymax 1 -m 128 -M 148 -H |
---|
| 212 | |
---|
| 213 | Note: |
---|
| 214 | |
---|
| 215 | 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". |
---|