-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwcharts.js
1395 lines (1157 loc) · 60.4 KB
/
wcharts.js
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
/*
Copyright 2023 James D. Miller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// Weather Charts (wC) module
// wCharts.js
// 8:47 PM Thu March 30, 2023
/*
Dependencies:
jQuery
google charts
*/
var wC = (function() {
"use strict";
google.charts.load('current', {'packages':['corechart']});
google.charts.load('current', {'packages':['table']});
google.charts.setOnLoadCallback( queryGoogleSheet);
// Names starting with m_ indicate module-scope globals.
var m_version = 1.9;
console.log('wC version ' + m_version);
var m_temperatureChart = null;
var m_windChart = null;
var m_rawVisTable = null;
var m_smoothedVisTable = null;
var m_dataTable = null;
var m_editedDataTable = null;
var m_chartArea = {left:100, top:40, width:"70%", height:"83%"};
var m_stationName = null;
var m_problemWithURLSearch = false;
var m_selectRegions = null;
var m_selectStations = null;
var m_selectEndDate = null;
var m_endDateAtQuery = null;
var m_selectDays = null;
var m_selectDaysValueAtQuery = null;
var m_nDays = null;
var m_nDaysAtQuery = null;
var m_alreadySmoothed = false;
var m_annotated = false;
var m_width_px = 700;
var m_hAxis_format = 'haa';
var m_hAxis_gridLineCount = 9;
var m_ticks = null;
var m_temperatureTicks = null;
var m_pressureTicks = null;
var m_db_allNull, m_dp_allNull, m_bp_allNull;
var m_legendPosition = null;
var m_readyForNewQuery = null;
var m_retry_count = null;
var m_populateEndDate; // function
var m_endDateFromResponse;
var m_epochMax;
var m_isToday = null;
/*
*/
var m_timeShiftFromCentral = {
"H": -4,
"AK": -3,
"P": -2,
"M": -1,
"C": 0,
"E": 1,
"J": 15,
"NZ": 18
}
var m_months = {
Jan: '01',
Feb: '02',
Mar: '03',
Apr: '04',
May: '05',
Jun: '06',
Jul: '07',
Aug: '08',
Sep: '09',
Oct: '10',
Nov: '11',
Dec: '12',
}
var m_dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var m_dayNamesLong = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var m_station_map = {
//==================================================
// Stations from the Meso JSON gleaner
//==================================================
// Washington
'KRLD':{'longName':'Richland, WA', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
'KMWH':{'longName':'Moses Lake, WA', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
'KEAT':{'longName':'Wenatchee, WA', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
'KNOW':{'longName':'Port Angeles, WA', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
'K0S9':{'longName':'Port Townsend, WA', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
// Alaska
//'PABR.2':{'longName':'Utqiagvik/Barrow (Meso)', 'tz':'AK', 'dst':true, 'region':'ak', 'sheet':'meso'},
//'PAWI':{'longName':'Wainwright AP', 'tz':'AK', 'dst':true, 'region':'ak', 'sheet':'meso'},
'PAQT':{'longName':'Nuiqsut AP', 'tz':'AK', 'dst':true, 'region':'ak', 'sheet':'meso'},
'PASI':{'longName':'Sitka', 'tz':'AK', 'dst':true, 'region':'ak', 'sheet':'meso'},
'PAFA':{'longName':'Fairbanks Int AP', 'tz':'AK', 'dst':true, 'region':'ak', 'sheet':'meso'},
'PATQ':{'longName':'Atqasuk', 'tz':'AK', 'dst':true, 'region':'ak', 'sheet':'meso'},
'PANC':{'longName':'Anchorage', 'tz':'AK', 'dst':true, 'region':'ak', 'sheet':'meso'},
// BC Canada
'CYAZ':{'longName':'Tofino, BC', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
// Oregon
'HOXO':{'longName':'Hood River, OR', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
'KOTH':{'longName':'North Bend, OR', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
// Columbia River (for delta-p chart)
'KDLS':{'longName':'The Dalles, OR', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
'KTTD':{'longName':'Troutdale, OR', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
'KHRI':{'longName':'Hermiston, OR ', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'meso'},
// Fritz's sites on the cape...
'KHSE.2':{'longName':'Cape Hatteras, NC (Meso)', 'tz':'E', 'dst':true, 'region':'misc', 'sheet':'meso'},
'KCQX.2':{'longName':'Chatham, MA (Meso)', 'tz':'E', 'dst':true, 'region':'misc', 'sheet':'meso'},
// Hawaii
'PHOG':{'longName':'Maui Airport', 'tz':'H', 'dst':false, 'region':'Hawaii', 'sheet':'meso'},
'PHJR':{'longName':'Oahu, Kalaeloa Airport', 'tz':'H', 'dst':false, 'region':'Hawaii', 'sheet':'meso'},
'PHBK':{'longName':'Kauai, Barking Sands Airport', 'tz':'H', 'dst':false, 'region':'Hawaii', 'sheet':'meso'},
// Kansas
'KOJC':{'longName':'Olathe, KS', 'tz':'C', 'dst':true, 'region':'misc', 'sheet':'meso'},
// Missouri
'KSTL':{'longName':'Saint Louis, MO', 'tz':'C', 'dst':true, 'region':'misc', 'sheet':'meso'},
'KJLN':{'longName':'Joplin Regional AP, MO', 'tz':'C', 'dst':true, 'region':'misc', 'sheet':'meso'},
// MN
'KMKT.2':{'longName':'Mankato Airport (Meso)', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'meso'},
'KSOM5':{'longName':'Kasota Prairie', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'meso'},
'MN073':{'longName':'Mankato HW169-BER', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'meso'},
// Peg's home (Laurie's friend)
'KAPF':{'longName':'Naples, FL', 'tz':'E', 'dst':true, 'region':'misc', 'sheet':'meso'},
'KSRQ':{'longName':'Sarasota, FL', 'tz':'E', 'dst':true, 'region':'misc', 'sheet':'meso'},
//==================================================
// Stations from the AW XML gleaner
//==================================================
// Sites near Saint Peter.
'KMKT':{'longName':'Mankato Airport (AW)', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KMML':{'longName':'Marshall', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KFRM':{'longName':'Fairmont', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KHCD':{'longName':'Hutchinson', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KULM':{'longName':'New Ulm', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KFBL':{'longName':'Faribault', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KAEL':{'longName':'Albert Lea', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KOWA':{'longName':'Owatonna', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
// Sites near Waconia.
'KLVN':{'longName':'Lakeville', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KGYL':{'longName':'Glencoe', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KLJF':{'longName':'Litchfield', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KBDH':{'longName':'Willmar', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KPEX':{'longName':'Paynesville', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
// Sites near Worthington.
'KOTG':{'longName':'Worthington', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KSPW':{'longName':'Spencer, IA', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
// Sites near Mille Lacs (Aitkin).
'KAIT':{'longName':'Aitkin', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KJMR':{'longName':'Mora', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
// MN Sites in general.
'KFGN':{'longName':'Flag Island', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KDYT':{'longName':'Duluth', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KLSE':{'longName':'La Crosse, WI', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KONA':{'longName':'Winona', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KRGK':{'longName':'Red Wing', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KCFE':{'longName':'Buffalo Muni', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KAXN':{'longName':'Alexandria', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KFFM':{'longName':'Fergus Falls', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KADC':{'longName':'Wadena Muni', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KGHW':{'longName':'Glenwood', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KBRD':{'longName':'Brainerd', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KLXL':{'longName':'Little Falls', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
// Sites near White Bear and Saint Croix River.
'KRNH':{'longName':'New Richmond, WI', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KANE':{'longName':'Blaine', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
'KSTP':{'longName':'Saint Paul', 'tz':'C', 'dst':true, 'region':'mn', 'sheet':'aw'},
// Fritz's site on the cape...
'KCQX':{'longName':'Chatham, MA (AW)', 'tz':'E', 'dst':true, 'region':'misc', 'sheet':'aw'},
// Alaska...
'PABR':{'longName':'Utqiagvik', 'tz':'AK', 'dst':true, 'region':'ak', 'sheet':'aw'},
// Hatteras
'KHSE':{'longName':'Cape Hatteras, NC (AW)', 'tz':'E', 'dst':true, 'region':'misc', 'sheet':'aw'},
// Pasco,WA airport...
'KPSC':{'longName':'Pasco, WA', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'aw'},
// Antarctica
'NZSP':{'longName':'Amundsen-Scott', 'tz':'NZ', 'dst':false, 'region':'misc', 'sheet':'aw'},
// Japan
'RJTT':{'longName':'Tokyo INTL Airport', 'tz':'J', 'dst':false, 'region':'misc', 'sheet':'aw'},
// Bob Douglas winter home
'KSSI':{'longName':'St. Simons Island, GA', 'tz':'E', 'dst':true, 'region':'misc', 'sheet':'aw'},
//==================================================
// Stations in Hanford
//==================================================
'IDF': {'longName':'200E - IDF', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'233S':{'longName':'233S S-Plant', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'HAMR':{'longName':'Hammer', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'VSTA':{'longName':'Kennewick Vista Field', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'VERN':{'longName':'Vernita Bridge', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'100F':{'longName':'100 F Area', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'GABW':{'longName':'Gable West', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'PASC':{'longName':'Pasco', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'HMS': {'longName':'Met Station', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'RMTN':{'longName':'Rattlesnake Mtn', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'PFP': {'longName':'200 West, PFP', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'RING':{'longName':'Ringold', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'GABL':{'longName':'Gable Mountain', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'FRNK':{'longName':'Franklin County', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'WPPS':{'longName':'WNP-2', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'100N':{'longName':'100 N Area', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'WYEB':{'longName':'Wye Barricade', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'300A':{'longName':'300 Area', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'YAKB':{'longName':'Yakima Barricade', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'FFTF':{'longName':'Fast Flux Test Facility', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'BVLY':{'longName':'Beverely', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'200W':{'longName':'200 West Area', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'200E':{'longName':'200 East Area', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'100K':{'longName':'100 K Area', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'EDNA':{'longName':'Edna Railroad Crossing', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'RSPG':{'longName':'Rattlesnake Springs', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'ARMY':{'longName':'Army Loop Road', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'EOC': {'longName':'Emergency Operations', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
'PROS':{'longName':'Prosser Barricade', 'tz':'P', 'dst':true, 'region':'hanford', 'sheet':'hanford'},
//==================================================
// NOAA stations in OR and WA
//==================================================
'NBend':{'longName':'North Bend, OR (NOAA)', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'noaa'},
'MLake':{'longName':'Moses Lake, WA (NOAA)', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'noaa'},
'EBurg':{'longName':'Ellensburg, WA', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'noaa'},
'Walla':{'longName':'Walla Walla, WA', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'noaa'},
'Hermi':{'longName':'Hermiston, OR (NOAA)', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'noaa'},
'Pasco':{'longName':'Pasco, WA (NOAA)', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'noaa'},
'Dalle':{'longName':'The Dalles, OR (NOAA)', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'noaa'},
'PLand':{'longName':'Portland, OR', 'tz':'P', 'dst':true, 'region':'pnw', 'sheet':'noaa'},
}
// Create an array of key-value pairs: key, longName.
var m_stations_sorted = Object.keys( m_station_map).map( key => [key, m_station_map[ key].longName] );
// Sort the array by longName, a string (second element).
m_stations_sorted.sort( (a, b) => ( a[1].localeCompare(b[1]) ) ); // numeric sort::: items.sort((a, b) => a[1] - b[1]);
// module globals for objects brought in by initializeModule
// (none)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getSheetURL( station) {
let workBook_python = "https://docs.google.com/spreadsheets/d/1o6-x2GLbAt3XbBRaMEcGkO7e7gGcCdIu-uwHy5PybwI/edit?usp=sharing";
let workBook_perl = "https://docs.google.com/spreadsheets/d/1WIhBWjSpB7atJ3_k0-rR93e7AQ_fZib2aeTvnI0DRXQ/edit?usp=sharing";
let bookMap = {'meso':workBook_python, 'aw':workBook_python, 'hanford':workBook_perl, 'noaa':workBook_perl};
let sheetName = m_station_map[ station].sheet;
// note: adding "&headers=1" would return a header row.
let sheetURL = bookMap[ sheetName] + "&sheet=" + sheetName;
return sheetURL;
}
function initializeModule() {
// This gets called after page loads.
let initialRegion, initialStation, initialDays;
let mainCause = "";
let searchString = window.location.search.slice(1);
if (searchString) {
try {
let segments = searchString.split("&");
initialStation = segments[0].split("=")[1];
m_problemWithURLSearch = true;
if (segments.length < 2) {
mainCause = 'The query must have one "&" and segments for "station" and number of "days."';
} else if (searchString.split("=").length < 3) {
mainCause = 'There should be an "=" for each part of the query.';
} else if ( ! searchString.includes('station')) {
mainCause = 'No word "station" in the URL query.';
} else if (initialStation == "") {
mainCause = 'There is no "station" value in the URL query.';
} else if ( ! searchString.includes('days')) {
mainCause = 'No word "days" in the URL query.';
} else if ( ! ['24h','1','2','5','10'].includes( segments[1].split("=")[1])) {
mainCause = 'The "days" value should be 24h, 1, 2, 5 or 10';
} else if ( ! m_station_map[ initialStation]) {
mainCause = 'Station "' + initialStation + '" is not recognized. ';
mainCause += "It may help to <a href='"+ window.location +"'>reload</a> the page (the station may be in the latest update).";
} else {
m_problemWithURLSearch = false;
}
if (m_problemWithURLSearch) {
let queryString = "Query submitted: " + window.location.search + "<br>";
let warningMessage = queryString + mainCause + "<BR>A working example has been put in the URL above.<BR><BR>";
document.getElementById("statusSpan").innerHTML = warningMessage;
// Give them a working example.
initialStation = 'PABR';
initialRegion = m_station_map[ initialStation].region;
initialDays = "1";
} else {
initialRegion = m_station_map[ initialStation].region;
initialDays = segments[1].split("=")[1];
}
} catch (error) {
console.error( error);
initialRegion = "mn";
initialStation = "KMKT.2";
initialDays = "24h";
}
} else {
initialRegion = "mn";
initialStation = "KMKT.2";
initialDays = "24h";
}
m_readyForNewQuery = true;
m_retry_count = 0;
m_selectRegions = document.getElementById("regions");
m_selectRegions.addEventListener('change', regionChange);
function regionChange() {
populateSelectStations( m_selectRegions.value);
if (m_selectRegions.value == "mn") {
m_selectStations.value = "KMKT.2";
} else if (m_selectRegions.value == "pnw") {
m_selectStations.value = "KRLD";
} else if (m_selectRegions.value == "Hawaii") {
m_selectStations.value = "PHOG";
} else if (m_selectRegions.value == "ak") {
m_selectStations.value = "PASI";
} else if (m_selectRegions.value == "hanford") {
m_selectStations.value = "RMTN";
} else if (m_selectRegions.value == "misc") {
m_selectStations.value = "RJTT";
}
m_stationName = m_selectStations.value;
queryGoogleSheet();
}
m_selectStations = document.getElementById("stations");
function populateSelectStations( region) {
$("#stations").empty();
for (let index in m_stations_sorted) {
let key = m_stations_sorted[ index][0];
let station = m_station_map[ key];
if (station.region == region) {
let element = document.createElement("option");
element.text = station.longName;
element.value = key;
m_selectStations.add( element);
}
};
}
m_selectRegions.value = initialRegion;
populateSelectStations( initialRegion);
m_stationName = initialStation;
m_selectStations.value = m_stationName;
m_selectStations.addEventListener('change', stationChange);
function stationChange() {
console.log( m_selectStations.value);
m_stationName = m_selectStations.value;
queryGoogleSheet();
}
m_selectEndDate = document.getElementById("endDate");
m_populateEndDate = function() {
$("#endDate").empty();
let oneDayShift = 24 * 3600*1000;
let epochDate = Date.now(); // + oneDayShift
for (var i = 0; i < 200; i++) {
let shiftedDate = new Date( epochDate).toDateString();
let element = document.createElement("option");
element.text = shiftedDate;
element.value = shiftedDate;
m_selectEndDate.add( element);
epochDate -= oneDayShift;
}
}
m_populateEndDate();
m_selectEndDate.addEventListener('change', dateChange);
function dateChange() {
console.log( m_selectEndDate.value);
queryGoogleSheet();
}
m_selectDays = document.getElementById("nDays");
m_selectDays.value = initialDays;
m_selectDays.addEventListener('change', changeDays);
function changeDays( submitQuery=true) {
m_nDays = (m_selectDays.value == "24h") ? 1 : Number( m_selectDays.value);
//console.log( "days=" + m_nDays);
if (submitQuery) queryGoogleSheet();
}
changeDays( false); // "false" initializes the chart settings without submitting the query.
}
function changeUpdateButton( state) {
if (state == "wait") {
$("#updateButton").html("Wait");
$("#updateButton").css("background-color", "#505050");
$("#updateButton").css("color", "white");
$("#updateButton").css("border-width", "0px");
} else if (state == "update") {
$("#updateButton").html("Update");
$("#updateButton").css("background-color", "#F0F0F0");
$("#updateButton").css("color", "black");
$("#updateButton").css("border-width", "1px");
} else {
// nothing
}
}
function queryGoogleSheet() {
let endTimeLocal;
if ( ! m_readyForNewQuery) return;
// Keep track of these in case user has changed select values while waiting for the response.
m_endDateAtQuery = m_selectEndDate.value;
m_selectDaysValueAtQuery = m_selectDays.value;
m_nDaysAtQuery = m_nDays;
changeUpdateButton("wait");
m_readyForNewQuery = false;
if ( ! m_problemWithURLSearch) document.getElementById("statusSpan").textContent="";
let query = new google.visualization.Query( getSheetURL( m_stationName));
let nowLocal = new Date();
// Check the first date in the endDate select list. If old, repopulate the list.
let firstDate = new Date( Date.parse( $("#endDate").find("option:first-child").val() ));
var firstIsToday = ( firstDate.toDateString() == nowLocal.toDateString() );
if ( ! firstIsToday) m_populateEndDate();
let endDate = new Date( Date.parse( m_selectEndDate.value + " 23:59:59"));
m_isToday = (nowLocal.toDateString() == endDate.toDateString());
//console.log(m_isToday + ": " + nowLocal.toDateString() + "===" + endDate.toDateString());
if ((m_selectDaysValueAtQuery == "24h") && (m_isToday)) {
endTimeLocal = nowLocal;
} else {
//let tz_shift_hr = hoursFromUTC( m_stationName, endDate);
//console.log("tz_shift_hr="+tz_shift_hr);
endTimeLocal = dateTimeWithTZ( m_stationName, m_selectEndDate.value + " 23:59:59", true);
//console.log("endTimeLocal=" + endTimeLocal.toString());
//tz_shift_hr = 0;
//endTimeLocal = new Date( endDate.getTime() + (tz_shift_hr * 3600*1000));
}
//let endTimeLocal = (m_isToday) ? nowLocal: endDate;
//console.log("UTC = " + endTimeLocal.toUTCString());
let endTime_UTCstring = endTimeLocal.toISOString();
//console.log("ISO = " + endTime_UTCstring);
let endTime_queryString = endTime_UTCstring.replace("T", " ").slice(0, 19);
// Maybe modify for DLS: shave off one hour from the shift if the startTimeLocal falls outside of DLS.
// Then recalculate the startTimeLocal.
// The following two calculations of startTimeLocal work equivalently.
//let startTimeLocal = new Date( endTimeLocal.setHours( endTimeLocal.getHours() - (m_nDaysAtQuery*24 - 0)));
let adder_h = ([1,2].includes( m_nDaysAtQuery)) ? (10/60) : 0; // back up another nn/60 minutes for the 1 and 2 day plots.
let startTimeLocal = new Date( endTimeLocal.getTime() - (m_nDaysAtQuery * (24+adder_h)*3600*1000));
// 2023-02-04T00:57:01.634Z
let startTime_UTCstring = startTimeLocal.toISOString();
//console.log("UTC = " + startTime_UTCstring);
// 2023-02-04 00:40:51
let startTime_queryString = startTime_UTCstring.replace("T", " ").slice(0, 19);
//console.log("UTC = " + startTime_queryString);
query.setQuery("select B, C, D, F, G, E, H, A where (A = '" + m_stationName + "') and " +
"(B >= datetime '" + startTime_queryString + "') and (B <= datetime '" + endTime_queryString + "')" +
"order by B desc"); //2023-02-3 10:00:00
query.send( handleQueryResponse);
pS.logEntry( m_station_map[ m_stationName].longName + ", " + m_selectDaysValueAtQuery + ", " + m_endDateAtQuery + " v" + m_version);
}
function dayLightSavingsTime( dateString) {
// This determines if the supplied date is within daylight savings time.
// It does this by comparing the timezone offset in winter to the offset
// of the supplied date.
let nowLocal = new Date();
let winterDate = new Date( nowLocal.setMonth( 1));
let tz_diff_midWinter = winterDate.getTimezoneOffset()/60;
let dateObjectToCheck = new Date( dateString);
let tz_diff_dateToCheck = dateObjectToCheck.getTimezoneOffset()/60;
//console.log('dst--now: ' + tz_diff_dateToCheck + ', winter: ' + tz_diff_midWinter);
let dst = (tz_diff_dateToCheck != tz_diff_midWinter);
return dst;
}
function hoursFromUTC( stationName, dateString, useDST=true) {
// Shift for station timezone difference from UTC.
let shift_from_CST = m_timeShiftFromCentral[ m_station_map[ stationName].tz];
let shift_from_UTC = 6 - shift_from_CST; // not considering dst
// Establish DST: use the supplied date AND whether the station is in a timezone that follows daylight savings time.
let dst = (dayLightSavingsTime( dateString) && m_station_map[ stationName].dst);
let shift_dst = (dst && useDST) ? -1:0; // -1:0;
//console.log('shift_dst='+shift_dst);
let shift_total = shift_from_UTC + shift_dst;
return shift_total;
}
function dateTimeWithTZ( stationName, dateString, useDST=true) {
// expected format of dateString: Mon Mar 06 2023 23:59:59
//console.log("dateString="+dateString);
let dateParts = dateString.split(" ");
// format of cleanDateString: YYYY-MM-DD HH:MM:SS
let cleanDateString = dateParts[3] + "-" + m_months[ dateParts[1]] + "-" + dateParts[2] + " " + dateParts[4];
//console.log("cleanDateString="+cleanDateString);
let shift_total = -hoursFromUTC( stationName, dateString, useDST);
let shiftAbs = String( Math.abs( shift_total)).padStart(2,"0");
let tz_string = (shift_total >= 0 ) ? "+"+shiftAbs : "-"+shiftAbs; // example: -02 or +14
let total_dateString = cleanDateString + tz_string;
//console.log('total_dateString='+total_dateString);
let dT_withTZ = new Date( Date.parse( total_dateString));
return dT_withTZ;
}
function setChartOptionsByDays( nDays) {
let cA_height = "78%";
if (nDays == 1) {
m_width_px = 700;
m_chartArea.width = "75%";
m_chartArea.height = cA_height;
m_hAxis_format = 'haa';
m_hAxis_gridLineCount = 9; // 9
m_legendPosition = "top";
} else if (nDays == 2) {
m_width_px = 800;
m_chartArea.width = "80%";
m_chartArea.height = cA_height; // 83
m_hAxis_format = 'EEE d'; // haa hh aa EEE d
m_hAxis_gridLineCount = 6; // 3
m_legendPosition = "top";
} else if (nDays == 5) {
m_width_px = 800;
m_chartArea.width = "80%";
m_chartArea.height = cA_height;
m_hAxis_format = 'EEE d'; // hh aa
m_hAxis_gridLineCount = 5; // 3
m_legendPosition = "top";
} else if (nDays == 10) {
m_width_px = 1400; // 1400
m_chartArea.width = "86%";
m_chartArea.height = cA_height; //75 83
m_hAxis_format = 'EEE d';
m_hAxis_gridLineCount = 8; // 8
m_legendPosition = "in"; // in or top
}
}
function handleQueryResponse( response) {
// Update URL and query string.
let base_URL = window.location.href.split("?")[0];
let searchString = "?station=" + m_stationName + "&days=" + m_selectDaysValueAtQuery;
window.history.replaceState(null, null, base_URL + searchString);
// Make table...
m_dataTable = response.getDataTable();
// long names for the columns, used in both the raw and smoothed tables
let ln = {db:"dry bulb", dp:"dew point", bp:"barometer", ws:"speed", wg:"gust", wd:"direction"};
// set (header) labels corresponding to the columns in the query
m_dataTable.setColumnLabel( 1, ln.db);
m_dataTable.setColumnLabel( 2, ln.dp);
m_dataTable.setColumnLabel( 3, ln.ws);
m_dataTable.setColumnLabel( 4, ln.wg);
m_dataTable.setColumnLabel( 5, ln.wd);
m_dataTable.setColumnLabel( 6, ln.bp);
if (m_dataTable.getNumberOfRows() < 3) {
document.getElementById("statusSpan").textContent="No data returned for this date and station. Please try again.";
changeUpdateButton("update");
m_readyForNewQuery = true;
if (m_temperatureChart) m_temperatureChart.clearChart();
if (m_windChart) m_windChart.clearChart();
document.getElementById('tableDiv').innerHTML = "";
document.getElementById('editedTableDiv').innerHTML = "";
return
} else {
if ( ! m_problemWithURLSearch) document.getElementById("statusSpan").textContent="";
}
//console.log( "response=" + JSON.stringify( response));
// header row with column labels
let editedArray = [["shiftdate", "shifted epoch", ln.db, ln.dp, ln.bp, ln.ws, ln.wg, ln.wd]];
// Use the end-date used in the query to establish dst.
let nowLocal = new Date( m_endDateAtQuery + " 12:00:00"); // m_selectEndDate.value + " 23:59:59"
let shift_total = hoursFromUTC( m_stationName, nowLocal);
function aN( value, sensor) {
// check if sensor has any non-null values (i.e. can be plotted)
if (value) {
if (sensor == "db") {
m_db_allNull = false;
} else if (sensor == "dp") {
m_dp_allNull = false;
} else if (sensor == "bp") {
m_bp_allNull = false;
}
}
return value;
}
m_db_allNull = true; m_dp_allNull = true; m_bp_allNull = true;
let tempRange = {min:200, max:-200};
let pressureRange = {min:200, max:-200};
m_epochMax = 0;
for (var i = 0; i < m_dataTable.getNumberOfRows(); i++) {
let UTC_date = m_dataTable.getValue(i, 0);
// This is one way to force the time values in the spreadsheet to be interpreted as UTC.
let epoch_true = Date.parse( m_dataTable.getValue(i, 0).toString().slice(0,24) + ' UTC');
let UTC_date_true = new Date( epoch_true);
// Keep track of the max value for use in calculating the lag of the latest record behind current time.
if (epoch_true > m_epochMax) m_epochMax = epoch_true;
//shift_total = hoursFromUTC( m_stationName, UTC_date);
//console.log('shift_total='+shift_total);
//console.log("UTC_date=" + UTC_date);
// Beware!! This is not really an epoch. There is some assumption of timezone associated with the
// spreadsheet values (in UTC_date). This is not equivalent to the epoch_true values above.
// However, this shifting effectively works, apparently because getTime() and
// new Date() both assume the same timezone (the browser).
let epoch_msec = UTC_date.getTime();
let shifted_epoch_msec = epoch_msec - (shift_total * 3600*1000);
let shifted_date = new Date( shifted_epoch_msec);
//console.log("shift=" + shifted_date);
//console.log("")
// Shift the date to local (station timezone) in the raw data table.
m_dataTable.setValue(i, 0, shifted_date);
let dryBulb = m_dataTable.getValue(i, 1);
let dewPoint = m_dataTable.getValue(i, 2);
let pressure = m_dataTable.getValue(i, 6);
let wind_speed = m_dataTable.getValue(i, 3);
let wind_gust = m_dataTable.getValue(i, 4);
let wind_dir = m_dataTable.getValue(i, 5);
if (dryBulb) {
tempRange.min = Math.min( dryBulb, tempRange.min);
tempRange.max = Math.max( dryBulb, tempRange.max);
}
if (dewPoint) {
tempRange.min = Math.min( dewPoint, tempRange.min);
tempRange.max = Math.max( dewPoint, tempRange.max);
}
if (pressure) {
pressureRange.min = Math.min( pressure, pressureRange.min);
pressureRange.max = Math.max( pressure, pressureRange.max);
}
// Populate the array (of row arrays) that will be the source for the smoothing operations.
editedArray = editedArray.concat( [[shifted_date, shifted_epoch_msec,
aN( dryBulb, "db"),
aN( dewPoint, "dp"),
aN( pressure, "bp"),
wind_speed,
wind_gust,
wind_dir
]]);
}
m_endDateFromResponse = m_dataTable.getValue(0, 0);
//console.log('end_date==='+m_endDateFromResponse);
function yTicks( sensorMin, sensorMax, stepSize, decimalPlaces) {
let tickMin = Math.floor( sensorMin/stepSize) * stepSize;
let tickMax = Math.ceil( sensorMax/stepSize) * stepSize;
let tickRange = tickMax - tickMin;
let n_ticks = Math.round( tickRange/stepSize);
let ticks = [];
let tickValue = tickMin;
for (var i = 0; i <= n_ticks; i++) {
ticks.push( tickValue.toFixed( decimalPlaces));
tickValue += stepSize;
}
return ticks;
}
m_temperatureTicks = yTicks( tempRange.min, tempRange.max, 10, 0);
if (m_temperatureTicks.length <= 2) m_temperatureTicks = yTicks( tempRange.min, tempRange.max, 5, 0);
m_pressureTicks = yTicks( pressureRange.min, pressureRange.max, 0.2, 1);
if (m_pressureTicks.length <= 2) m_pressureTicks = yTicks( pressureRange.min, pressureRange.max, 0.04, 2);
//console.log( tempRange.min + " to " + tempRange.max + ", " + m_temperatureTicks);
//console.log( pressureRange.min + " to " + pressureRange.max + ", " + m_pressureTicks);
//console.log("all null = " + m_dp_allNull + ", " + m_bp_allNull);
m_editedDataTable = new google.visualization.arrayToDataTable( editedArray);
// Format for the date-time values.
var dateFormat = new google.visualization.DateFormat({pattern: "MMM/dd/yyyy h:mm aa"}); // h:mm aa MMM/dd/yyyy ZZZZ , timeZone: -6 pattern: "MM:dd:yyyy HH:mm ZZZZ" formatType: 'long'
// Apply this format to the first column.
dateFormat.format( m_dataTable, 0);
m_alreadySmoothed = false;
m_annotated = false;
handleSmootherThenDraw();
}
function RunningAverage( tableColumn) {
this.queue = [];
this.tableColumn = tableColumn;
this.n_rowCount = m_editedDataTable.getNumberOfRows();
this.direction = (tableColumn == 7) ? true:false;
this.average = null;
}
RunningAverage.prototype.reset = function() {
this.queue = [];
}
RunningAverage.prototype.normalAverage = function() {
var total = 0;
var n_count = 0;
//Sum and average the non-null values in the queue.
for (var i in this.queue) {
if (this.queue[i]) {
total += this.queue[i];
n_count++;
}
}
let average = (n_count > 0) ? total / n_count : null;
return average;
}
RunningAverage.prototype.directionAverage = function() {
let x_total = 0;
let y_total = 0;
let n_count = 0;
let averageDir_deg_corrected = null;
for (var i in this.queue) {
if (this.queue[i]) {
x_total += Math.cos( this.queue[i] * (Math.PI/180.0) );
y_total += Math.sin( this.queue[i] * (Math.PI/180.0) );
n_count++;
}
}
// Determine the angle average from the component averages.
let averageDir_deg = Math.atan2( y_total/n_count, x_total/n_count) * (180.0/Math.PI);
// Transform the output so that all directions are positive.
if (averageDir_deg < 0) {
averageDir_deg_corrected = averageDir_deg + 360.0;
} else {
averageDir_deg_corrected = averageDir_deg + 0.0;
}
let average = (n_count > 0) ? averageDir_deg_corrected : null;
return average;
}
RunningAverage.prototype.nullZero = function( rowIndex) {
// Null if wind speed is zero
let value = m_editedDataTable.getValue( rowIndex, this.tableColumn);
if (this.direction) {
let speed = m_editedDataTable.getValue( rowIndex, this.tableColumn-2);
if (speed == 0) value = null;
}
return value;
}
RunningAverage.prototype.update = function( tableRowIndex) {
// Use raw values for the first row.
if (tableRowIndex == 0) {
this.queue[0] = this.nullZero( tableRowIndex);
// Initialize the queue in second row, where previous and next values are available.
} else if (tableRowIndex == 1) {
this.queue[0] = this.nullZero( tableRowIndex - 1);
this.queue[1] = this.nullZero( tableRowIndex);
this.queue[2] = this.nullZero( tableRowIndex + 1);
// Raw for the last row.
} else if (tableRowIndex == (this.n_rowCount-1)) {
this.queue = [];
this.queue[0] = this.nullZero( tableRowIndex);
// All the middle rows get the first two raw values from the raw values in the previous queue.
// 0-1-2
// 0-1-2
} else {
this.queue[0] = this.queue[1];
this.queue[1] = this.queue[2];
this.queue[2] = this.nullZero( tableRowIndex + 1);
}
if (this.direction) {
this.average = this.directionAverage();
} else {
this.average = this.normalAverage();
}
return this.average;
}
function smoothTheData( smoothDirection=true) {
// Each index is zero-based and refers to a column in m_editedDataTable.
let odb_RA = new RunningAverage(2);
let odp_RA = new RunningAverage(3);
let bp_RA = new RunningAverage(4);
let dir_RA = new RunningAverage(7);
for (var i = 0; i < m_editedDataTable.getNumberOfRows(); i++) {
m_editedDataTable.setValue(i, 2, odb_RA.update( i));
m_editedDataTable.setValue(i, 3, odp_RA.update( i));
m_editedDataTable.setValue(i, 4, bp_RA.update( i));
if (smoothDirection) m_editedDataTable.setValue(i, 7, dir_RA.update( i));
}
}
function handleSmootherThenDraw() {
let smoother_CB_state = document.getElementById( "chkSmoother").checked;
// Smooth if checked. Run the smoother more on the ambient data.
if (smoother_CB_state && ( ! m_alreadySmoothed)) {
smoothTheData(true);
smoothTheData(true);
smoothTheData(false);
m_alreadySmoothed = true;
}
setChartOptionsByDays( m_nDaysAtQuery);
m_ticks = makeTicks();
chartAmbientConditions( smoother_CB_state);
chartWind( smoother_CB_state);
//displayTables();
}
function stepByDays( direction) {
let selectEndDate = document.getElementById("endDate");
let stepIncrement = m_nDays;
let initialIndex = selectEndDate.selectedIndex;
if (direction == 'backward') {
let targetIndex = initialIndex + (stepIncrement * 1.0);
if (targetIndex > (selectEndDate.length - 1)) {
selectEndDate.selectedIndex = selectEndDate.selectedIndex;
} else {
selectEndDate.selectedIndex = targetIndex;
}
} else if (direction == 'forward') {
let targetIndex = initialIndex - (stepIncrement * 1.0);
if (targetIndex < 0) {
selectEndDate.selectedIndex = 0;
} else {
selectEndDate.selectedIndex = targetIndex;
}
}
if (selectEndDate.selectedIndex != initialIndex) queryGoogleSheet();
}
function addAnotationLines() {
let annotationDate, dayOfWeek;
//console.log("m_isToday=" + m_isToday);
if ((m_selectDaysValueAtQuery == "24h") && (m_isToday)) {
m_editedDataTable.addColumn({type: 'string', role: 'annotation', label: 'vertLines'});
// row for start of prior day
let previousDay = m_selectEndDate.options[ m_selectEndDate.selectedIndex + 1].text;
//console.log('previousDay=' + previousDay);
annotationDate = new Date( Date.parse( previousDay + " 00:00:00"));
dayOfWeek = m_dayNamesLong[ annotationDate.getDay()];
m_editedDataTable.addRows([[annotationDate,,,,,,,,dayOfWeek]]);
// row for noon, prior day
annotationDate = new Date( Date.parse( previousDay + " 12:00:00"));
m_editedDataTable.addRows([[annotationDate,,,,,,,,'noon']]);
// Row for midnight this day
annotationDate = new Date( Date.parse( m_selectEndDate.value + " 00:00:00"));
dayOfWeek = m_dayNamesLong[ annotationDate.getDay()];
m_editedDataTable.addRows([[annotationDate,,,,,,,,dayOfWeek]]);
// Row for noon this day
annotationDate = new Date( Date.parse( m_selectEndDate.value + " 12:00:00"));
m_editedDataTable.addRows([[annotationDate,,,,,,,,'noon']]);
// Row for next-day midnight
annotationDate = new Date( Date.parse( m_selectEndDate.value + " 24:00:00"));
dayOfWeek = m_dayNamesLong[ annotationDate.getDay()];
m_editedDataTable.addRows([[annotationDate,,,,,,,,dayOfWeek]]);
m_annotated = true;
}
}
function makeTicks() {
let xTicks = [];