source: lmdz_wrf/trunk/tools/documentation/plotting/vectors.html @ 1553

Last change on this file since 1553 was 1469, checked in by lfita, 8 years ago

Adding:

`draw_basins': Function to plot river basins with their discharge vector and basins id (from 'routing.nc')
`draw_river_desc': Function to plot rivers' description from ORCHIDEE's routing scheme
`draw_subbasin': Function to plot subbasin from 'routnig.nc' ORCDHIEE
`vectors': Function to plot wind vectors

Improving: `vectors'

File size: 10.5 KB
Line 
1<HTML>
2  <HEAD>
3    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8"/>
4    <LINK REL="stylesheet" TYPE="text/css" HREF="../PyNCplot.css"/>
5  </HEAD>
6
7  </HEAD>
8  <BODY>
9    <DIV CLASS="valheader">
10      vector
11    </DIV>
12    <DIV CLASS="valimg">
13      Plotting a vector field
14      <TABLE>
15        <TR><TD><IMG WIDTH="100%" SRC="figs/winds.png"></IMG></TD>
16          <TD><IMG WIDTH="100%" SRC="figs/winds_3dvar.png"></IMG></TD></TR>
17        <TR><TD COLSPAN="2"><IMG WIDTH="50%" SRC="figs/winds_singlecol.png"></IMG></TD></TR>
18      </TABLE>
19    </DIV>
20    <DIV CLASS="valhelp">
21    draw_vector(ncfile, values, varn)<BR>
22    &nbsp;&nbsp;Function to plot wind vectors<BR>
23    &nbsp;&nbsp;ncfile= file to use<BR>
24    &nbsp;&nbsp;values= [dimname]|[vardimname]|[value]:[dimxyfmt]:[vecvals]:[windlabs]:[mapvalues]:[gtit]:[kindfig]:[figuren]:<BR>
25    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[closefig]<BR>
26    &nbsp;&nbsp;&nbsp;&nbsp;'X/Y/Z/T'|[dimname]|[vardimname]|[value]: ',', list for each basic dimension '|' separated of:<BR>
27    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[dimname]: name of the dimension in the file<BR>
28    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[vardimname]: name of the variable with the values for the dimension in the file<BR>
29    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[value]: which value of the given dimension is required:<BR>
30    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* [integer]: which value of the dimension<BR>
31    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* -1: all along the dimension<BR>
32    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* -9: last value of the dimension<BR>
33    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* [beg]:[end] slice from [beg] to [end]<BR>
34    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* NOTE, no dim name all the dimension size<BR>
35    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No value takes all the range of the dimension<BR>
36    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[dimxyfmt]=[dxs],[dxf],[Ndx],[ordx],[dys],[dyf],[Ndy],[ordy]: format of the values at each axis ('auto', for <BR>
37    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'pretty' at both axes)<BR>
38    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[dxs]: style of x-axis ('auto' for 'pretty')<BR>
39    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Nfix', values computed at even 'Ndx'<BR>
40    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Vfix', values computed at even 'Ndx' increments<BR>
41    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'pretty', values computed following aprox. 'Ndx' at 'pretty' intervals 2.,2.5,4,5,10)<BR>
42    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[dxf]: format of the labels at the x-axis<BR>
43    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Ndx]: Number of ticks at the x-axis<BR>
44    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ordx]: angle of orientation of ticks at the x-axis ('auto' for horizontal)<BR>
45    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[dys]: style of y-axis ('auto' for 'pretty')<BR>
46    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[dyf]: format of the labels at the y-axis<BR>
47    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Ndy]: Number of ticks at the y-axis<BR>
48    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ordy]: angle of orientation of ticks at the y-axis ('auto' for horizontal)<BR>
49    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[vecvals]= [frequency],[color],[length]<BR>
50    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[frequency]: [xfreq]@[yfreq] frequency of values allong each axis ('None', all grid points; <BR>
51    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'auto', computed automatically to have 20 vectors along each axis)<BR>
52    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[color]: color of the vectors<BR>
53    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'singlecol'@[colorn]: all the vectors same color ('auto': for 'red') and lengths according to wind's module<BR>
54    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'wind'@[colorbar]@[sminv]|[smaxv]: color of the vectors according to wind speed sqrt(u^2+v^2) <BR>
55    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and given [colorbar] all vectors the same length<BR>
56    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[smin/axv]: minimum and maximum value for the shading or:<BR>
57    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Srange': for full range<BR>
58    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Saroundmean@val': for mean-xtrm,mean+xtrm where xtrm = np.min(mean-min@val,max@val-mean)<BR>
59    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Saroundminmax@val': for min*val,max*val<BR>
60    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Saroundpercentile@val': for median-xtrm,median+xtrm where xtrm = np.min(median-percentile_(val),<BR>
61    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;percentile_(100-val)-median)<BR>
62    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Smean@val': for -xtrm,xtrm where xtrm = np.min(mean-min*@val,max*@val-mean)<BR>
63    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Smedian@val': for -xtrm,xtrm where xtrm = np.min(median-min@val,max@val-median)<BR>
64    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val),<BR>
65    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;percentile_(100-val)-median) <BR>
66    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'3rdvar'@[colorbar]@[varn]@[units]@[sminv]|[smaxv]: color of the vectors according to a 3rd variable <BR>
67    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(to be added at -v) and given [colorbar] all vectors the same length<BR>
68    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[colorbar]: name of the colornbar to use<BR>
69    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[varn]: name of the variable to pick up values<BR>
70    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[units]: units of the variable<BR>
71    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[sminv]|[smaxv]: minimum and maximum value for the shading or:<BR>
72    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Srange': for full range<BR>
73    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Saroundmean@val': for mean-xtrm,mean+xtrm where xtrm = np.min(mean-min@val,max@val-mean)<BR>
74    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Saroundminmax@val': for min*val,max*val<BR>
75    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Saroundpercentile@val': for median-xtrm,median+xtrm where xtrm = np.min(median-percentile_(val),<BR>
76    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;percentile_(100-val)-median)<BR>
77    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Smean@val': for -xtrm,xtrm where xtrm = np.min(mean-min*@val,max*@val-mean)<BR>
78    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Smedian@val': for -xtrm,xtrm where xtrm = np.min(median-min@val,max@val-median)<BR>
79    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Spercentile@val': for -xtrm,xtrm where xtrm = np.min(median-percentile_(val),<BR>
80    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;percentile_(100-val)-median)<BR>
81    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[length]: length of the wind vectors ('auto', for 9)<BR>
82    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[windlabs]= [windname],[windunits]<BR>
83    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[windname]: name of the wind variable in the graph<BR>
84    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[windunits]: units of the wind variable in the graph ('None', for the value in the file)<BR>
85    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[mapvalues]= map characteristics: [proj],[res]<BR>
86    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;see full documentation: http://matplotlib.org/basemap/<BR>
87    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[proj]: projection<BR>
88    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* 'cyl', cilindric<BR>
89    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* 'lcc', lambert conformal<BR>
90    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[res]: resolution:<BR>
91    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* 'c', crude<BR>
92    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* 'l', low<BR>
93    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* 'i', intermediate<BR>
94    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* 'h', high<BR>
95    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* 'f', full<BR>
96    &nbsp;&nbsp;&nbsp;&nbsp;gtit= title of the graph ('!', for spaces)<BR>
97    &nbsp;&nbsp;&nbsp;&nbsp;kindfig= kind of figure<BR>
98    &nbsp;&nbsp;&nbsp;&nbsp;figuren= name of the figure<BR>
99    &nbsp;&nbsp;&nbsp;&nbsp;closefig= whether the figure should be closed<BR>
100    &nbsp;&nbsp;ncfile= file to use<BR>
101    &nbsp;&nbsp;varns= [uwind],[ywind] ',' list of the name of the variables with the u-wind,y-wind component<BR>
102    </DIV>
103    <DIV CLASS="valins">
104      $ python ${pyHOME}/drawing.py -o draw_vectors -f ~/PY/wrfout_d01_1995-01-01_00:00:00 -S 'T|Time|Times|2,Y|south_north|XLAT|-1,X|west_east|XLONG|-1:auto:3@3,wind@rainbow@Srange|Srange,9:10m wind,ms-1:cyl,l:WRF!10!m!winds!on!Dec.!1st!1995!06!UTC:png:winds:yes' -v U10,V10<BR>
105      $ python ${pyHOME}/drawing.py -o draw_vectors -f ~/PY/wrfout_d01_1995-01-01_00:00:00 -S 'T|Time|Times|2,Y|south_north|XLAT|-1,X|west_east|XLONG|-1:auto:3@3,singlecol@red,9:10m wind,ms-1:cyl,l:WRF!10!m!winds!on!Dec.!1st!1995!06!UTC:png:winds:yes' -v U10,V10<BR>
106      $ python ${pyHOME}/drawing.py -o draw_vectors -f ~/PY/wrfout_d01_1995-01-01_00:00:00 -S 'T|Time|Times|2,Y|south_north|XLAT|-1,X|west_east|XLONG|-1:auto:3@3,3rdvar@BuPu@huss@kgkg-1@0.|0.02,9:10m wind,ms-1:cyl,l:WRF!10!m!winds!&!huss!on!Dec.!1st!1995!06!UTC:png:winds:yes' -v U10,V10,Q2<BR>
107    </DIV>
108  </BODY>
109</HTML>
110
Note: See TracBrowser for help on using the repository browser.