source: trunk/UTIL/PYTHON/README.PP @ 511

Last change on this file since 511 was 511, checked in by aslmd, 14 years ago

MESOSCALE: added an 2D idealized test case for mesospheric GW

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