Create the wind barbs. Parameters ---------- u, v Components of the vector in the x and y directions, respectively. nflags, nbarbs, half_barb, empty_flag Respectively, the number of flags, number of barbs, flag for half a
(self, u, v, nflags, nbarbs, half_barb, empty_flag, length,
pivot, sizes, fill_empty, flip)
| 1028 | return n_flags.astype(int), n_barb.astype(int), half_flag, empty_flag |
| 1029 | |
| 1030 | def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length, |
| 1031 | pivot, sizes, fill_empty, flip): |
| 1032 | """ |
| 1033 | Create the wind barbs. |
| 1034 | |
| 1035 | Parameters |
| 1036 | ---------- |
| 1037 | u, v |
| 1038 | Components of the vector in the x and y directions, respectively. |
| 1039 | |
| 1040 | nflags, nbarbs, half_barb, empty_flag |
| 1041 | Respectively, the number of flags, number of barbs, flag for |
| 1042 | half a barb, and flag for empty barb, ostensibly obtained from |
| 1043 | :meth:`_find_tails`. |
| 1044 | |
| 1045 | length |
| 1046 | The length of the barb staff in points. |
| 1047 | |
| 1048 | pivot : {"tip", "middle"} or number |
| 1049 | The point on the barb around which the entire barb should be |
| 1050 | rotated. If a number, the start of the barb is shifted by that |
| 1051 | many points from the origin. |
| 1052 | |
| 1053 | sizes : dict |
| 1054 | Coefficients specifying the ratio of a given feature to the length |
| 1055 | of the barb. These features include: |
| 1056 | |
| 1057 | - *spacing*: space between features (flags, full/half barbs). |
| 1058 | - *height*: distance from shaft of top of a flag or full barb. |
| 1059 | - *width*: width of a flag, twice the width of a full barb. |
| 1060 | - *emptybarb*: radius of the circle used for low magnitudes. |
| 1061 | |
| 1062 | fill_empty : bool |
| 1063 | Whether the circle representing an empty barb should be filled or |
| 1064 | not (this changes the drawing of the polygon). |
| 1065 | |
| 1066 | flip : list of bool |
| 1067 | Whether the features should be flipped to the other side of the |
| 1068 | barb (useful for winds in the southern hemisphere). |
| 1069 | |
| 1070 | Returns |
| 1071 | ------- |
| 1072 | list of arrays of vertices |
| 1073 | Polygon vertices for each of the wind barbs. These polygons have |
| 1074 | been rotated to properly align with the vector direction. |
| 1075 | """ |
| 1076 | |
| 1077 | # These control the spacing and size of barb elements relative to the |
| 1078 | # length of the shaft |
| 1079 | spacing = length * sizes.get('spacing', 0.125) |
| 1080 | full_height = length * sizes.get('height', 0.4) |
| 1081 | full_width = length * sizes.get('width', 0.25) |
| 1082 | empty_rad = length * sizes.get('emptybarb', 0.15) |
| 1083 | |
| 1084 | # Controls y point where to pivot the barb. |
| 1085 | pivot_points = dict(tip=0.0, middle=-length / 2.) |
| 1086 | |
| 1087 | endx = 0.0 |