Skip to content

Commit aebae10

Browse files
committed
Add winbarbs.
1 parent 5f74b3d commit aebae10

File tree

3 files changed

+152
-2
lines changed

3 files changed

+152
-2
lines changed

documentation/all_docs_ref/all_refs.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
|:-----|:----|:----|:----|:----|:----|:----|:----|
4646
| \myreflink{gravmag3d} | \myreflink{gravfft} | \myreflink{grdgravmag3d} | \myreflink{gravprisms} | \myreflink{magref} | \myreflink{parkergrav} | \myreflink{parkermag} | |
4747

48+
## Supplemental Modules (Others)
49+
| |
50+
|:-----|
51+
| \myreflink{windbarbs} |
52+
4853
## Supplemental Modules (short docs)
4954

5055
{{ generate_tablerefs supplements}}

documentation/modules/windbarbs.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# windbarb
2+
3+
```julia
4+
windbarbs(u, v; kwargs...)
5+
```
6+
7+
Plot wind barb field from two component grids with the *x* and *y* components of the wind field.
8+
9+
---
10+
or
11+
12+
```julia
13+
windbarbs(arg1; kwargs...)
14+
```
15+
16+
Plot wind barb field from a data table with the *x* and *y* components of the wind field.
17+
18+
Description
19+
-----------
20+
21+
Read two 2-D grid files which represents the *x*- and *y*-components of a wind field and produces
22+
a wind field plot by drawing wind barbs with orientation and barbs according to the information in
23+
the files. Alternatively, polar coordinate *r*, *theta* grids may be given instead. Alternatively,
24+
a data table with the *x* and *y* components of the wind field may be given.
25+
26+
Required Arguments
27+
------------------
28+
29+
- *compx* Contains the x-components of the wind field.
30+
31+
- *compy* Contains the y-components of the wind field.
32+
33+
34+
Optional Arguments
35+
------------------
36+
37+
- **A** or **polar** : -- *polar=true*\
38+
The grid files contain polar (r, theta) components instead of Cartesian (x, y) [Default is Cartesian components].
39+
This option is valid only when the input files are 2-D grids.
40+
41+
\textinput{common_opts/opt_B}
42+
43+
\textinput{common_opts/use_cpt_grd}
44+
45+
- **G** or **fill** : -- *fill=fill*\
46+
Sets color or shade for wind barb interiors (see \myreflink{Fill color/pattern}) [Default is no fill].
47+
48+
49+
- **I** or **inc** or **increment** or **spacing** : -- *inc=x_inc* **|** *inc=(x_inc, y_inc)* **|** *inc="x""multx"["/multy"]*\
50+
Only plot wind barbs at nodes every *x\_inc*, *y\_inc* apart (must be multiples of original grid spacing).
51+
Append **m** for arc minutes or **s** for arc seconds. Alternatively, use **inc="x"** to specify the
52+
multiples *multx*[/*multy*] directly [Default plots every node]. Example **inc="x10/5"** to select every other
53+
10 nodes in *x* and 5 nodes in *y*. **_NOTE_**: by default we estimate good values so that the arrows do no
54+
overlap so you may start by jumping this option unless some fine control is desired.
55+
56+
\textinput{common_opts/opt_J}
57+
58+
- **N** or **noclip** or **no\_clip** : *noclip=true*\
59+
Do NOT clip wind barbs at map boundaries [Default will clip].
60+
61+
- **Q** or **barbs** : -- *barbs=(length=length, angle=angle, fill=fill, pen=pen, justify="b|e|c", scale=scale, width=width)*\
62+
Modify wind barb parameters. Append wind barb *length* [Default is 0.5c]. Several modifiers may be
63+
appended to specify the placement of barbs, their shapes, and the justification of the wind barb.
64+
Below, left and right refers to the side of the wind barb line when viewed from the start point to
65+
the end point of the segment. Chose among these modifiers:
66+
67+
- **angle** - Set the angle of the wind barb [120].
68+
- **fill** - Turn off *fill* (if -) or set the wind barb fill [Default fill is used, which may be no fill].
69+
- **pen** - Sets the wind barb pen attributes. If *pen* has a leading **-** then the outline is not drawn
70+
[Default pen is used, and outline is drawn].
71+
- **justify** - Determines how the input *x*, *y* point relates to the wind barb. Choose from **b**eginning
72+
[default], **e**nd, or **c**enter.
73+
- **scale** - Set the wind speed which corresponds to a long barb [default 5].
74+
- **width** - Set the *width* of wind barbs.
75+
76+
\textinput{common_opts/opt_R}
77+
78+
- **T** or **sign_scale** : -- *sign_scale=true*\
79+
Means the azimuths of Cartesian data sets should be adjusted according to the
80+
signs of the scales in the x- and y-directions [Leave alone]. This option can
81+
be used to convert vector azimuths in cases when a negative scale is used in
82+
one of both directions (e.g., positive down).
83+
84+
\textinput{common_opts/opt_U}
85+
86+
\textinput{common_opts/opt_V}
87+
88+
\textinput{common_opts/opt_pen}
89+
90+
\textinput{common_opts/opt_X}
91+
92+
\textinput{common_opts/opt_Y}
93+
94+
- **Z** or **azimuth** : -- *azimuth=true*\
95+
The theta grid provided contains azimuths rather than directions (implies `polar=true`).
96+
This option is valid only when the input files are 2-D grids.
97+
98+
\textinput{common_opts/opt_f}
99+
100+
\textinput{common_opts/opt_p}
101+
102+
\textinput{common_opts/opt_t}
103+
104+
Examples
105+
--------
106+
107+
To draw the wind field given by the files ``r.nc`` and ``theta.nc`` on a
108+
barb plot with 0.25 cm length and centered on the node locations, run:
109+
110+
```julia
111+
windbarb("r.nc", "theta.nc", polar=true, barbs=(len=0.25, justify=:c), show=true)
112+
```
113+
114+
To plot a geographic data sets given the files comp_x.nc and comp_y.nc,
115+
and only plot every 3rd node in either direction, try:
116+
117+
```julia
118+
windbarb("comp_x.nc", "comp_y.nc", inc="x3", proj=:guess, barbs=(len=0.25, justify=:c), show=true)
119+
```
120+
121+
\begin{examplefig}{}
122+
```julia
123+
using GMT
124+
125+
ecmwf(:forecast, var=["10u", "10v"], R="IHO23", prefix="vel")
126+
windbarbs("10u_step0_ifs_oper_fc_20250517_00.grd", "10v_step0_ifs_oper_fc_20250517_00.grd",
127+
barbs=(length=0.25, width=0.15), inc="x10", coast=true, proj=:guess, show=true)
128+
```
129+
\end{examplefig}
130+
131+
See Also
132+
--------
133+
134+
\myreflink{grdcontour}, \myreflink{grdvector}

documentation/utilities/ecmwf.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,23 @@ Download forecast data
138138
Example
139139
-------
140140

141-
Get the latest 10m wind and 2m temperature forecast for today.
141+
Get the latest 10m wind and 2m temperature forecast for the region of North Atlantic.
142142

143143
```julia
144-
ecmwf(:forecast, vars=["10u", "2t"])
144+
ecmwf(:forecast, var=["10u", "10v", "2t"], R="IHO23")
145145
```
146146

147+
Get the 1000, 925 and 850 hPa temperature forecast for the Portugal region. Result is saved in a 3D netCDF file.
148+
149+
```julia
150+
ecmwf(:forecast, var="t", R="PTC", levlist=["1000", "925", "850"])
151+
```
152+
153+
The same as above but now we request 5 time steps of the Temperature at the 1000 hPa level.
154+
155+
```julia
156+
ecmwf(:forecast, var="t", R="PTC", steps=0:3:12)
157+
```
147158

148159
See Also
149160
--------

0 commit comments

Comments
 (0)