File: WindBarbsMacro.net

package info (click to toggle)
dxsamples 4.4.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 26,340 kB
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,102
file content (317 lines) | stat: -rw-r--r-- 11,188 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
//
// time: Tue Sep 16 10:40:26 1997
//
// version: 3.1.2 (format), 3.1.4 (DX)
//
//
// Begin MDF
// MODULE WindBarbs
// CATEGORY RAMS
// DESCRIPTION Creates Wind Barbs from a 2d vector field
// INPUT data; value list or field or string or string list; (none); wind vector data, assumed to be in knots
// INPUT barbs; group or field or series or value list or string list; (none); the wind barbs file.  Contains a group of fields describing the barbs.
// INPUT scale[visible:0]; scalar; (input dependent); scale factor for size of barbs
// OUTPUT wind_barbs; group; wind barbs for each category of wind vectors
// End MDF
//
// comment: This macro chooses a glyph from an imported set of glyphs based on the data value.  Thus it is similar to "annotation glyphs" (see the AutoGlyph man page), but for this application, annotation glyphs were not appropriate since the glyphs are for vector data, and are also required to change direction based on the direction of the vector data.  Annotation glyphs are for scalar (categorical) data and are simply placed at the location of the data value in space. 
// comment: 
// comment: This macro loops over each category, choosing the appropriate glyph based on the magnitude of the data.   A glyph is created and appended to a group of glyphs.
// workspace: width = 845, height = 1512
// layout: snap = 0, width = 50, height = 50, align = NN
//
macro WindBarbs(
 data
,barbs
,scale
) -> (
 wind_barbs
) {
    // 
    // node Collect[1]: x = 495, y = 1051, inputs = 2, label = Collect
    // input[1]: visible = 0
    // input[2]: visible = 0
    //
WindBarbs_Collect_1_out_1 = 
    Collect(
    NULL,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node GetLocal[1]: x = 535, y = 1127, inputs = 3, label = GetLocal
    // input[2]: visible = 0
    //
WindBarbs_GetLocal_1_out_1,
WindBarbs_GetLocal_1_out_2 = 
    GetLocal(
    WindBarbs_Collect_1_out_1,
    NULL,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Input[1]: x = 219, y = 0, inputs = 0, label = Input
    // parameter: position = 1, name = 'data', value = '(none)', descriptive = 1, description = 'wind vector data, assumed to be in knots', required = 1, visible = 1
    //
WindBarbs_Input_1_out_1 = data;
    // 
    // node Compute[1]: x = 0, y = 71, inputs = 2, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "mag($0)"
    // expression: value = mag(a)
    // name[2]: value = a
    //
WindBarbs_Compute_1_out_1 = 
    Compute(
    "mag($0)",
    WindBarbs_Input_1_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Compute[2]: x = 0, y = 153, inputs = 2, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 < 5 ? 0 : ($0 < 10 ? 1 : ($0 < 15 ? 2 : ($0 < 20 ? 3 : 4)))"
    // expression: value = a < 5 ? 0 : (a < 10 ? 1 : (a < 15 ? 2 : (a < 20 ? 3 : 4)))
    // name[2]: value = a
    //
WindBarbs_Compute_2_out_1 = 
    Compute(
    "$0 < 5 ? 0 : ($0 < 10 ? 1 : ($0 < 15 ? 2 : ($0 < 20 ? 3 : 4)))",
    WindBarbs_Compute_1_out_1
    ) [instance: 2, cache: 1];
    // 
    // node Compute[71]: x = 345, y = 109, inputs = 2, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "-norm($0)"
    // expression: value = -norm(a)
    // name[2]: value = a
    //
WindBarbs_Compute_71_out_1 = 
    Compute(
    "-norm($0)",
    WindBarbs_Input_1_out_1
    ) [instance: 71, cache: 1];
    // 
    // node Replace[6]: x = 194, y = 261, inputs = 4, label = Replace
    // input[4]: defaulting = 0, visible = 1, type = 32, value = "wind_category"
    //
WindBarbs_Replace_6_out_1 = 
    Replace(
    WindBarbs_Compute_2_out_1,
    WindBarbs_Compute_71_out_1,
    NULL,
    "wind_category"
    ) [instance: 6, cache: 1];
    // 
    // node Mark[12]: x = 177, y = 354, inputs = 2, label = Mark
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "wind_category"
    //
WindBarbs_Mark_12_out_1 = 
    Mark(
    WindBarbs_Replace_6_out_1,
    "wind_category"
    ) [instance: 12, cache: 1];
    // 
    // node Statistics[9]: x = 150, y = 484, inputs = 1, label = Statistics
    // output[1]: visible = 0
    // output[2]: visible = 0
    // output[3]: visible = 0
    // output[4]: visible = 0
    //
WindBarbs_Statistics_9_out_1,
WindBarbs_Statistics_9_out_2,
WindBarbs_Statistics_9_out_3,
WindBarbs_Statistics_9_out_4,
WindBarbs_Statistics_9_out_5 = 
    Statistics(
    WindBarbs_Mark_12_out_1
    ) [instance: 9, cache: 1];
    // 
    // node Compute[72]: x = 150, y = 557, inputs = 2, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "int($0)"
    // expression: value = int(a)
    // name[2]: value = a
    //
WindBarbs_Compute_72_out_1 = 
    Compute(
    "int($0)",
    WindBarbs_Statistics_9_out_5
    ) [instance: 72, cache: 1];
    // 
    // node ForEachN[1]: x = 197, y = 650, inputs = 3, label = ForEachN
    // input[1]: defaulting = 0, visible = 1, type = 1, value = 0
    // output[2]: visible = 0
    //
WindBarbs_ForEachN_1_out_1,
WindBarbs_ForEachN_1_out_2 = 
    ForEachN(
    0,
    WindBarbs_Compute_72_out_1,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Include[18]: x = 95, y = 743, inputs = 6, label = Include
    // input[4]: visible = 0
    // input[5]: defaulting = 0, visible = 0, type = 3, value = 0
    // input[6]: defaulting = 0, visible = 0, type = 3, value = 1
    //
WindBarbs_Include_18_out_1 = 
    Include(
    WindBarbs_Mark_12_out_1,
    WindBarbs_ForEachN_1_out_1,
    WindBarbs_ForEachN_1_out_1,
    NULL,
    0,
    1
    ) [instance: 18, cache: 1];
    // 
    // node Unmark[10]: x = 79, y = 866, inputs = 2, label = Unmark
    // input[2]: visible = 0
    //
WindBarbs_Unmark_10_out_1 = 
    Unmark(
    WindBarbs_Include_18_out_1,
    NULL
    ) [instance: 10, cache: 1];
    // 
    // node Input[2]: x = 239, y = 983, inputs = 0, label = Input
    // parameter: position = 2, name = 'barbs', value = '(none)', descriptive = 1, description = 'the wind barbs file.  Contains a group of fields describing the barbs.', required = 1, visible = 1
    //
WindBarbs_Input_2_out_1 = barbs;
    // 
    // node Select[1]: x = 346, y = 1070, inputs = 3, label = Select
    //
WindBarbs_Select_1_out_1 = 
    Select(
    WindBarbs_Input_2_out_1,
    WindBarbs_ForEachN_1_out_1,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Options[3]: x = 263, y = 1127, inputs = 3, label = Options
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "uniformscale"
    // input[3]: defaulting = 0, visible = 1, type = 29, value = 1
    //
WindBarbs_Options_3_out_1 = 
    Options(
    WindBarbs_Select_1_out_1,
    "uniformscale",
    1
    ) [instance: 3, cache: 1];
    // 
    // node Input[32]: x = 415, y = 1127, inputs = 0, label = Input
    // parameter: position = 3, name = 'scale', value = '(input dependent)', descriptive = 1, description = 'scale factor for size of barbs', required = 0, visible = 0
    //
WindBarbs_Input_32_out_1 = scale;
    // 
    // node Glyph[1]: x = 243, y = 1240, inputs = 7, label = Glyph
    // input[3]: visible = 0
    // input[4]: defaulting = 1, visible = 1, type = 5, value = .75
    // input[5]: visible = 0
    //
WindBarbs_Glyph_1_out_1 = 
    Glyph(
    WindBarbs_Unmark_10_out_1,
    WindBarbs_Options_3_out_1,
    NULL,
    WindBarbs_Input_32_out_1,
    NULL,
    NULL,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Append[1]: x = 356, y = 1278, inputs = 5, label = Append
    // input[3]: visible = 0
    // input[4]: visible = 0
    // input[5]: visible = 0
    //
WindBarbs_Append_1_out_1 = 
    Append(
    WindBarbs_GetLocal_1_out_1,
    WindBarbs_Glyph_1_out_1,
    NULL,
    NULL,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Output[1]: x = 358, y = 1450, inputs = 1, label = Output
    // parameter: position = 1, name = 'wind_barbs', value = ' ', descriptive = 0, description = 'wind barbs for each category of wind vectors', required = 0, visible = 1
    //
wind_barbs = WindBarbs_Append_1_out_1;
    // 
    // node SetLocal[1]: x = 497, y = 1351, inputs = 3, label = SetLocal
    //
    SetLocal(
    WindBarbs_Append_1_out_1,
    WindBarbs_GetLocal_1_out_2,
    NULL
    ) [instance: 1, cache: 1];
    //
    // decorator Annotate	pos=(137,812) size=168x44 style(Label), value = <NULL>
    // annotation user_begin: 37
    // annotation user: select only the current
    // annotation user: wind category
    // annotation user_end: <NULL>
    //
    // decorator Annotate	pos=(302,270) size=226x44 style(Label), value = <NULL>
    // annotation user_begin: 56
    // annotation user: add the wind category as
    // annotation user: a component of the vector field
    // annotation user_end: <NULL>
    //
    // decorator Annotate	pos=(258,616) size=229x28 style(Label), value = <NULL>
    // annotation user_begin: 31
    // annotation user: iterate over each wind category
    // annotation user_end: <NULL>
    //
    // decorator Annotate	pos=(76,82) size=184x44 style(Label), value = <NULL>
    // annotation user_begin: 46
    // annotation user: compute the wind speed,
    // annotation user: assumed to be in knots
    // annotation user_end: <NULL>
    //
    // decorator Annotate	pos=(78,163) size=212x44 style(Label), value = <NULL>
    // annotation user_begin: 56
    // annotation user: categorize the wind by speed
    // annotation user: to be used to select a barb
    // annotation user_end: <NULL>
    //
    // decorator Annotate	pos=(422,98) size=255x92 style(Label), value = <NULL>
    // annotation user_begin: 149
    // annotation user: reverse the direction so that 
    // annotation user: barbs point in the direction 
    // annotation user: from where the wind is coming and 
    // annotation user: normalize all vectors so they 
    // annotation user: appear the same length
    // annotation user_end: <NULL>
    //
    // decorator Annotate	pos=(29,1240) size=171x60 style(Label), value = <NULL>
    // annotation user_begin: 58
    // annotation user: create a glyph for
    // annotation user: each data value
    // annotation user: in the current category
    // annotation user_end: <NULL>
    //
    // decorator Annotate	pos=(582,1269) size=263x60 style(Label), value = <NULL>
    // annotation user_begin: 92
    // annotation user: append each glyph to a group using
    // annotation user: Append, and using GetLocal and
    // annotation user: SetLocal as an accumulator
    // annotation user_end: <NULL>
// network: end of macro body
}
WindBarbs_Collect_1_out_1 = NULL;
WindBarbs_GetLocal_1_out_1 = NULL;
WindBarbs_GetLocal_1_out_2 = NULL;
WindBarbs_Input_1_out_1 = NULL;
WindBarbs_Compute_1_out_1 = NULL;
WindBarbs_Compute_2_out_1 = NULL;
WindBarbs_Compute_71_out_1 = NULL;
WindBarbs_Replace_6_out_1 = NULL;
WindBarbs_Mark_12_out_1 = NULL;
WindBarbs_Statistics_9_out_5 = NULL;
WindBarbs_Compute_72_out_1 = NULL;
WindBarbs_ForEachN_1_out_1 = NULL;
WindBarbs_Include_18_out_1 = NULL;
WindBarbs_Unmark_10_out_1 = NULL;
WindBarbs_Input_2_out_1 = NULL;
WindBarbs_Select_1_out_1 = NULL;
WindBarbs_Options_3_out_1 = NULL;
WindBarbs_Input_32_out_1 = NULL;
WindBarbs_Glyph_1_out_1 = NULL;
WindBarbs_Append_1_out_1 = NULL;