-
Notifications
You must be signed in to change notification settings - Fork 0
/
sandbox.ipf
4415 lines (4254 loc) · 204 KB
/
sandbox.ipf
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#If ( 0) // 1 to compile; 0 for omit
#pragma rtGlobals = 1 // Use modern global access method.
Menu "Macros"
"windtrax"
"windtraxtable"
"PromptedUnzipArchive"
"PromptedLoadCSI-file", PromptedLoadCSI()
"PromptedLoadCSI-dir", PromptedLoadCSI(type=1)
End
// preferences constants
Static StrConstant ksPackageName = "LAR Tools"
Static StrConstant ksPrefsFileName = "LAR_Tools.bin"
Static StrConstant ksPackageSubfolder = "lar_tools"
Static Constant kID_template = 0
Static Constant kID_textToIgorTime = 1
Static Constant kID_softSpikeFilter = 2
Static Constant kID_boxMean = 3
Static Constant kID_nanFill = 4
Static Constant kID_concatDFs = 5
Static Constant kID_wswd = 6
Static Constant kID_loadFiles = 7
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
// LoadG2301( [fileList, cols, concat, tsadd] )
//
// Optional parameters
// string fileList semicolon separated list of full paths to files to load; default: prompt
// variable cols specify which columns to load: default: prompt
// 0 all columns
// 1 date, time, CO2/CH4/H2O concentrations
// 2 date, time, CO2/CH4 concentrations
// 3 date, time, CO2/H2O concentrations
// 4 date, time, CH4/H2O concentrations
// [expand as needed]
// variable concat 1: concat consecutive files; 2: concat & delete sources; 0: do not default: prompt
// variable tsadd 1: add date+time > timestamp; 2: add & delete sources; 0: do not default: prompt
//
// Returns
// variable # of files loaded or -1 for failure
//
// If necessary, prompts user to select files via dialog box and confirm optional parameters. Sequentially sorts
// selected files by name and consecutively loads waves from each file (no prompts) into subfolders named after
// each file; no subfolders are used if a single file is loaded. Optionally combines date and time waves into new wave
// and possibly deletes source date/time waves; optionally concatenates waves across subfolders as new waves in
// current data folder and possibly deletes source subfolders.
// case 0: // all columns
// B += "N='frac_days_since_jan1'; N='frac_hrs_since_jan1'; N='epoch_time'; "
// B += "N='alarm_status'; N=species; N='solenoid_valves'; N='das_temp'; N='cavity_pressure'; "
// B += "N='mode_id'; N='co2_conc_sync'; N='ch4_conc_sync'; N='h2o_conc_sync'; "
// break
// case 1: // CO2/CH4/H2O only
// B += "N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; "
// B += "N='_skip_'; N='_skip_'; N=co2_conc_sync; N=ch4_conc_sync; N='h2o_conc_sync'; "
// break
// case 2: // CO2/CH4 only
// B += "N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; "
// B += "N='_skip_'; N='_skip_'; N=co2_conc_sync; N=ch4_conc_sync; N='_skip_'; "
// break
// case 3: // CO2/H2O only
// B += "N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; "
// B += "N='_skip_'; N='_skip_'; N=co2_conc_sync; N='_skip_'; N='h2o_conc_sync'; "
// break
// case 4: // CH4/H2O only
// B += "N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; N='_skip_'; "
// B += "N='_skip_'; N='_skip_'; N='_skip_'; N=ch4_conc_sync; N='h2o_conc_sync'; "
// break
Function ProgressWindowTest(indefinite)
Variable indefinite
string pname = NewProgressWindow()
Variable i,imax= indefinite ? 1000 : 100
for(i=0;i<imax;i+=1)
// string p2name = NewProgressWindow()
// Variable j,jmax= indefinite ? 1000 : 100
// for(j=0;j<=jmax;j+=1)
// Variable t1= ticks
// do
// while( ticks < (t1+1) )
// if( indefinite )
// UpdateProgressWindow( pname, -1, 0, "")
// else
// UpdateProgressWindow( pname, j, jmax, "")
// endif
// endfor
Variable t0= ticks
do
while( ticks < (t0+1) )
if( indefinite )
UpdateProgressWindow( pname, -1, 0)
else
UpdateProgressWindow( pname, i, imax)
endif
endfor
KillWindow $pname
End
//
Function PromptedUnzipArchive()
string loadPathName, fileList, fileFilter, fileExt, fileName, prefpath, overwriteStr
variable sortByPick, sortBy, overwrite, flatten
overwriteStr = "Prompt for instructions;Overwrite without prompt;Skip existing files;"
overwriteStr += "Rename extracted file;Rename existing file;"
prefpath = "root:Packages:ART:PromptedUnzipArchive"
DFREF prefs = NewDataFolderX(prefpath)
fileFilter = StrVarOrDefault(prefpath+":gFileFilter", "")
fileExt = StrVarOrDefault(prefpath+":gFileExt", "")
sortByPick = NumVarOrDefault(prefpath+":gSortByPick", 1) // 1=1st choice
overwrite = NumVarOrDefault(prefpath+":gOverwrite", 1)
flatten = NumVarOrDefault(prefpath+":gFlatten", 1)
loadPathName = UniqueName("temp", 12, 0) // location prompt
NewPath/Q $loadPathName
If ( V_flag )
return -1
endif
Prompt fileFilter, "Grep file name filter:" // options prompt
Prompt fileExt, "Four character file extension filter:"
Prompt sortByPick, "Sort found files by:", popup, puSortOptionList()
Prompt overwrite, "Overwrite options", popup, overwriteStr
Prompt flatten, "Flatten archive output to one directory?", popup, "No;Yes;"
DoPrompt "Unzip Archive", fileFilter, fileExt, sortByPick, overwrite, flatten
If ( V_flag )
return -1
endif
string/G prefs:gFileFilter = fileFilter
string/G prefs:gFileExt = fileExt
variable/G prefs:gSortByPick = sortByPick
variable/G prefs:gOverwrite = overwrite
variable/G prefs:gFlatten = flatten
sortBy = puSortOptionValue( sortByPick )
fileList = ListFilesIn(loadPathName, fileFilter, fileExt, -1, sortBy )
variable i
for (i=0; i<ItemsInList(fileList); i+=1)
fileName = StringFromList(i, fileList)
DoAlert 1, "Next up: "+ParseFilePath(0, fileName, ":", 1, 0)+"\r\rWould you like to continue?"
If ( V_flag - 1 )
break
endif
print UnzipArchive( fileName, "", overwrite-1, flatten-1 )
endfor
Killpath $loadPathName
end
// doesn't handle gracefully without DFRs
Function KillThenMove( src, dest )
wave src
string dest
If ( WaveExists( $dest ) )
KillWaves/Z $dest
endif
If ( WaveExists( $dest ) )
print "KillThenMove: could not kill wave <"+dest+"> - source not moved"
return -1
else
MoveWave src, $dest
endif
return 0
End
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
// LoadNMEA( [fileList] )
// string fileList semicolon separated list of full paths to files to load
//
// Returns
// variable # of files loaded or -1 for failure
//
Function LoadNMEA( [fileList])
string fileList // semicolon separated list of files to load
variable refnum // file ref #
variable i, j // counters
variable L // line number
string DFname // constructs new datafolders
string fullPath, filePath, fileName, fileExt // current working file info
string code, msg // type of NMEA message this row & content
DFREF savDF = GetDataFolderDFR() // save current location
If (ParamIsDefault(fileList)) // if files aren't specified
fileList = PromptForFileList("Select GPS files to load") // prompt user
If ( !strlen(fileList) ) // if cancels
return -1 // quit failure
endif
endif
for ( i=0; i<ItemsInList(fileList, num2char(13)); i+=1) // for each listed file
fullPath = StringFromList(i, fileList, num2char(13)) // extract path from list
//filePath = ParseFilePath(1, fullPath, ":", 1, 0) // grab without file name+ext
//fileName = ParseFilePath(3, fullPath, ":", 0, 0) // grab file name alone
//fileExt = ParseFilePath(4, fullPath, ":", 0, 0) // grab file extension alone
DFname = "root:tmpGPS_"+CleanupName(fileName, 0) // path to temp directory
NewDataFolder/O/S $DFname // build/switch to temp dir
DFREF tmpDF = $DFname // make references to folders
LoadWave/A/B="C=1,F=-2,N=NMEAmsgs;"/J/D/O/K=2/V={""," $",0,0} fullPath // load from file as 1 text wave
WAVE/Z/T NMEAmsgs // refer to imported wave
if ( V_flag == 0 || !WaveExists(NMEAmsgs) ) // if no waves loaded or gone missing
// lar_print(0, ">\tNo waves were loaded from "+fullPath) // msg
continue // skip rest of this loop
endif
j = numpnts(NMEAmsgs) // how many rows loaded?
// NMEA message information taken from the ASPEN-GPS System Operation Manual Appendix M
NewDataFolder/O/S ALMmsgs // build/switch-to subfolder
// $GPALM,1,1,21,768,00,5d94,08,08b7,fd4f,a10d2e,747f49,57ab38, c0b629, ffaa, 000*43
// $GPALM header
// 1 total # of ALM messages this cycle
// 1 message sequence #
// 21 SV PRN #: 01 to 32
// 768 GPS week #
// 00 SV health status
// 5d94 eccentricity
// 08 almanac reference time
// 08b7 inclination angle
// fd4f rate of right ascension
// a10d2e root of semimajor axis
// 747f49 argument of perigee
// 57ab38 longitude of ascension node
// c0b629 mean anomaly
// ffaa a(f0), clock parameter
// 000 a(f1), clock parameter
// *43 CRC checksum
Make/N=(j)/O/T col01, col02, col03, col04, col05, col06, col07, col08, col09, col10, col11, col12, col13, col14, col15
SetDataFolder tmpDF // return to parent folder
DFREF ALM = ALMmsgs // create reference
NewDataFolder/O GGAmsgs
// $GPGGA,004407.00,3723.477595,N,12202.251222,W,2,07,1.2,19.1,M,-25.7,M,3,0003*55
// $GPGGA header
// 004407.00 UTC of position fix
// 3723.477595 latitude, ddmm.mmmm
// N direction of latitude (N/S)
// 12202.251222 longitude, dddmm.mmmm
// W direction of longitude (E/W)
// 2 GPS quality indicator: 0=fix not valid; 1=GPS fix; 2=Differential GPS fix
// 07 # of SVs in use, 00 to 12
// 1.2 HDOP
// 19.1 antenna height, MSL reference (meters)
// M fixed unit text for antenna height (meters)
// -25.7 geoidal separation (meters)
// M fixed unit text for geoidal separation (meters)
// 3 age of differential GPS record, Type 1 or Type 9, null when DGPS not used
// 0003 differential reference station ID, 0000 to 1023, null when "any reference station ID" is
// selected and no corrections have been received
// *55 CRC checksum
Make/N=(j)/O/T timeUTC, latitude, lat_dir, longitude, long_dir, fix_level, SV_numused, HDOP, ant_height, geo_sep
Make/N=(j)/O/T DGPS_age, diff_ID
SetDataFolder tmpDF
DFREF GGA = GGAmsgs
NewDataFolder/O GLLmsgs
// $GPGLL,
Make/N=(j)/O/T latitude, lat_dir, longitude, long_dir, timeUTC, fix_valid
SetDataFolder tmpDF
DFREF GLL = GLLmsgs
NewDataFolder/O GSAmsgs
Make/N=(j)/O/T fix_mode, fix_state, PRN_1, PRN_2, PRN_3, PRN_4, PRN_5, PRN_6, PRN_7, PRN_8, PRN_9
Make/N=(j)/O/T PRN_10, PRN_11, PRN_12, PDOP, HDOP, VDOP
SetDataFolder tmpDF
DFREF GSA = GSAmsgs
NewDataFolder/O GSVmsgs
Make/N=(j)/O/T msg_tot, msg_num, SV_tot, A_SV_PRN, A_elev, A_azimuth, A_SNR, B_SV_PRN, B_elev, B_azimuth
Make/N=(j)/O/T B_SNR, C_SV_PRN, C_elev, C_azimuth, C_SNR, D_SV_PRN, D_elev, D_azimuth, D_SNR
SetDataFolder tmpDF
DFREF GSV = GSVmsgs
NewDataFolder/O RMCmsgs
Make/N=(j)/O/T timeUTC, fix_valid, latitude, lat_dir, longitude, long_dir, SOG_knots, track_made_good, ddmmyy, mag_var, mag_var_dir
SetDataFolder tmpDF
DFREF RMC = RMCmsgs
NewDataFolder/O VTGmsgs
Make/N=(j)/O/T track_made_good, SOG_knots, SOG_kmh
SetDataFolder tmpDF
DFREF VTG = VTGmsgs
NewDataFolder/O ZDAmsgs
Make/N=(j)/O/T timeUTC, day, month, year, GMT_offset_hr, GMT_offset_min
SetDataFolder tmpDF
DFREF ZDA = ZDAmsgs
for ( j=0; j<numpnts(NMEAmsgs); j+=1 ) // for each message in file
msg = NMEAmsgs[0] // save locally
if ( cmpstr(msg[0],"$") ) // if msg doesn't start with $
// lar_print(3, "*\tEncountered non-NMEA message at line "+num2istr(j)) // msg
continue // skip this row
endif
code = msg[3,5] // extract 3-char NMEA code
strswitch (code) // based on code
case "ALM":
break
case "GGA":
break
case "GLL":
break
case "GSA":
break
case "GSV":
break
case "RMC":
break
case "VTG":
break
case "ZDA":
break
endswitch
endfor
endfor
SetDataFolder savDF
//KillDataFolder/Z tmpDF
return 0 // return success
End
// cleanupMask( inStr )
// string inStr input to be cleaned
//
// returns cleaned up string
//
// Same basic idea as CleanupName(...) but preserves asterisks in the string
//
Static Function/S cleanupMask( inStr )
string inStr // input string
// define chars OK to have in mask using strict naming convention (a-z, A-Z, 0-9, _ * )
string OK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789*"
variable i // counter
inStr = ReplaceString(":", inStr, "") // remove any colons first
for (i=0; i<strlen(inStr); i+=1) // for each character in input string
if ( strsearch(OK, inStr[i], 0) == -1 ) // if character is not in OK list
inStr = ReplaceString( inStr[i], inStr, "_", 1, 1) // replace with underscore
endif
endfor
return inStr // pass back cleaned string
End
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
// cleanupPath( inPath )
// string inPath path to clean up
// variable rel nonzero indicates a relative path
//
// returns cleaned up string
//
// Places single quotes around any liberal-named datafolders. Removes trailing semicolons from all paths and
// removes leading semicolons unless the path is relative (rel=nonzero) in which case one is added if not present
//
Static Function/S cleanupPath( inPath, [rel] )
string inPath // input string
variable rel // relative path flag
variable i
string outPath = ""
for ( i=0; i<ItemsInList(inPath, ":"); i+=1 ) // for each folder in the path
outPath = AddListItem(PossiblyQuoteName(StringFromList(i, inPath, ":")), outPath, ":", Inf) // quote, append back of list
endfor
if ( rel && cmpstr(outPath[0], ":") ) // if first character isn't a colon
//outPath = ReplaceString(":",outPath,"",0,1) // erases first instance
outPath = ":"+outPath // prefix one
endif
return RemoveEnding(outPath, ":") // remove trailing colon & return
//return (RemoveEnding(outPath, ":")+":") // strip trailing colon, if any, then add one & return string
End
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
// intPrint( interval [, decimals] )
// variable interval time interval to format as string, cannot be negative
//
// Optional parameters
// variable decimals # of digits to display after decimal point
// variable nospace nonzero to omit space between # and units
//
// Returns
// string size of interval, optional space, and units; ex: "5 min" "500ms" "45.5 days" "2hr" "
// empty string if interval is not positive
//
// If interval size is less than, then interval is expressed in
// 1 second milliseconds
// 1 minute seconds
// 1 hour minutes
// 1 day hours
// Inf days
//
Static Function/S intPrint( interval, [decimals, nospace] )
variable interval // interval to express
variable decimals // # digits to show past decimal
variable nospace // flag to omit space
string num, units // output strings
if ( interval <= 0 ) // if not positive
return "" // quit failure
elseif ( interval < 1 ) // if less than 1 second
interval *= 1000 // convert to milliseconds
units = "ms" // set units
elseif ( interval < 60 ) // if less than 1 minute
// do nothing // leave in seconds
units = "sec" // set units
elseif ( interval < 3600 ) // if less than 1 hour
interval /= 60 // convert to minutes
units = "min" // set units
elseif ( interval < 86400 ) // if less than 1 day
interval /= 3600 // convert to hours
units = "hr" // set units
else // any interval 1 day or longer
interval /= 86400 // convert to days
units = "days" // set units
endif
if (decimals) // and # of decimal places is set
sprintf num, "%.*f", decimals, interval // format it specifically
else // otherwise
num = num2str(interval) // let Igor format it
endif
if (nospace) // if space should be absent
return num+units // hand back combined string
else // otherwise
return num+" "+units // combine with space in between
endif
End
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// windArrowTimeSeries( [windDirW, windSpdW, minArrowLen, maxArrowLen, prefix] )
//
// Optional Parameters
// windDirW wave wind directions in decimal degrees
// windSpdW wave wind speeds in any units
// minArrowLen variable length of smallest arrow (pnts) corresponding to minimum wind speed
// maxArrowLen variable length of longest arrow (pnts) corresponding to maximum wind speed
// zeroOption variable odd = keep markers, no arrows for zero WS; even = no markers/arrows
// prefix string prefix to append to output waves' names
//
// This function creates two waves: "WD_arrowPoints" & "WD_arrowInfo" and permits the user to
// optionally specify a prefix to include in their names. If no prefix is specified, none is added.
// The output waves are of the same dimension as the input waves so if time-averaging is desired,
// it should be performed prior to use of this function.
// Wind directions are used to determine arrow orientation; graphically, the arrows represent the
// mean wind vector (ie., points in same direction as wind flow). Entries must be in degrees but
// there is no limitation on range of entries (ie., -90 is same as 270)
// Wind speeds are used to determine the overall arrow size. Dimensions are normalized such that
// the smallest length represents the smallest wind speed in the dataset and longest length
// represents maximum wind speed. If the 'minArrowLen' and 'maxArrowLen' variables are not
// provided, they assume default values of 4 and 16, respectively.
//
// If no parameters are provided, or if the passed wave references are invalid, the user is prompted
// to 1) specify the folder path containing the wind speed/direction waves (where the default value
// is the current datafolder), then 2) select the wind speed/direction waves via drop-down boxes.
// An opportunity is also provided at this point to change min/max arrow lengths & the prefix.
//
// To plot this time series of arrows, display WD_arrowPoints and set the point mode to marker
// (ModifyGraph mode=3). Since no convenient dialogs exist for changing markers to arrows,
// its recommended to just paste the following text into the command window (Ctrl+J)
// Modifygraph arrowmarker={WD_arrowInfo, 0,0,0,1}
// where the wave name "WD_arrowInfo" has the appropriate prefix, if necessary
//
// - pokeeffe
Function windArrowTimeSeries_tb( [windDirW, windSpdW, timeW, minArrowLen, maxArrowLen, zeroOption, prefix] )
wave/z windDirW // optional, user-provided information
wave/z windSpdW
wave/z timeW
variable minArrowLen
variable maxArrowLen
variable zeroOption
string prefix
// assign defaults if not provided
minArrowLen = ParamIsDefault(minArrowLen) ? 4 : minArrowLen
maxArrowLen = ParamIsDefault(maxArrowLen) ? 16 : maxArrowLen
If ( ParamIsDefault(prefix) )
prefix = "new_"
endif
if ( ParamIsDefault(zeroOption) )
zeroOption = 1
endif
string saveFolder // for saving spots
string nowFolder // where to look for waves in case we need to
string waveNameList // all waves in specified datafolder
string timeWname // in case a prompt for wave names occurs
string windDirWname //
string windSpdWname //
variable i // counter
variable metAngle // for converting met coords --> radial math coords
variable quadrant // ...
variable mathAngle // ...
variable maxWS // for normalizing wind speeds & proportioning arrows
variable minWS // ...
variable spanWS // ...
variable xWS
// if passed waves were not good or not even passed
If ( !WaveExists(windDirW) || !WaveExists(windSpdW) )
nowFolder = GetDataFolder(1) // where's here?
saveFolder = nowFolder // save spot
Prompt nowFolder, "Look for waves in which data folder? ('Continue' >> current DF)"
do // do...
DoPrompt "Wind Arrow Time Series", nowFolder
If ( V_flag == 1 ) // if cancel
abort // quit
endif
If ( DataFolderExists(nowFolder) ) // if good entry
break; // exit loop
endif
while (1) // until loop is exited
SetDataFolder $nowFolder
waveNameList = WaveList("*",";","") // find all waves in that folder
windDirWname = StringFromList(0, waveNameList) // fill in default values
windSpdWname = StringFromList(1, waveNameList)
timeWname = StringFromList(2,waveNameList)
// create prompt & ask user
Prompt windDirWname, "Select the wind direction wave:", popup, waveNameList
Prompt windSpdWname, "Select the wind speed wave:", popup, waveNameList
Prompt timeWname, "Select the date & time wave:", popup, waveNameList
Prompt minArrowLen, "Length of minimum wind speed arrows (pnts)"
Prompt maxArrowLen, "Length of maximum wind speed arrows (pnts)"
Prompt zeroOption, "Show zero wind speed as", popup, "marker (no arrow);no marker or arrow"
Prompt prefix, "Add prefix to created waves? (in quotes)"
DoPrompt "Wind Arrow Time Series",windDirWname,windSpdWname,timeWname,minArrowLen,maxArrowLen,zeroOption,prefix
If ( V_flag == 1 ) // if cancel
SetDataFolder $saveFolder
abort // quit
endif
wave windDirW = $windDirWname // set correct references
wave windSpdW = $windSpdWname
wave timeW = $timeWname
// if value is less than 4 (min), then reset to 4; >> will double this later so 2 is OK here but 4 looks better
minArrowLen = (minArrowLen < 4) ? 4 : minArrowLen
// if value is less than/equal to minArrowLen, then reset to 4*minArrowLen
maxArrowLen = (maxArrowLen<=minArrowLen) ? 4*minArrowLen : maxArrowLen
endif
maxWS = 0 // initialize low
minWS = 1000 // initialize high
for ( i=0; i<numpnts(windSpdW); i+=1 ) // for each point in wind speed wave
// compare WS[i] to stored max/min values
maxWS = ( windSpdW[i] > maxWS ) ? windSpdW[i] : maxWS // reassign if WS[i] is higher
minWS = ( windSpdW[i] < minWS ) ? windSpdW[i] : minWS // reassign if WS[i] is lower
endfor
spanWS = maxWS - minWS
// make wave of points to put arrow markers on; add prefix but reference generically
Make/D/O/N=(numpnts(windDirW)) $(prefix+"WD_arrowPoints") = NaN
wave WD_arrowPntsByDay = $(prefix+"WD_arrowPoints")
// make wave of arrow information; add prefix but reference generically
Make/D/O/N=(numpnts(windDirW),5) $(prefix+"WD_arrowInfo") = NaN
wave WD_arrowInfo = $(prefix+"WD_arrowInfo")
variable/G $(prefix+"WDarrow_maxWS") = maxWS
variable/G $(prefix+"WDarrow_minWS") = minWS
// WD_arrowInfo[][0] = arrow line lengths
// WD_arrowInfo[][1] = arrow angles (rad), CCW from horizontal right-ward
SetDimLabel 1, 2, lineThick, WD_arrowInfo // WD_arrowInfo[][2] = arrow line thickness
SetDimLabel 1, 3, headLen, WD_arrowInfo // WD_arrowInfo[][3] = arrow head length
SetDimLabel 1, 4, headFat, WD_arrowInfo // WD_arrowInfo[][4] = arrow head width ratio
for ( i=0; i<numpnts(windDirW); i+=1 )
if ( numtype(windDirW[i]) != 0 ) // if not a normal number
mathAngle = NaN
else
metAngle = modWD(windDirW[i]) // ensure wind dir range: (0, 360]
quadrant = trunc(metAngle/90) + 1
// for 0 <= metAngle < 90 quadrant = 0+1 = 1
// for 90 <= metAngle < 180 quadrant = 1+1 = 2
// for 180 <= metAngle < 270 quadrant = 2+1 = 3
// for 270 <= metAngle < 360 quadrant = 3+1 = 4
// metAngle mathAngle
// 0 90
// | |
// 4 | 1 |
// | |
// 270 -------------------------- 90 180 ---------------------------- 0
// | |
// 3 | 2 |
// | |
// 180 270
switch ( quadrant )
case 1:
mathAngle = 90 - metAngle
break;
case 2:
mathAngle = 270 + (180-metAngle)
break;
case 3:
mathAngle = 180 + (270-metAngle)
break;
case 4:
mathAngle = 180 - (metAngle-270)
break;
endswitch
// metAngle is angle of the direction wind is approaching
// mathAngle is angle of the direction wind is heading
// so add 180 first
// to graph, angles should not be negative & should be radians
// so ensure range is (0, 360], then convert to rad.
mathAngle = modWD(mathAngle+180) * (PI/180)
endif
// Arrow proportions: where:
// arrow length: 2X X=4 @ min. WS
// arrow angle: -- X=15 @ max. WS
// line thickness: 0.3X X(WS[i]) = minLen+(spanLen)*(WS[i]-minWS)/spanWS
// head length: X spanWS = (maxWS - minWS)
// head width ratio: 0.9
xWS = minArrowLen + (maxArrowLen-minArrowLen)*(windSpdW[i] - minWS)/spanWS
// define arrow properties
WD_arrowInfo[i][0] = 2*xWS // arrow length
WD_arrowInfo[i][1] = mathAngle // arrow angle
WD_arrowInfo[i][%lineThick] = 0.3*xWS // line thickness
WD_arrowInfo[i][%headLen] = xWS // head length
WD_arrowInfo[i][%headFat] = 0.9 // head width
if ( minWS<=0 && xWS==minArrowLen ) // in case min WS is zero & this record has a min WS
switch ( zeroOption ) // check zero option selection
case 2: // if 'don't display arrow'
WD_arrowPntsByDay[i] = NaN // don't put an arrow b/c avg WS == 0
break;
default: // by default
WD_arrowInfo[i][0] = 1 // set arrow length <4 so default marker shows up
break;
endswitch
endif
WD_arrowPntsByDay[i] = trunc(timeW[i]/86400) * 86400 // save just date to points wave
endfor
Duplicate/D/O WD_arrowPntsByDay, $(prefix+"WD_arrowPoints")
wave WD_arrowPoints = $(prefix+"WD_arrowPoints")
WD_arrowPoints = 1
DoWindow/K pasteFrom
NewNotebook/F=0/K=1/W=(378,188.75,638.25,282.5)/N=pasteFrom
Notebook pasteFrom text="Modifygraph arrowmarker={"+NameOfWave(WD_arrowInfo)+", 0,0,0,1}"
end // windArrowTimeSeries
Function showArrowMarkerCmd_tb()
NewNotebook/F=0/K=1/W=(378,188.75,638.25,282.5)/N=pasteFrom
Notebook pasteFrom text="Modifygraph arrowmarker={WD_arrowInfo, 0,0,0,1}"
End
////////////////////////////////////////////// INITIALIZATION /////////////////////////////////////////////////////////////////////////////////
Static Function lar_initPkgFldr()
NewDataFolder/O root:Packages // ensure a Packages subfolder exists
NewDataFolder/O $"root:Packages:"+ksPackageSubfolder // ensure a subfolder for this package exists
NewDataFolder/O $"root:Packages:"+ksPackageSubfolder+":menus" // ensure a subfolder for menus exists on load
End
// lar_populateLB( listWave, listSelWave, listType )
// listWave text wave reference to fill with wave names
// listSelWave numeric wave reference to fill with selection flags
// listType type of items to populate list with
// bit 0 value: 1 numeric waves
// bit 1 value: 2 text waves
// bit 0&1 value: 3 numeric & text waves
// bit 2 value: 4 full datafolder paths (except Packages directory)
//
// returns 0 for success
//
// populates provided selection wave with names of nontext waves in current datafolder
Static Function lar_populateLB( listWave, listSelWave, listType )
WAVE/T listWave
WAVE listSelWave
variable listType
variable i // counter
string popList // list of contents to place into current DF
string preserve = "" // keyworded list for preserving selection
for (i=0; i<numpnts(listWave); i+=1) // for each wave already in list
preserve+= listWave[i]+":"+num2istr(listSelWave[i])+";" // add key:value; pair, key=wavename value=selected
endfor
Redimension/N=0 listWave, listSelWave // empty out waves
switch (listType) // depending on contents to list
case 1: // = 2^0 // numeric waves only
popList = WaveList("*",";","TEXT:0") // list nontext waves
break
case 2: // = 2^1 // text waves only
popList = WaveList("*",";","TEXT:1") // list text waves
break
case 3: // = 2^0 + 2^1 // text & numeric waves
popList = WaveList("*",";","") // list all waves
break
case 4: // = 2^2 // full datafolder paths only
popList = GetDataFolderList() // same as used for drop-down menus
break
default: // unrecognized bit combinations
popList = "" // get an empty list
endswitch
Redimension/N=(ItemsInList(popList)) listWave, listSelWave // resize to fit new list
if ( ItemsInList(popList) > 0 ) // if found some results
for (i=0; i<ItemsInList(popList); i+=1) // for each found wave
listWave[i] = StringFromList(i, popList) // put into wave list
if ( NumberByKey(listWave[i], preserve) & 0x01 ) // if prior state (looked up by wave's name) was selected
listSelWave[i] = 1 // set selected
else // if not found in prior state list
listSelWave[i] = 0 // set unselected
endif
endfor
endif
return 0 // return success
End
// lar_getGlobalSRef( strName, subfolder, defaultStr )
// strName string containing name of global string to access
// subfolder subfolder within package datafolder; set empty string for none
// defaultStr string to set as default value in case global must be created
//
// returns string path to global string of name 'strName'
//
// Function first enters or creates folder 'Packages:lar_tools:xxxxxxx' where xxxxxxx
// is determined by the 'subfolder' argument, then creates global string variable if not
// existing and assigns default value 'defaultStr'
Static Function/S lar_getGlobalSRef(strName, subfolder, defaultStr)
string strName // name of global string to access
string subfolder // inside which subfolder of kPackageGlobalsPath
string defaultStr // value to give if not found
string DFpath // path to string
lar_initPkgFldr() // ensure base packages folders are present
DFpath = "root:Packages:"+ksPackageSubfolder // base folder directory
if ( strlen(subfolder) > 0 ) // if subfolder supplied
DFpath += ":"+PossiblyQuoteName(subfolder) // add to path
NewDataFolder/O $DFpath // ensure subfolder exists
endif
DFpath += ":"+strName // append wave's name to path
SVAR/Z foo = $DFpath // refer to global
if ( !SVAR_exists(foo) ) // if doesn't exist
string/G $DFpath = defaultStr // create it
endif
return DFpath // return path
End
// lar_getGlobalVRef( varName, subfolder, defaultVal )
// varName string containing name of global variable to access
// subfolder subfolder within package datafolder; set empty string for none
// defaultVal value to set as default in case global must be created
//
// returns string path to global string variable of name 'strName'
//
// Function first enters or creates folder 'Packages:lar_tools:xxxxxxx' where xxxxxxx
// is determined by the 'subfolder' argument, then creates global numeric variable if not
// existing and assigns default value 'defaultVal'
Static Function/S lar_getGlobalVRef(varName, subfolder, defaultVal)
string varName // name of global var to access
string subfolder // inside which subfolder of kPackageGlobalsPath
variable defaultVal // value to give if not found
string DFpath // full path to variable
lar_initPkgFldr() // ensure base packages folders exist
DFpath = "root:Packages:"+ksPackageSubfolder // base folder
if ( strlen(subfolder) > 0 ) // if subfolder was supplied
DFpath += ":"+PossiblyQuoteName(subfolder) // add to path
NewDataFolder/O $DFpath // ensure subfolder exists
endif
DFpath += ":"+varName // append variable name to path
NVAR/Z foo = $DFpath // make ref to global
if ( !NVAR_exists(foo) ) // if doesn't exist
variable/G $DFpath = defaultVal // create it
endif
return DFpath // pass back path
End
// lar_getGlobalWRef( wName, subfolder, wType )
// wName string containing name of wave to access
// subfolder subfolder within package datafolder; set empty string for none
// wType wave type to create if needed (sum values to specify; see WaveType/Y= for details
// specify a negative value to use default (2=single precision numeric)
// Value Bit # Hex Val Type
// 0 - - text
// 1 0 1 complex flag (used with any nontext type)
// 2 1 2 32-bit float, single prec
// 4 2 4 64-bit float, double prec
// 8 3 8 8-bit integer
// 16 4 10 16-bit integer
// 32 5 20 32-bit integer
// 64 6 40 unsigned flag (used with any integer type)
//
// returns string path to wave of name 'wName' in packages subfolder
//
// Function first enters or creates folder 'Packages:lar_tools:xxxxxxx' where xxxxxxx
// is determined by the 'subfolder' argument, then creates empty single-point wave, if one
// is not existing, using the provided wavetype code (single-precision numeric by default)
Static Function/S lar_getGlobalWRef( wName, subfolder, wType)
string wName // name of wave to access
string subfolder // inside which subfolder of kPackageGlobalsPath
variable wType // code for making new wave if needed
variable free // boolean: nonzero for free waves
string DFpath
lar_initPkgFldr() // ensure packages base folders exists
DFpath = "root:Packages:"+ksPackageSubfolder // base folder
if ( strlen(subfolder) > 0 ) // if subfolder provided
DFpath += ":"+subfolder // append to path
NewDataFolder/O $DFpath // ensure subfolder exists
endif
DFpath += ":"+wName // append wave name to path
wave/Z foo = $DFpath // ref to wave
if ( !WaveExists(foo) ) // if wave missing
if ( wType < 0 ) // if negative (default) // if not
Make/N=0 $DFpath // use igor defaults, length 0
elseif ( wType == 0 ) // if zero (text wave) // if not
Make/T/N=0/Y=(wType) $DFpath // add /T flag for auto reference ability
elseif ( wType & 0x01 ) // if wave type code says complex // if not
Make/C/N=0/Y=(wType) $DFpath // add /C flag for auto reference ability
else // otherwise // if not
Make/N=0/Y=(wType) $DFpath // create only using type code
endif
endif
return DFpath // return path to wave
End
Static Function/DF SwitchToWorkFolder()
return PromptSetDataFolder()
End
//Window lar_makeWSWDPanel_1() : Panel
// PauseUpdate; Silent 1 // building window...
// NewPanel /K=1 /W=(108,141,378,701)
// SetDrawLayer UserBack
// DrawLine 273,317,290,328
// DrawLine 291,326,273,339
// SetDrawEnv fname= "MS Sans Serif"
// DrawText 153,504,"points set to NAN"
// SetDrawEnv fname= "MS Sans Serif"
// DrawText 12,519,"Set 100% to disable"
// PopupMenu inFolder,pos={10,9},size={250,21},bodyWidth=250,proc=makeWSWD_popup
// PopupMenu inFolder,mode=1,popvalue="root:'2010.08.25_1hz':",value= #"lar_getFolderList()"
// GroupBox sonicBox,pos={3,38},size={262,107},title="Sonic Data",frame=0
// PopupMenu uPU,pos={11,59},size={141,21},bodyWidth=130,proc=lar_tools#lar_wswdPopupProc,title="U"
// PopupMenu uPU,mode=1,popvalue="PHOTON_CNT",value= #"WaveList(\"*\",\";\",\"TEXT:0\")"
// TitleBox Utext,pos={156,57},size={101,26},title="(+) = into sonic array,\r\t\t\tparallel to boom"
// TitleBox Utext,frame=0
// PopupMenu vPU,pos={12,88},size={140,21},bodyWidth=130,proc=lar_tools#lar_wswdPopupProc,title="V"
// PopupMenu vPU,mode=1,popvalue="PHOTON_CNT",value= #"WaveList(\"*\",\";\",\"TEXT:0\")"
// TitleBox Vtext,pos={159,90},size={93,13},title="right-handed w.r.t U",frame=0
// SetVariable azimuth,pos={10,119},size={91,16},bodyWidth=50,proc=lar_tools#lar_wswdSetVProc,title="Azimuth"
// SetVariable azimuth,format="%u",limits={0,359,1},value= _NUM:0,live= 1
// SetVariable avgperSV,pos={12,444},size={150,16},bodyWidth=60,proc=lar_tools#lar_wswdSetVProc,title="Window size (sec)"
// SetVariable avgperSV,limits={1,86400,60},value= _NUM:300,live= 1
// CheckBox evenIntCB,pos={172,445},size={82,14},proc=lar_tools#lar_wswdChkProc,title="Nice intervals"
// CheckBox evenIntCB,value= 1
// GroupBox ws,pos={5,152},size={260,107},title="Wind Speed Ouput Names",frame=0
// CheckBox ws_VavgCB,pos={13,174},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox ws_VavgCB,value= 0
// SetVariable ws_VavgSV,pos={36,174},size={221,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Vector Average:"
// SetVariable ws_VavgSV,limits={-inf,inf,0},value= _STR:"WS_vctr_*"
// TitleBox Utext5,pos={271,164},size={131,24},title="= (|U|\\Bmean\\M\\S2\\M + |V|\\Bmean\\M\\S2\\M)\\S1/2\\M"
// TitleBox Utext5,frame=0
// CheckBox ws_SavgCB,pos={13,195},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox ws_SavgCB,value= 0
// SetVariable ws_SavgSV,pos={37,195},size={220,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Scalar Average:"
// SetVariable ws_SavgSV,limits={-inf,inf,0},value= _STR:"WS_sclr_*"
// TitleBox Utext7,pos={272,190},size={117,20},title="= mean[ (|U|\\S2\\M + |V|\\S2\\M)\\S1/2\\M ]"
// TitleBox Utext7,frame=0
// CheckBox ws_SsdevCB,pos={13,214},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox ws_SsdevCB,value= 0
// SetVariable ws_SsdevSV,pos={38,215},size={219,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Scalar Std Dev:"
// SetVariable ws_SsdevSV,limits={-inf,inf,0},value= _STR:"WS_sclr_*_sdev"
// TitleBox Utext8,pos={272,212},size={117,20},title="= stdev[ (|U|\\S2\\M + |V|\\S2\\M)\\S1/2\\M ]"
// TitleBox Utext8,frame=0
// CheckBox ws_persCB,pos={13,234},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox ws_persCB,value= 0
// SetVariable ws_persSV,pos={55,234},size={202,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Persistence:"
// SetVariable ws_persSV,limits={-inf,inf,0},value= _STR:"WS_pers_*"
// TitleBox Utext6,pos={273,238},size={118,17},title="= |WS|\\Bvector\\M / WS\\Bscalar\\M"
// TitleBox Utext6,frame=0
// GroupBox wd,pos={3,268},size={262,127},title="Wind Direction Output Names"
// GroupBox wd,frame=0
// CheckBox wd_VavgCB,pos={13,290},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox wd_VavgCB,value= 0
// SetVariable wd_VavgSV,pos={35,290},size={221,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Vector Average:"
// SetVariable wd_VavgSV,limits={-inf,inf,0},value= _STR:"WD_vctr_*"
// TitleBox Utext3,pos={274,287},size={137,17},title="= atan2(-|Ux|\\Bmean\\M,-|Uy|\\Bmean\\M)"
// TitleBox Utext3,frame=0
// CheckBox wd_SavgCB,pos={13,310},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox wd_SavgCB,value= 0
// SetVariable wd_SavgSV,pos={36,310},size={220,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Scalar Average:"
// SetVariable wd_SavgSV,limits={-inf,inf,0},value= _STR:"WD_sclr_*"
// CheckBox wd_SsdevCB,pos={13,330},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox wd_SsdevCB,value= 0
// SetVariable wd_SsdevSV,pos={38,330},size={219,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Scalar Std Dev:"
// SetVariable wd_SsdevSV,limits={-inf,inf,0},value= _STR:"WD_sclr_*_sdev"
// TitleBox Utext4,pos={294,321},size={72,13},title="Mitsuta method",frame=0
// CheckBox wd_VsdevYCB,pos={14,351},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox wd_VsdevYCB,value= 0
// SetVariable wd_VsdevYSV,pos={37,350},size={220,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Vector Std Dev:"
// SetVariable wd_VsdevYSV,limits={-inf,inf,0},value= _STR:"WD_vctr_*_sdevY"
// TitleBox Utext9,pos={274,351},size={89,13},title="Yamartino estimate",frame=0
// CheckBox wd_VsdevMCB,pos={14,370},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox wd_VsdevMCB,value= 0
// SetVariable wd_VsdevMSV,pos={37,370},size={220,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Vector Std Dev:"
// SetVariable wd_VsdevMSV,limits={-inf,inf,0},value= _STR:"WD_vctr_*_sdevM"
// TitleBox Utext0,pos={274,373},size={74,13},title="Mardia estimate",frame=0
// SetVariable savepathSV,pos={34,466},size={221,16},bodyWidth=181,proc=lar_tools#lar_wswdSetVProc,title="Save in"
// SetVariable savepathSV,limits={-inf,inf,0},value= _STR:":"
// Button submit,pos={158,532},size={100,20},proc=lar_tools#lar_wswdBtnProc,title="Make WS/WD"
// Button submit,fStyle=1
// SetVariable declination,pos={128,120},size={107,16},bodyWidth=50,proc=lar_tools#lar_wswdSetVProc,title="Declination"
// SetVariable declination,format="%.1f"
// SetVariable declination,limits={-180,180,0.1},value= _NUM:0,live= 1
// SetVariable wildcardSV,pos={11,422},size={243,16},bodyWidth=80,proc=lar_tools#lar_wswdSetVProc,title="Replace * wildcard in names with "
// SetVariable wildcardSV,value= _STR:"1"
// GroupBox outputGB,pos={5,402},size={260,123},title="Output Options"
// Button formulaB,pos={19,532},size={100,20},proc=lar_tools#lar_wswdBtnProc,title="Hide formulas"
// CheckBox savepathCB,pos={12,467},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox savepathCB,value= 1
// SetVariable maxemptySV,pos={10,489},size={139,16},bodyWidth=40,proc=lar_tools#lar_boxMeanSetVProc,title=" Intervals missing >="
// SetVariable maxemptySV,format="%g%",limits={0,100,0},value= _NUM:100,live= 1
//EndMacro
//
//Window lar_makeWSWDPanel_2() : Panel
// PauseUpdate; Silent 1 // building window...
// NewPanel /K=1 /W=(108,141,526,701)
// SetDrawLayer UserBack
// DrawLine 273,317,290,328
// DrawLine 291,326,273,339
// SetDrawEnv fname= "MS Sans Serif"
// DrawText 153,504,"points set to NAN"
// SetDrawEnv fname= "MS Sans Serif"
// DrawText 12,519,"Set 100% to disable"
// PopupMenu inFolder,pos={10,9},size={250,21},bodyWidth=250,proc=makeWSWD_popup
// PopupMenu inFolder,mode=1,popvalue="root:'2010.08.25_1hz':",value= #"lar_getFolderList()"
// GroupBox sonicBox,pos={3,38},size={262,107},title="Sonic Data",frame=0
// PopupMenu uPU,pos={11,59},size={141,21},bodyWidth=130,proc=lar_tools#lar_wswdPopupProc,title="U"
// PopupMenu uPU,mode=1,popvalue="PHOTON_CNT",value= #"WaveList(\"*\",\";\",\"TEXT:0\")"
// TitleBox Utext,pos={156,57},size={101,26},title="(+) = into sonic array,\r\t\t\tparallel to boom"
// TitleBox Utext,frame=0
// PopupMenu vPU,pos={12,88},size={140,21},bodyWidth=130,proc=lar_tools#lar_wswdPopupProc,title="V"
// PopupMenu vPU,mode=1,popvalue="PHOTON_CNT",value= #"WaveList(\"*\",\";\",\"TEXT:0\")"
// TitleBox Vtext,pos={159,90},size={93,13},title="right-handed w.r.t U",frame=0
// SetVariable azimuth,pos={10,119},size={91,16},bodyWidth=50,proc=lar_tools#lar_wswdSetVProc,title="Azimuth"
// SetVariable azimuth,format="%u",limits={0,359,1},value= _NUM:0,live= 1
// SetVariable avgperSV,pos={12,444},size={150,16},bodyWidth=60,proc=lar_tools#lar_wswdSetVProc,title="Window size (sec)"
// SetVariable avgperSV,limits={1,86400,60},value= _NUM:300,live= 1
// CheckBox evenIntCB,pos={172,445},size={82,14},proc=lar_tools#lar_wswdChkProc,title="Nice intervals"
// CheckBox evenIntCB,value= 1
// GroupBox ws,pos={5,152},size={260,107},title="Wind Speed Ouput Names",frame=0
// CheckBox ws_VavgCB,pos={13,174},size={16,14},proc=lar_tools#lar_wswdChkProc,title=""
// CheckBox ws_VavgCB,value= 0
// SetVariable ws_VavgSV,pos={36,174},size={221,16},bodyWidth=140,proc=lar_tools#lar_wswdSetVProc,title="Vector Average:"
// SetVariable ws_VavgSV,limits={-inf,inf,0},value= _STR:"WS_vctr_*"