-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculateEmissionFactorsv2.R
15869 lines (14976 loc) · 874 KB
/
CalculateEmissionFactorsv2.R
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
## ---------------------------
##
## Script name: CalculateEmissionFactorsv2.R
##
## Purpose of script: Process FIREX-AQ DC8 planeflight files and calculate emission factors
##
## Author: Dr. Katherine Travis
##
## Date Created: 2022-09-29
##
## Copyright (c) Katherine Travis, 2022
## Email: [email protected]
##
## ---------------------------
##
## Notes:
## Emission factors from biomass burning activities are calculated according to Equation 1 (Yokelson et al., 1999),
## EF_i (g/kg)=F_c×1000(g/kg)×(〖MW〗_i (g))/(12(g))×C_i/C_T , (1)
## where EF_i is the mass (g) of a species (i) emitted per kg of fuel burned, F_c is the fuel carbon fraction,
## 〖MW〗_i is the molecular weight of the species (i), C_i is the number of moles of the species (i), and
## C_T is the total number of moles of emitted carbon.
## The value of C_T here is calculated according to Equation 2, where NC_i is the number of carbons in species i and (∆C_i)/(∆C_x ) is the emission ratio (ER) of species i to species X (here we use CO).
## C_i/C_T =((∆C_i)/(∆C_x ))/(∑(NC_i×(∆C_i)/(∆C_x )) ), (2)
## We assume that F_c is 41% for agricultural fuels, 46% for grass, and 51% for pile and slash fuels (Stockwell et al., 2014).
## The emitted carbon is assumed to be encompassed by CO2, CO, and CH4.
##
## ---------------------------
# Location of FIREX Working directory
setwd('/Users/ktravis1/OneDrive - NASA/FIREX/FinalAnalysisForGithub/')
# ------------------------------------------------
# Required Packages ---------------------------------
require(ggmap) ; require(OrgMassSpecR); library(readxl) ;require(plyr) ; require(dplyr); require(ggpubr); require(ncdf4)
doclear=1
if (doclear == 1){ rm(list=ls()) } # clear all analysis
doFM = 0 # attempt to look at fuel moisture
source('getICARTTdata.R')
source('york_regression_function.R')
source('getGEO.R')
source('SpeciesProperties.R')
source('getERsv2.R')
doread =0; doplot = 0 # read in data or load Rdata? Plot?
# Species to calculate emission ratios to in addition to CO
xspecies='CO2_ppb'
# -------------------Read in flags ------
SLOW = 0 # don't relax R2 criteria, using fast data
# ------ Start stop times for the Adapted from the original file, and modified to break apart
# ------- plumes as described in Travis et al.
file = 'InputFiles/FIREXAQ-FIREFLAG-TABULARDATA_Analysis_20190724_R9_thru20190905.xlsx'
flags <- read_excel(file, skip = 153)
#
if (doread == 1){
# ----- [[[[[[[[[[[[[[[[[[[[ Aug 21st ]]]]]]]]]]]]]]]]]]]]] -------
# --------#######--------- Get 1 Hz Data individual 8/21------#######---------
# plume tags
tags = getICARTTdataSIMPLE('InputFiles/firexaq-fire-Flags-1HZ_DC8_20190821_R9.ict') ;tags$Time_Start = tags$TIME_START
# MET DATA
met.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-MetNav_DC8_20190821_R1.ict')
met.821.1hz = merge(met.821.1hz, tags, by='Time_Start')
# CO2
co2.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-CO2-7000_DC8_20190821_R2.ict')
# -------- DISKIN -----CO, CH4
co.ch4.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-DACOM_DC8_20190821_R1.ict')
# --------- WARNEKE ---- VOCs
warneke.821.1hz = getICARTTdataSIMPLE('InputFiles/firexaq-NOAAPTR-VOCs-1Hz_DC8_20190821_R3.ict')
# ------ HANISCO - ISAF HCHO - merged to 5Hz from the online merge
isaf.821.1hz = getICARTTdataSIMPLE('InputFiles/firexaq-ISAF-CH2O-1Hz_DC8_20190821_R0.ict')
# ------- ROLLINS - SO2 and NO
rollinsno.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LIF-NO_DC8_20190821_R1.ict')
rollinsno.821.1hz$Time_Start = rollinsno.821.1hz$time_mid
rollinsso2.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LIF-SO2_DC8_20190821_R1.ict')
rollinsso2.821.1hz$Time_Start = rollinsso2.821.1hz$time_mid
# ----- WENNBERG - CIT VOCs -
cit.821.1hz = getICARTTdataSIMPLE('InputFiles/firexaq-mrg1_dc8_20190821_R0_CIT.ict')
# ------ HUEY - GTCIMS PANs - not sure how to match up peaks here
gtcims.821.1hz = getICARTTdataSIMPLE('InputFiles/firexaq-mrg1_dc8_20190821_R0_Huey.ict')
# ------ RYERSON
ryerson.A = getICARTTdataSIMPLE('InputFiles/firexaq-NOyO3-NO_DC8_20190821_R1.ict')
ryerson.B = getICARTTdataSIMPLE('InputFiles/firexaq-NOyO3-NO2_DC8_20190821_R1.ict')
ryerson.C = getICARTTdataSIMPLE('InputFiles/firexaq-NOyO3-NOy_DC8_20190821_R1.ict')
ryerson.D = getICARTTdataSIMPLE('InputFiles/firexaq-NOyO3-O3_DC8_20190821_R1.ict')
ryerson.821.1hz = cbind(ryerson.A,ryerson.B,ryerson.C,ryerson.D) ; ryerson.821.1hz$Time_Start = ryerson.821.1hz$Time_start
# ----- JIMENEZ ---
jimenez.821.1hz = getICARTTdataSIMPLE('InputFiles/firexaq-EESI_DC8_20190821_R1.ict')
# ----- SCHWARZ ---
schwarz.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-SP2-BC-1HZ_DC8_20190821_R2.ict')
# ----- FREID ---
freid.c2h6.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-C2H6_DC8_20190821_R3.ict')
freid.ch2o.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-CH2O_DC8_20190821_R3.ict')
# ------ WOMACK ---
womackA = getICARTTdataSIMPLE('InputFiles/firexaq-ACES-CH3COCHO_DC8_20190821_R1.ict')
womackB = getICARTTdataSIMPLE('InputFiles/firexaq-ACES-CHOCHO_DC8_20190821_R1.ict')
womackC = getICARTTdataSIMPLE('InputFiles/firexaq-ACES-HNO2_DC8_20190821_R1.ict')
womackD = getICARTTdataSIMPLE('InputFiles/firexaq-ACES-NO2_DC8_20190821_R1.ict')
womack.821.1hz = cbind(womackA, womackB, womackC, womackD)
# -------St Clair
stclair.821.1hz = getICARTTdataSIMPLE('InputFiles/firexaq-CANOE-NO2_DC8_20190821_R0.ict')
stclair.821.1hz$Time_Start = stclair.821.1hz$Time_start
# ------- VERES
veres.A = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-ClNO2_DC8_20190821_R0.ict')
veres.B = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-HCOOH_DC8_20190821_R1.ict')
veres.C = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-HNO2_DC8_20190821_R1.ict')
veres.D = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-N2O5_DC8_20190821_R0.ict')
veres.E = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-HPMTF_DC8_20190821_R0.ict')
veres.F = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-CH3COOCl_DC8_20190821_R0.ict')
veres.G = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-Cl2_DC8_20190821_R0.ict')
veres.H = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-BrCl_DC8_20190821_R0.ict')
veres.I = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-BrCN_DC8_20190821_R0.ict')
veres.J = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-BrO_DC8_20190821_R0.ict')
veres.K = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-HCN_DC8_20190821_R0.ict')
veres.L = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAACIMS-HNCO_DC8_20190821_R0.ict')
veres.821.1hz = cbind(veres.A,veres.B,veres.C,veres.D,veres.E,veres.F,veres.G,veres.H,veres.I,veres.J,veres.K,veres.L)
# --- WISTHALER
#wisthaler.821.1hz = getICARTTdataSIMPLE('InputFiles/firexaq-PTRMS-NH3-1Hz_DC8_20190821_R1.ict')
# ---- BLAKE
blake.821.1hz = getICARTTdataSIMPLE('InputFiles/WAS-MERGE/firexaq-mrgWAS-dc8_merge_20190821_R1.ict')
cc = colnames(blake.821.1hz)
blake.821.merge = blake.821.1hz[,c(1,2,96:225)]
blake.821.merge$CO_DACOM_DISKIN_BLAKE = blake.821.1hz$CO_DACOM_DISKIN
blake.821.merge$CO2_7000_ppm_DISKIN_BLAKE = blake.821.1hz$CO2_7000_ppm_DISKIN
# ------ APEL
apel.821.1hz = getICARTTdataSIMPLE('InputFiles/TOGA-MERGE/firexaq-mrgTOGA-dc8_merge_20190821_R1.ict')
cc = colnames(apel.821.1hz)
apel.821.merge = apel.821.1hz[,c(1,2,226:315)]
apel.821.merge$CO_DACOM_DISKIN_APEL = apel.821.1hz$CO_DACOM_DISKIN
apel.821.merge$CO2_7000_ppm_DISKIN_APEL =apel.821.1hz$CO2_7000_ppm_DISKIN
# Becky's better merge
file = 'InputFiles/Hornbrook/FIREX-AQ weighted TOGA merge 2022-01-24_0821.xlsx'
newTOGA.821 = readxl::read_xlsx(file); newTOGA.821[newTOGA.821==-999] = NaN; newTOGA.821[newTOGA.821==-888] = NaN
newTOGA.821$CO_DACOM_DISKIN_BECKY = newTOGA.821$CO_DACOM_DISKIN
newTOGA.821$CO2_7000_ppm_DISKIN_BECKY = NaN
newTOGA.821$Time_Start=newTOGA.821$Time_Start...4
# ----GILMAN
gilman.821.1hz = getICARTTdataSIMPLE('InputFiles/iWAS-MERGE/firexaq-mrgiWAS-dc8_merge_20190821_R1.ict')
cc = colnames(gilman.821.1hz)
gilman.821.merge = gilman.821.1hz[,c(1,2,316:361)]
gilman.821.merge$CO_DACOM_DISKIN_GILMAN = gilman.821.1hz$CO_DACOM_DISKIN
gilman.821.merge$CO2_7000_ppm_DISKIN_GILMAN = gilman.821.1hz$CO2_7000_ppm_DISKIN
#gilman.821.1hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-NOAA-iWAS-VOCs_DC8_20190821_R0.ict')
# ------ Moore
moore.821fast = getICARTTdataSIMPLE('InputFiles/firexaq-mrg5hz_dc8_20190821_R0_MOORE.ict')
moore.821p1 = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LARGE-AerosolCloudConc_DC8_20190821_R0.ict')
moore.821p2 = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LARGE-LAScold_DC8_20190821_R0.ict')
moore.821p3 = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LARGE-LAShot_DC8_20190821_R0.ict')
moore.821p4 = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LARGE-CPSPD_DC8_20190821_R0.ict')
moore.821p5 = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LARGE-CDP_DC8_20190821_R0.ict')
moore.821p6 = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LARGE-SMPS_DC8_20190821_R0.ict')
moore.821 =merge(moore.821p1, moore.821p2, by='Time_mid', all = TRUE, incomparables = NA)
moore.821 =merge(moore.821, moore.821p3, by='Time_mid', all = TRUE, incomparables = NA)
moore.821 =merge(moore.821, moore.821p4, by='Time_mid', all = TRUE, incomparables = NA)
moore.821 =merge(moore.821, moore.821p5, by='Time_mid', all = TRUE, incomparables = NA)
moore.821 =merge(moore.821, moore.821p6, by='Time_mid', all = TRUE, incomparables = NA)
# ------- append PI to colnames 1hz ----------
cc = colnames(co2.821.1hz)
cc[2] = paste(cc[2],'_DISKIN',sep='')
colnames(co2.821.1hz) = cc
cc = colnames(co.ch4.821.1hz)
cc[2:4] = paste(cc[2:4],'_DISKIN',sep='')
colnames(co.ch4.821.1hz) = cc
cc=colnames(met.821.1hz)
colnames(isaf.821.1hz) = c("Time_Start" , "CH2O_ISAF_HANISCO" ,"CH2O_ISAF_precision_HANISCO")
cc[2:36] = paste(cc[2:36],'_YANG',sep='')
colnames(met.821.1hz) = cc
cc = colnames(warneke.821.1hz)
cc[2:43] = paste(cc[2:43],'_WARNEKE', sep='')
colnames(warneke.821.1hz) = cc
cc = colnames(rollinsno.821.1hz)
cc[2] = paste(cc[2],'_ROLLINS',sep='')
colnames(rollinsno.821.1hz) = cc
cc = colnames(rollinsso2.821.1hz)
cc[2] = paste(cc[2],'_ROLLINS',sep='')
colnames(rollinsso2.821.1hz) = cc
# make GTCIMS consistent with 1s merge
cc=colnames(gtcims.821.1hz)
cc[4:7] = c("PAN_GTCIMS_HUEY" , "PPN_GTCIMS_HUEY" ,"APAN_GTCIMS_HUEY" ,"PBN_GTCIMS_HUEY")
colnames(gtcims.821.1hz)=cc
# since ISAF, CIT, and GTCIMS came from merge tool, alread has PI's appended.
ryerson.821.1hz <- ryerson.821.1hz[, !duplicated(colnames(ryerson.821.1hz))]
cc = colnames(ryerson.821.1hz)
cc[2:9] = paste(cc[2:9],'_RYERSON',sep='')
colnames(ryerson.821.1hz)=cc
cc = colnames(schwarz.821.1hz)
cc[2:3] = paste(cc[2:3],'_SCHWARZ', sep='')
colnames(schwarz.821.1hz) =cc
cc = colnames(freid.c2h6.821.1hz)
cc[4:7] = paste(cc[4:7], '_FRIED',sep='')
colnames(freid.c2h6.821.1hz) = cc
cc = colnames(freid.ch2o.821.1hz)
cc[4:7] = paste(cc[4:7], '_FRIED',sep='')
colnames(freid.ch2o.821.1hz) = cc
colnames(freid.ch2o.821.1hz) = cc
womack.821.1hz <- womack.821.1hz[, !duplicated(colnames(womack.821.1hz))]
cc = colnames(womack.821.1hz)
cc[2:5] = paste(cc[2:5], '_WOMACK',sep='')
colnames(womack.821.1hz) = cc
veres.821.1hz <- veres.821.1hz[, !duplicated(colnames(veres.821.1hz))]
cc = colnames(veres.821.1hz)
cc[2:13] = paste(cc[2:13], '_VERES',sep='')
colnames(veres.821.1hz) = cc
#cc = colnames(wisthaler.821.1hz)
#cc[4:5] = paste(cc[4:5], '_WISTHALER',sep='')
#colnames(wisthaler.821.1hz) = cc
cc = colnames(jimenez.821.1hz)
cc[2:8] = paste(cc[2:8], '_JIMENEZ',sep='')
colnames(jimenez.821.1hz) = cc
# --------#######--------- Get 5 or 10 Hz Data 8/21------#######---------
# MET DATA - BUI + YANG + DLH
met.821.5hz = getICARTTdataSIMPLE('InputFiles/firexaq-mrg5hz_dc8_20190821_R0_met.ict')
# CO2
co2.821.5hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-CO2-7000-5Hz_DC8_20190821_R1.ict')
#CO, CH4
co.ch4.821.5hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-DACOM-5Hz_DC8_20190821_R1.ict')
# WARNEKE VOCs
warneke.821.5hz = getICARTTdataSIMPLE('InputFiles/firexaq-NOAAPTR-VOCs-5Hz_DC8_20190821_R3.ict')
# ISAF HCHO - merged to 5Hz from the online merge
isaf.821.5hz = getICARTTdataSIMPLE('InputFiles/firexaq-mrg5hz_dc8_20190821_R0_ISAF.ict')
# ROLLINS SO2 and NO
rollinsno.821.5hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LIF-NO-5Hz_DC8_20190821_R0.ict')
rollinsso2.821.5hz = getICARTTdataSIMPLE('InputFiles/FIREXAQ-LIF-SO2-5Hz_DC8_20190821_R1.ict')
# CIT VOCs -
cit.821.5hz = getICARTTdataSIMPLE('InputFiles/firexaq-mrg5hz_dc8_20190821_R0_CIT.ict')
# GTCIMS PANs - not sure how to match up peaks here
gtcims.821.5hz = getICARTTdataSIMPLE('InputFiles/firexaq-mrg5hz_dc8_20190821_R0_huey.ict')
# ----- Jimenez ---
jimenez.821.5hz = getICARTTdataSIMPLE('InputFiles/firexaq-mrg5hz_AMS_20190821_R0_20230314T134024.ict')
jimenez.821.5hz$OC_PM1_AMS_JIMENEZ = jimenez.821.5hz$OA_PM1_AMS_JIMENEZ/jimenez.821.5hz$OAtoOC_PM1_AMS
# ------- append PI to colnames ----------
cc = colnames(co2.821.5hz)
cc[2] = paste(cc[2],'_DISKIN',sep='')
colnames(co2.821.5hz) = cc
cc = colnames(co.ch4.821.5hz)
cc[2:4] = paste(cc[2:4],'_DISKIN',sep='')
colnames(co.ch4.821.5hz) = cc
cc = colnames(warneke.821.5hz)
cc[2:43] = paste(cc[2:43],'_WARNEKE', sep='')
colnames(warneke.821.5hz) = cc
cc = colnames(rollinsno.821.5hz)
cc[1] = "Time_Start" # really Time_Mid but need for merge
cc[2] = paste(cc[2],'_ROLLINS',sep='')
colnames(rollinsno.821.5hz) = cc
cc = colnames(rollinsso2.821.5hz)
cc[1] = "Time_Start" # really Time_Mid but need for merge
cc[2] = paste(cc[2],'_ROLLINS',sep='')
colnames(rollinsso2.821.5hz) = cc
# make GTCIMS consistent with 1s merge
cc=colnames(gtcims.821.5hz)
cc[38:39] = c("APAN_GTCIMS_HUEY" , "PAN_GTCIMS_HUEY")
colnames(gtcims.821.5hz)=cc
# since ISAF, CIT, and GTCIMS came from merge tool, alread has PI's appended.
# ------- get fuel moisture data --------
if (doFM == 1){
f1 = '/Users/ktravis1/Library/CloudStorage/Box-Box/FuelMoisture/fuel_moisture_content-20210715T1049Z/fmc_20190821_20Z.nc'
fid = nc_open(f1)
fuelMDead = ncvar_get(fid, varid = 'FMCG2D')
fuelMLive = ncvar_get(fid, varid = 'FMCGLH2D')
xlon = ncvar_get(fid, varid="XLONG_M")
xlat = ncvar_get(fid, varid="XLAT_M")
nc_close(fid)
}
# ========================== Copper Breaks ======================
fire="Copper Breaks"; fuel='forest'
indA = which(flags$transec_source_fire_namestr == fire)
for (i in 1:length(indA)){ #
print(c(fire,i) )
# get plume start and stop times
startO = flags$`transect_start_time (UTC s from midnight)`[indA[i]] ; start = startO
stopO = flags$`transect_end_time (UTC s from midnight)`[indA[i]]; stop = stopO
# Time align 1hz data
# cut data to plume tags
# shrink plume tags to relevant peaks
if (i == 1){start=startO+143; stop=stopO-5; startB = startO + 0; stopB = startO + 2} # Smoke in picture, but poor correlation
tmp = time_align(start,stop,co2.821.5hz, co.ch4.821.5hz,
warneke.821.5hz, isaf.821.5hz,
rollinsno.821.5hz, rollinsso2.821.5hz,
cit.821.5hz, gtcims.821.5hz,moore.821fast,
jimenez.821.5hz,met.821.5hz)
ind = which(tmp$Time_Start >= start & tmp$Time_Start <= stop )
indB = which(tmp$Time_Start >= startB & tmp$Time_Start <= stopB )
aug21st.fire = time_alignSLOWNOCANS(start,stop, co2.821.1hz, co.ch4.821.1hz,
warneke.821.1hz, isaf.821.1hz,rollinsno.821.1hz, rollinsso2.821.1hz,
cit.821.1hz,gtcims.821.1hz,ryerson.821.1hz , jimenez.821.1hz,
schwarz.821.1hz, freid.c2h6.821.1hz, freid.ch2o.821.1hz,
womack.821.1hz, stclair.821.1hz,veres.821.1hz, #wisthaler.821.1hz,
moore.821, met.821.1hz)
ind2 = which(aug21st.fire$Time_Start >= start & aug21st.fire$Time_Start <= stop )
ind2B = which(aug21st.fire$Time_Start >= startB & aug21st.fire$Time_Start <= stopB )
tmp$fire = ''; tmp$fuel = ''
aug21st.fire$fire = ''; aug21st.fire$fuel = ''
# -------- Blake cans
indBLAKE = which(blake.821.merge$Time_Start >= (start-5) & blake.821.merge$Time_Start <= stop) # check at least 5 sec before
if (length(indBLAKE) > 0){
doBlake = 1
indBLAKEBACKGROUND = indBLAKE[1] - 1
blake = blake.821.merge[indBLAKE,]
blakeBG = blake.821.merge[indBLAKEBACKGROUND,]
# go backwards till we get a background if necessary
while (blakeBG$CO_DACOM_DISKIN_BLAKE[1] > 200 ){
indBLAKEBACKGROUND = indBLAKEBACKGROUND - 1
blakeBG = blake.821.merge[indBLAKEBACKGROUND,]
}
} else{
doBlake = 0
# just dummy variables so things dont break
blake = blake.821.merge[1,]; blake$CO_DACOM_DISKIN_BLAKE=NaN;
blakeBG = blake.821.merge[1,]; blakeBG$CO_DACOM_DISKIN_BLAKE=NaN
}
# Gilman cans
indGILMAN = which(gilman.821.merge$Time_Start >= (start-0) & gilman.821.merge$Time_Start <= stop) # check at least 5 sec before?
if (length(indGILMAN) > 0){
doGILMAN = 1
peakCO = which(tmp$CO_DACOM_DISKIN[ind] == max(tmp$CO_DACOM_DISKIN[ind], na.rm=TRUE))
indGILMANBACKGROUND = indGILMAN[1] - 1
GILMAN = gilman.821.merge[indGILMAN,]
GILMANBG = gilman.821.merge[indGILMANBACKGROUND,]
if (GILMAN$Time_Start > tmp$Time_Start[ind[peakCO]]){ doGILMAN = 0} # don't use GILMAN if didn't capture peak
# go backwards till we get a background if necessary
while (GILMANBG$CO_DACOM_DISKIN_GILMAN[1] > 200 ){
indGILMANBACKGROUND = indGILMANBACKGROUND - 1
if (indGILMANBACKGROUND < 1){ # start from the end
indGILMANBACKGROUND = length(gilman.821.merge$CO_DACOM_DISKIN_GILMAN)
}
GILMANBG = gilman.821.merge[indGILMANBACKGROUND,]
}
} else{
doGILMAN = 0
# just dummy variables so things dont break
GILMAN = gilman.821.merge[1,]; GILMAN$CO_DACOM_DISKIN_GILMAN= NaN
GILMANBG = gilman.821.merge[1,]
}
# Apel
indAPEL = which(apel.821.merge$Time_Start >= (start-0) & apel.821.merge$Time_Start <= stop) # check at least 5 sec before?
if (length(indAPEL) > 0){
doAPEL = 1
indAPELBACKGROUND = indAPEL[1] - 1
APEL = apel.821.merge[indAPEL,]
APELBG = apel.821.merge[indAPELBACKGROUND,]
# go backwards till we get a background if necessary
while (APELBG$CO_DACOM_DISKIN_APEL[1] > 200 ){
indAPELBACKGROUND = indAPELBACKGROUND - 1
if (indAPELBACKGROUND < 1){ # start from the end
indAPELBACKGROUND = length(apel.821.merge$CO_DACOM_DISKIN_APEL)
}
APELBG = apel.821.merge[indAPELBACKGROUND,]
}
} else{
doAPEL = 0
# just dummy variables so things dont break
APEL = apel.821.merge[1,]; APEL$CO_DACOM_DISKIN_APEL = NaN; APEL$CO_DACOM_DISKIN_APEL = NaN
APELBG = apel.821.merge[1,]
}
# Becky
indBECKY = which(newTOGA.821$Time_Start >= (start-0) & newTOGA.821$Time_Start <= stop & newTOGA.821$Percent_plume > 0.5) # check at least 5 sec before?
if (length(indBECKY) > 0){
doBECKY = 1
indBECKYBACKGROUND = indBECKY[1] - 1
BECKY = newTOGA.821[indBECKY,]
BECKYBG = newTOGA.821[indBECKYBACKGROUND,]
# go backwards till we get a background if necessary
while (BECKYBG$CO_DACOM_DISKIN_BECKY[1] > 200 ){
indBECKYBACKGROUND = indBECKYBACKGROUND - 1
if (indBECKYBACKGROUND < 1){ # start from the end
indBECKYBACKGROUND = length(newTOGA.821$CO_DACOM_DISKIN_BECKY)
}
BECKYBG = newTOGA.821[indBECKYBACKGROUND,]
}
} else{
doBECKY = 0
# just dummy variables so things dont break
BECKY = newTOGA.821[1,]; BECKY$CO_DACOM_DISKIN_BECKY = NaN; BECKY$CO_DACOM_DISKIN_BECKY = NaN
BECKYBG = newTOGA.821[1,]
}
# plot plume?
if (doplot == 1){
plotpass5hzJUSTCO(aug21st.fire[ind2,])
plotpass5hz(aug21st.fire[ind2,])
plotpass5hzJUSTCO(tmp[ind,])
plotpass5hz(tmp[ind,])
plotpass5hzJUSTOA(tmp[ind,])
plotpass1hz(aug21st.fire[ind2,])
plotpass1hzBLAKE(aug21st.fire[ind2,])
# plot background?
plotpass5hzJUSTCO(aug21st.fire[ind2B,])
plotpass5hzJUSTCO(tmp[indB,])
}
tmp$fire[ind] = fire
aug21st.fire$fire[ind2] = fire
tmp$fuel[ind] = fuel
aug21st.fire$fuel[ind2] = fuel
BECKY$fire = fire;BECKY$fuel=fuel;BECKY$pass = i; GILMAN$fire = fire;GILMAN$fuel=fuel;GILMAN$pass = i;blake$fire = fire;blake$fuel=fuel;blake$pass = i
if (i == 1){
allfires.5hz = tmp[ind,]
allfires.1hz = aug21st.fire[ind2,]
toga.all = BECKY
was.all = blake
iwas.all = GILMAN
} else{
allfires.5hz = rbind.fill(allfires.5hz, tmp[ind,]); BECKY$fire = fire;BECKY$fuel=fuel;BECKY$pass = i; GILMAN$fire = fire;GILMAN$fuel=fuel;GILMAN$pass = i;blake$fire = fire;blake$fuel=fuel;blake$pass = i
allfires.1hz = rbind.fill(allfires.1hz, aug21st.fire[ind2,]); if (doBECKY == 1){toga.all=rbind(toga.all,BECKY)}; if (doBlake == 1){was.all = rbind(was.all, blake)}; if (doGILMAN == 1){iwas.all = rbind(iwas.all, GILMAN)}
}
# ------------------ 1Hz ERs/EFs
tmpEF1 = ERsEFsALLhzv2(aug21st.fire[ind2,],aug21st.fire[ind2B,],xspecies,fire,fuel,1,SLOW,blake, blakeBG,doBlake,GILMAN,GILMANBG,doGILMAN,BECKY, BECKYBG, doBECKY)
tmpEF1$age = median(aug21st.fire$transect_smoke_age[ind2], na.rm=TRUE); tmpEF1$transect_type = median(aug21st.fire$transect_type[ind2], na.rm=TRUE)
tmpEF1$transect_fuel_class = median(aug21st.fire$transect_fuel_class[ind2], na.rm=TRUE); tmpEF1$transect_dominant_fuel = median(aug21st.fire$transect_dominant_fuel[ind2], na.rm=TRUE); tmpEF1$transect_fuel_confidence = median(aug21st.fire$transect_fuel_confidence[ind2], na.rm=TRUE)
# ------------------ 5Hz ERs/EFs
tmpEF5 = ERsEFsALLhzv2(tmp[ind,],tmp[indB,],xspecies,fire,fuel,5,SLOW,blake, blakeBG,doBlake,GILMAN,GILMANBG,doGILMAN,BECKY, BECKYBG, doBECKY)
tmpEF5$age = median(aug21st.fire$transect_smoke_age[ind2], na.rm=TRUE) ; tmpEF5$transect_type = median(aug21st.fire$transect_type[ind2], na.rm=TRUE)
tmpEF5$transect_fuel_class = median(aug21st.fire$transect_fuel_class[ind2], na.rm=TRUE); tmpEF5$transect_dominant_fuel = median(aug21st.fire$transect_dominant_fuel[ind2], na.rm=TRUE); tmpEF5$transect_fuel_confidence = median(aug21st.fire$transect_fuel_confidence[ind2], na.rm=TRUE)
# append start and stop times to EFs
tmpEF1$pass = i ; tmpEF1$StartO = startO; tmpEF1$Start = start; tmpEF1$StopO = stopO; tmpEF1$Stop = stop
tmpEF5$pass = i ; tmpEF5$StartO = startO; tmpEF5$Start = start; tmpEF5$StopO = stopO; tmpEF5$Stop = stop
# Get fuel moisture
#tmpEF5$fuelMDead = fuelMDead[as.numeric(flags$II[indA[i]]),as.numeric(flags$JJ[indA[i]])]
#tmpEF5$fuelMLive = fuelMLive[as.numeric(flags$II[indA[i]]),as.numeric(flags$JJ[indA[i]])]
# append to fire dataframe
if (i == 1){CopperBreaks.1hz.EF = tmpEF1 ;CopperBreaks.5hz.EF = tmpEF5 }
if (i > 1){CopperBreaks.1hz.EF = rbind(CopperBreaks.1hz.EF, tmpEF1) ; CopperBreaks.5hz.EF = rbind(CopperBreaks.5hz.EF, tmpEF5) }
}
# order by species and append fire ID
CopperBreaks.5hz.EF = CopperBreaks.5hz.EF[order(CopperBreaks.5hz.EF$variable),]
CopperBreaks.5hz.EF$transect_source_fire_ID = indA[1]
CopperBreaks.1hz.EF = CopperBreaks.1hz.EF[order(CopperBreaks.1hz.EF$variable),]
CopperBreaks.1hz.EF$transect_source_fire_ID = indA[1]
# ========================== VIVIAN ======================
fire = "Vivian"
indA = which(flags$transec_source_fire_namestr == fire)
for (i in 1:length(indA)){ #
print(c(fire,i) )
# get plume start and stop times
startO = flags$`transect_start_time (UTC s from midnight)`[indA[i]] ; start = startO
stopO = flags$`transect_end_time (UTC s from midnight)`[indA[i]]; stop = stopO
# Time align 1hz data
# shrink plume tags to relevant peaks
if (i == 1){start=startO+10 ; stop=stopO-7; startB = startO + 0; stopB = startO + 2} # Also poor correlation, CO < 200 ppb
# cut data to plume tags
tmp = time_align(start,stop,co2.821.5hz, co.ch4.821.5hz,
warneke.821.5hz, isaf.821.5hz,
rollinsno.821.5hz, rollinsso2.821.5hz,
cit.821.5hz, gtcims.821.5hz,moore.821fast, jimenez.821.5hz,met.821.5hz)
ind = which(tmp$Time_Start >= start & tmp$Time_Start <= stop )
indB = which(tmp$Time_Start >= startB & tmp$Time_Start <= stopB )
aug21st.fire = time_alignSLOWNOCANS(start,stop, co2.821.1hz, co.ch4.821.1hz,
warneke.821.1hz, isaf.821.1hz,rollinsno.821.1hz, rollinsso2.821.1hz,
cit.821.1hz,gtcims.821.1hz,ryerson.821.1hz , jimenez.821.1hz,
schwarz.821.1hz, freid.c2h6.821.1hz, freid.ch2o.821.1hz,
womack.821.1hz, stclair.821.1hz,veres.821.1hz, #wisthaler.821.1hz,
moore.821, met.821.1hz)
ind2 = which(aug21st.fire$Time_Start >= start & aug21st.fire$Time_Start <= stop )
ind2B = which(aug21st.fire$Time_Start >= startB & aug21st.fire$Time_Start <= stopB )
tmp$fire = ''; tmp$fuel = ''
aug21st.fire$fire = ''; aug21st.fire$fuel = ''
tmp$fuel[ind] = 'savannah';tmp$fire[ind] = fire
aug21st.fire$fuel[ind2]='savannah';aug21st.fire$fire[ind2] = fire
# -------- Blake cans
indBLAKE = which(blake.821.merge$Time_Start >= (start-5) & blake.821.merge$Time_Start <= stop) # check at least 5 sec before
if (length(indBLAKE) > 0){
doBlake = 1
indBLAKEBACKGROUND = indBLAKE[1] - 1
blake = blake.821.merge[indBLAKE,]
blakeBG = blake.821.merge[indBLAKEBACKGROUND,]
# go backwards till we get a background if necessary
while (blakeBG$CO_DACOM_DISKIN_BLAKE[1] > 200 ){
indBLAKEBACKGROUND = indBLAKEBACKGROUND - 1
blakeBG = blake.821.merge[indBLAKEBACKGROUND,]
}
} else{
doBlake = 0
# just dummy variables so things dont break
blake = blake.821.merge[1,]; blake$CO_DACOM_DISKIN_BLAKE=NaN
blakeBG = blake.821.merge[1,]; blake$CO_DACOM_DISKIN_BLAKE=NaN
}
# Gilman cans
indGILMAN = which(gilman.821.merge$Time_Start >= (start-0) & gilman.821.merge$Time_Start <= stop) # check at least 5 sec before?
if (length(indGILMAN) > 0){
doGILMAN = 1
peakCO = which(tmp$CO_DACOM_DISKIN[ind] == max(tmp$CO_DACOM_DISKIN[ind], na.rm=TRUE))
indGILMANBACKGROUND = indGILMAN[1] - 1
GILMAN = gilman.821.merge[indGILMAN,]
GILMANBG = gilman.821.merge[indGILMANBACKGROUND,]
if (GILMAN$Time_Start > tmp$Time_Start[ind[peakCO]]){ doGILMAN = 0} # don't use GILMAN if didn't capture peak
# go backwards till we get a background if necessary
while (GILMANBG$CO_DACOM_DISKIN_GILMAN[1] > 200 ){
indGILMANBACKGROUND = indGILMANBACKGROUND - 1
if (indGILMANBACKGROUND < 1){ # start from the end
indGILMANBACKGROUND = length(gilman.821.merge$CO_DACOM_DISKIN_GILMAN)
}
GILMANBG = gilman.821.merge[indGILMANBACKGROUND,]
}
} else{
doGILMAN = 0
# just dummy variables so things dont break
GILMAN = gilman.821.merge[1,]; GILMAN$CO_DACOM_DISKIN_GILMAN= NaN
GILMANBG = gilman.821.merge[1,]
}
# Apel
indAPEL = which(apel.821.merge$Time_Start >= (start-0) & apel.821.merge$Time_Start <= stop) # check at least 5 sec before?
if (length(indAPEL) > 0){
doAPEL = 1
indAPELBACKGROUND = indAPEL[1] - 1
APEL = apel.821.merge[indAPEL,]
APELBG = apel.821.merge[indAPELBACKGROUND,]
# go backwards till we get a background if necessary
while (APELBG$CO_DACOM_DISKIN_APEL[1] > 200 ){
indAPELBACKGROUND = indAPELBACKGROUND - 1
if (indAPELBACKGROUND < 1){ # start from the end
indAPELBACKGROUND = length(apel.821.merge$CO_DACOM_DISKIN_APEL)
}
APELBG = apel.821.merge[indAPELBACKGROUND,]
}
} else{
doAPEL = 0
# just dummy variables so things dont break
APEL = apel.821.merge[1,]; APEL$CO_DACOM_DISKIN_APEL = NaN
APELBG = apel.821.merge[1,]
}
# Becky
indBECKY = which(newTOGA.821$Time_Start >= (start-0) & newTOGA.821$Time_Start <= stop & newTOGA.821$Percent_plume > 0.5) # check at least 5 sec before?
if (length(indBECKY) > 0){
doBECKY = 1
indBECKYBACKGROUND = indBECKY[1] - 1
BECKY = newTOGA.821[indBECKY,]
BECKYBG = newTOGA.821[indBECKYBACKGROUND,]
# go backwards till we get a background if necessary
while (BECKYBG$CO_DACOM_DISKIN_BECKY[1] > 200 ){
indBECKYBACKGROUND = indBECKYBACKGROUND - 1
if (indBECKYBACKGROUND < 1){ # start from the end
indBECKYBACKGROUND = length(newTOGA.821$CO_DACOM_DISKIN_BECKY)
}
BECKYBG = newTOGA.821[indBECKYBACKGROUND,]
}
} else{
doBECKY = 0
# just dummy variables so things dont break
BECKY = newTOGA.821[1,]; BECKY$CO_DACOM_DISKIN_BECKY = NaN
BECKYBG = newTOGA.821[1,]
}
# plot plume?
if (doplot == 1){
plotpass5hzJUSTCO(aug21st.fire[ind2,])
plotpass5hz(aug21st.fire[ind2,])
plotpass5hzJUSTCO(tmp[ind,])
plotpass5hz(tmp[ind,])
plotpass1hzBLAKE(aug21st.fire[ind2,])
# plot background?
plotpass5hzJUSTCO(aug21st.fire[ind2B,])
plotpass5hzJUSTCO(tmp[indB,])
}
# Save out all data for analysis
allfires.5hz = rbind.fill(allfires.5hz, tmp[ind,]); BECKY$fire = fire;BECKY$fuel=fuel;BECKY$pass = i; GILMAN$fire = fire;GILMAN$fuel=fuel;GILMAN$pass = i;blake$fire = fire;blake$fuel=fuel;blake$pass = i ; BECKY$fire = fire;BECKY$fuel=fuel;BECKY$pass = i; GILMAN$fire = fire;GILMAN$fuel=fuel;GILMAN$pass = i;blake$fire = fire;blake$fuel=fuel;blake$pass = i
allfires.1hz = rbind.fill(allfires.1hz, aug21st.fire[ind2,]); if (doBECKY == 1){toga.all=rbind(toga.all,BECKY)}; if (doBlake == 1){was.all = rbind(was.all, blake)}; if (doGILMAN == 1){iwas.all = rbind(iwas.all, GILMAN)};
# ------------------ 1Hz ERs/EFs
tmpEF1 = ERsEFsALLhzv2(aug21st.fire[ind2,],aug21st.fire[ind2B,],xspecies,fire, fuel,1,SLOW,blake, blakeBG,doBlake,GILMAN,GILMANBG,doGILMAN,BECKY, BECKYBG, doBECKY)
tmpEF1$age = median(aug21st.fire$transect_smoke_age[ind2], na.rm=TRUE); tmpEF1$transect_type = median(aug21st.fire$transect_type[ind2], na.rm=TRUE)
tmpEF1$transect_fuel_class = median(aug21st.fire$transect_fuel_class[ind2], na.rm=TRUE); tmpEF1$transect_dominant_fuel = median(aug21st.fire$transect_dominant_fuel[ind2], na.rm=TRUE); tmpEF1$transect_fuel_confidence = median(aug21st.fire$transect_fuel_confidence[ind2], na.rm=TRUE)
# ------------------ 5Hz ERs/EFs
tmpEF5 = ERsEFsALLhzv2(tmp[ind,],tmp[indB,],xspecies,fire, fuel,5,SLOW,blake, blakeBG,doBlake,GILMAN,GILMANBG,doGILMAN,BECKY, BECKYBG, doBECKY)
tmpEF5$age = median(aug21st.fire$transect_smoke_age[ind2], na.rm=TRUE) ; tmpEF5$transect_type = median(aug21st.fire$transect_type[ind2], na.rm=TRUE)
tmpEF5$transect_fuel_class = median(aug21st.fire$transect_fuel_class[ind2], na.rm=TRUE); tmpEF5$transect_dominant_fuel = median(aug21st.fire$transect_dominant_fuel[ind2], na.rm=TRUE); tmpEF5$transect_fuel_confidence = median(aug21st.fire$transect_fuel_confidence[ind2], na.rm=TRUE)
# append start and stop times to EFs
tmpEF1$pass = i ; tmpEF1$StartO = startO; tmpEF1$Start = start; tmpEF1$StopO = stopO; tmpEF1$Stop = stop
tmpEF5$pass = i ; tmpEF5$StartO = startO; tmpEF5$Start = start; tmpEF5$StopO = stopO; tmpEF5$Stop = stop
# Get fuel moisture
#tmpEF5$fuelMDead = fuelMDead[as.numeric(flags$II[indA[i]]),as.numeric(flags$JJ[indA[i]])]
#tmpEF5$fuelMLive = fuelMLive[as.numeric(flags$II[indA[i]]),as.numeric(flags$JJ[indA[i]])]
# append to fire dataframe
if (i == 1){Vivian.1hz.EF = tmpEF1 ;Vivian.5hz.EF = tmpEF5 }
if (i > 1){Vivian.1hz.EF = rbind(Vivian.1hz.EF, tmpEF1) ; Vivian.5hz.EF = rbind(Vivian.5hz.EF, tmpEF5) }
}
# order by species and append fire ID
Vivian.5hz.EF = Vivian.5hz.EF[order(Vivian.5hz.EF$variable),]
Vivian.5hz.EF$transect_source_fire_ID = indA[1]
Vivian.1hz.EF = Vivian.1hz.EF[order(Vivian.1hz.EF$variable),]
Vivian.1hz.EF$transect_source_fire_ID = indA[1]
# ========================== HALF PINT ======================
fire="Half pint"; fuel = "slash"
indA = which(flags$transec_source_fire_namestr == fire)
for (i in 1:length(indA)){ #
print(c(fire,i) )
# get plume start and stop times
startO = flags$`transect_start_time (UTC s from midnight)`[indA[i]] ; start = startO
stopO = flags$`transect_end_time (UTC s from midnight)`[indA[i]]; stop = stopO
# shrink plume tags to relevant peaks
if (i == 1){start=startO+3.4; stop=stopO-2.8; startB = startO + 0; stopB = startO + 2}
if (i == 2){start=startO+9; stop=stopO-.4; startB = startO + 0; stopB = startO + 2}
if (i == 3){start=startO+0; stop=stopO-16; startB = 66003; stopB = 66005}# split from above
if (i == 4){start=startO+55; stop= stopO-70; startB = startO + 0; stopB = startO + 2}
tmp = time_align(start,stop,co2.821.5hz, co.ch4.821.5hz,
warneke.821.5hz, isaf.821.5hz,
rollinsno.821.5hz, rollinsso2.821.5hz,
cit.821.5hz, gtcims.821.5hz,moore.821fast, jimenez.821.5hz,met.821.5hz)
ind = which(tmp$Time_Start >= start & tmp$Time_Start <= stop )
indB = which(tmp$Time_Start >= startB & tmp$Time_Start <= stopB )
if (i==2){start=start-1}
aug21st.fire = time_alignSLOWNOCANS(start,stop, co2.821.1hz, co.ch4.821.1hz,
warneke.821.1hz, isaf.821.1hz,rollinsno.821.1hz, rollinsso2.821.1hz,
cit.821.1hz,gtcims.821.1hz,ryerson.821.1hz , jimenez.821.1hz,
schwarz.821.1hz, freid.c2h6.821.1hz, freid.ch2o.821.1hz,
womack.821.1hz, stclair.821.1hz,veres.821.1hz, #wisthaler.821.1hz,
moore.821, met.821.1hz)
ind2 = which(aug21st.fire$Time_Start >= start & aug21st.fire$Time_Start <= stop )
ind2B = which(aug21st.fire$Time_Start >= startB & aug21st.fire$Time_Start <= stopB )
# collect all ag plumes together at 5hz and 1hz
tmp$fire = ''; tmp$fuel = ''
aug21st.fire$fire = ''; aug21st.fire$fuel = ''
tmp$fuel[ind] = 'slash' ; tmp$fire = fire
aug21st.fire$fuel[ind2] = 'slash' ; aug21st.fire$fire[ind2] = fire
# -------- Blake cans
indBLAKE = which(blake.821.merge$Time_Start >= (start-5) & blake.821.merge$Time_Start <= stop) # check at least 5 sec before
if (length(indBLAKE) > 0){
doBlake = 1
indBLAKEBACKGROUND = indBLAKE[1] - 1
blake = blake.821.merge[indBLAKE,]
blakeBG = blake.821.merge[indBLAKEBACKGROUND,]
# go backwards till we get a background if necessary
while (blakeBG$CO_DACOM_DISKIN_BLAKE[1] > 200 ){
indBLAKEBACKGROUND = indBLAKEBACKGROUND - 1
blakeBG = blake.821.merge[indBLAKEBACKGROUND,]
}
} else{
doBlake = 0
# just dummy variables so things dont break
blake = blake.821.merge[1,]; blake$CO_DACOM_DISKIN_BLAKE=NaN
blakeBG = blake.821.merge[1,]; blake$CO_DACOM_DISKIN_BLAKE=NaN
}
# Gilman cans
indGILMAN = which(gilman.821.merge$Time_Start >= (start-0) & gilman.821.merge$Time_Start <= stop) # check at least 5 sec before?
if (length(indGILMAN) > 0){
doGILMAN = 1
peakCO = which(tmp$CO_DACOM_DISKIN[ind] == max(tmp$CO_DACOM_DISKIN[ind], na.rm=TRUE))
indGILMANBACKGROUND = indGILMAN[1] - 1
GILMAN = gilman.821.merge[indGILMAN,]
GILMANBG = gilman.821.merge[indGILMANBACKGROUND,]
if (GILMAN$Time_Start > tmp$Time_Start[ind[peakCO]]){ doGILMAN = 0} # don't use GILMAN if didn't capture peak
# go backwards till we get a background if necessary
while (GILMANBG$CO_DACOM_DISKIN_GILMAN[1] > 200 ){
indGILMANBACKGROUND = indGILMANBACKGROUND - 1
if (indGILMANBACKGROUND < 1){ # start from the end
indGILMANBACKGROUND = length(gilman.821.merge$CO_DACOM_DISKIN_GILMAN)
}
GILMANBG = gilman.821.merge[indGILMANBACKGROUND,]
}
} else{
doGILMAN = 0
# just dummy variables so things dont break
GILMAN = gilman.821.merge[1,]; GILMAN$CO_DACOM_DISKIN_GILMAN= NaN
GILMANBG = gilman.821.merge[1,]
}
# Apel
indAPEL = which(apel.821.merge$Time_Start >= (start-0) & apel.821.merge$Time_Start <= stop) # check at least 5 sec before?
if (length(indAPEL) > 0){
doAPEL = 1
indAPELBACKGROUND = indAPEL[1] - 1
APEL = apel.821.merge[indAPEL,]
APELBG = apel.821.merge[indAPELBACKGROUND,]
# go backwards till we get a background if necessary
while (APELBG$CO_DACOM_DISKIN_APEL[1] > 200 ){
indAPELBACKGROUND = indAPELBACKGROUND - 1
if (indAPELBACKGROUND < 1){ # start from the end
indAPELBACKGROUND = length(apel.821.merge$CO_DACOM_DISKIN_APEL)
}
APELBG = apel.821.merge[indAPELBACKGROUND,]
}
} else{
doAPEL = 0
# just dummy variables so things dont break
APEL = apel.821.merge[1,]; APEL$CO_DACOM_DISKIN_APEL = NaN
APELBG = apel.821.merge[1,]
}
# Becky
indBECKY = which(newTOGA.821$Time_Start >= (start-0) & newTOGA.821$Time_Start <= stop & newTOGA.821$Percent_plume > 0.5) # check at least 5 sec before?
if (length(indBECKY) > 0){
doBECKY = 1
indBECKYBACKGROUND = indBECKY[1] - 1
BECKY = newTOGA.821[indBECKY,]
BECKYBG = newTOGA.821[indBECKYBACKGROUND,]
# go backwards till we get a background if necessary
while (BECKYBG$CO_DACOM_DISKIN_BECKY[1] > 200 ){
indBECKYBACKGROUND = indBECKYBACKGROUND - 1
if (indBECKYBACKGROUND < 1){ # start from the end
indBECKYBACKGROUND = length(newTOGA.821$CO_DACOM_DISKIN_BECKY)
}
BECKYBG = newTOGA.821[indBECKYBACKGROUND,]
}
} else{
doBECKY = 0
# just dummy variables so things dont break
BECKY = newTOGA.821[1,]; BECKY$CO_DACOM_DISKIN_BECKY = NaN
BECKYBG = newTOGA.821[1,]
}
if (doplot == 1){
plotpass5hzJUSTCO(aug21st.fire[ind2,])
plotpass5hz(aug21st.fire[ind2,])
plotpass1hz(aug21st.fire[ind2,])
plotpass5hzJUSTCO(tmp[ind,])
plotpass5hzJUSTCN(tmp[ind,])
plotpass5hz(tmp[ind,])
# plot background?
plotpass5hzJUSTCO(aug21st.fire[ind2B,])
plotpass5hzJUSTCO(tmp[indB,])
}
allfires.5hz = rbind.fill(allfires.5hz, tmp[ind,]); BECKY$fire = fire;BECKY$fuel=fuel;BECKY$pass = i; GILMAN$fire = fire;GILMAN$fuel=fuel;GILMAN$pass = i;blake$fire = fire;blake$fuel=fuel;blake$pass = i ; BECKY$fire = fire;BECKY$fuel=fuel;BECKY$pass = i; GILMAN$fire = fire;GILMAN$fuel=fuel;GILMAN$pass = i;blake$fire = fire;blake$fuel=fuel;blake$pass = i
allfires.1hz = rbind.fill(allfires.1hz, aug21st.fire[ind2,]); if (doBECKY == 1){toga.all=rbind(toga.all,BECKY)}; if (doBlake == 1){was.all = rbind(was.all, blake)}; if (doGILMAN == 1){iwas.all = rbind(iwas.all, GILMAN)}
# ------------------ 1Hz
tmpEF1 = ERsEFsALLhzv2(aug21st.fire[ind2,],aug21st.fire[ind2B,],xspecies,fire,fuel,1,SLOW,blake, blakeBG,doBlake,GILMAN,GILMANBG,doGILMAN,BECKY, BECKYBG, doBECKY)
tmpEF1$age = median(aug21st.fire$transect_smoke_age[ind2], na.rm=TRUE); tmpEF1$transect_type = median(aug21st.fire$transect_type[ind2], na.rm=TRUE)
tmpEF1$transect_fuel_class = median(aug21st.fire$transect_fuel_class[ind2], na.rm=TRUE); tmpEF1$transect_dominant_fuel = median(aug21st.fire$transect_dominant_fuel[ind2], na.rm=TRUE); tmpEF1$transect_fuel_confidence = median(aug21st.fire$transect_fuel_confidence[ind2], na.rm=TRUE)
# ------------------ 5Hz
tmpEF5 = ERsEFsALLhzv2(tmp[ind,],tmp[indB,],xspecies,fire,fuel,5,SLOW,blake, blakeBG,doBlake,GILMAN,GILMANBG,doGILMAN,BECKY, BECKYBG, doBECKY)
tmpEF5$age = median(aug21st.fire$transect_smoke_age[ind2], na.rm=TRUE) ; tmpEF5$transect_type = median(aug21st.fire$transect_type[ind2], na.rm=TRUE)
tmpEF5$transect_fuel_class = median(aug21st.fire$transect_fuel_class[ind2], na.rm=TRUE); tmpEF5$transect_dominant_fuel = median(aug21st.fire$transect_dominant_fuel[ind2], na.rm=TRUE); tmpEF5$transect_fuel_confidence = median(aug21st.fire$transect_fuel_confidence[ind2], na.rm=TRUE)
tmpEF1$pass = i ; tmpEF1$StartO = startO; tmpEF1$Start = start; tmpEF1$StopO = stopO; tmpEF1$Stop = stop
tmpEF5$pass = i ; tmpEF5$StartO = startO; tmpEF5$Start = start; tmpEF5$StopO = stopO; tmpEF5$Stop = stop
#tmpEF5$fuelMDead = fuelMDead[as.numeric(flags$II[indA[i]]),as.numeric(flags$JJ[indA[i]])]
#tmpEF5$fuelMLive = fuelMLive[as.numeric(flags$II[indA[i]]),as.numeric(flags$JJ[indA[i]])]
if (i == 1){Halfpint.1hz.EF = tmpEF1 ;Halfpint.5hz.EF = tmpEF5 }
if (i > 1){Halfpint.1hz.EF = rbind(Halfpint.1hz.EF, tmpEF1) ; Halfpint.5hz.EF = rbind(Halfpint.5hz.EF, tmpEF5) }
}
Halfpint.1hz.EF = Halfpint.1hz.EF[order(Halfpint.1hz.EF$variable),]
Halfpint.1hz.EF$transect_source_fire_ID = indA[1]
Halfpint.5hz.EF = Halfpint.5hz.EF[order(Halfpint.5hz.EF$variable),]
Halfpint.5hz.EF$transect_source_fire_ID = indA[1]
# ========================== LORETTA ======================
fire="Loretta"; fuel = "pile"
indA = which(flags$transec_source_fire_namestr == fire)
for (i in 1:length(indA)){ #
print(c(fire,i) )
# get plume start and stop times
startO = flags$`transect_start_time (UTC s from midnight)`[indA[i]] ; start = startO
stopO = flags$`transect_end_time (UTC s from midnight)`[indA[i]]; stop = stopO
# shrink plume tags to relevant peaks
if (i == 1){start=startO+5; stop=stopO-17; startB = startO + 0; stopB = startO + 2}
if (i == 2){start=startO+6; stop=stopO-6; startB = startO + 0; stopB = startO + 2}
if (i == 3){start=startO+61; stop=stopO-16; startB = 66832; stopB = 66834} # split from above
if (i == 4){start=startO+49; stop=stopO-170; startB = startO + 0; stopB = startO + 2} # bad pass, get rid of it?
tmp = time_align(start,stop,co2.821.5hz, co.ch4.821.5hz,
warneke.821.5hz, isaf.821.5hz,
rollinsno.821.5hz, rollinsso2.821.5hz,
cit.821.5hz, gtcims.821.5hz,moore.821fast, jimenez.821.5hz,met.821.5hz)
ind = which(tmp$Time_Start >= start & tmp$Time_Start <= stop )
indB = which(tmp$Time_Start >= startB & tmp$Time_Start <= stopB )
aug21st.fire = time_alignSLOWNOCANS(start,stop, co2.821.1hz, co.ch4.821.1hz,
warneke.821.1hz, isaf.821.1hz,rollinsno.821.1hz, rollinsso2.821.1hz,
cit.821.1hz,gtcims.821.1hz,ryerson.821.1hz , jimenez.821.1hz,
schwarz.821.1hz, freid.c2h6.821.1hz, freid.ch2o.821.1hz,
womack.821.1hz, stclair.821.1hz,veres.821.1hz, #wisthaler.821.1hz,
moore.821, met.821.1hz)
ind2 = which(aug21st.fire$Time_Start >= start & aug21st.fire$Time_Start <= stop )
ind2B = which(aug21st.fire$Time_Start >= startB & aug21st.fire$Time_Start <= stopB )
tmp$fire = ''; tmp$fuel = ''
aug21st.fire$fire = ''; aug21st.fire$fuel = ''
tmp$fuel[ind] = fuel;tmp$fire[ind] = 'Loretta'
aug21st.fire$fuel[ind2] = fuel;aug21st.fire$fire[ind2] = 'Loretta'
# -------- Blake cans
indBLAKE = which(blake.821.merge$Time_Start >= (start-5) & blake.821.merge$Time_Start <= stop) # check at least 5 sec before
if (length(indBLAKE) > 0){
doBlake = 1
indBLAKEBACKGROUND = indBLAKE[1] - 1
blake = blake.821.merge[indBLAKE,]
blakeBG = blake.821.merge[indBLAKEBACKGROUND,]
# go backwards till we get a background if necessary
while (blakeBG$CO_DACOM_DISKIN_BLAKE[1] > 200 ){
indBLAKEBACKGROUND = indBLAKEBACKGROUND - 1
blakeBG = blake.821.merge[indBLAKEBACKGROUND,]
}
} else{
doBlake = 0
# just dummy variables so things dont break
blake = blake.821.merge[1,]; blake$CO_DACOM_DISKIN_BLAKE=NaN
blakeBG = blake.821.merge[1,]; blake$CO_DACOM_DISKIN_BLAKE=NaN
}
# Gilman cans
indGILMAN = which(gilman.821.merge$Time_Start >= (start-0) & gilman.821.merge$Time_Start <= stop) # check at least 5 sec before?
if (length(indGILMAN) > 0){
doGILMAN = 1
peakCO = which(tmp$CO_DACOM_DISKIN[ind] == max(tmp$CO_DACOM_DISKIN[ind], na.rm=TRUE))
indGILMANBACKGROUND = indGILMAN[1] - 1
GILMAN = gilman.821.merge[indGILMAN,]
GILMANBG = gilman.821.merge[indGILMANBACKGROUND,]
if (GILMAN$Time_Start > tmp$Time_Start[ind[peakCO]]){ doGILMAN = 0} # don't use GILMAN if didn't capture peak
# go backwards till we get a background if necessary
while (GILMANBG$CO_DACOM_DISKIN_GILMAN[1] > 200 ){
indGILMANBACKGROUND = indGILMANBACKGROUND - 1
if (indGILMANBACKGROUND < 1){ # start from the end
indGILMANBACKGROUND = length(gilman.821.merge$CO_DACOM_DISKIN_GILMAN)
}
GILMANBG = gilman.821.merge[indGILMANBACKGROUND,]
}
} else{
doGILMAN = 0
# just dummy variables so things dont break
GILMAN = gilman.821.merge[1,]; GILMAN$CO_DACOM_DISKIN_GILMAN= NaN
GILMANBG = gilman.821.merge[1,]
}
# Apel
indAPEL = which(apel.821.merge$Time_Start >= (start-0) & apel.821.merge$Time_Start <= stop) # check at least 5 sec before?
if (length(indAPEL) > 0){
doAPEL = 1
indAPELBACKGROUND = indAPEL[1] - 1
APEL = apel.821.merge[indAPEL,]
APELBG = apel.821.merge[indAPELBACKGROUND,]
# go backwards till we get a background if necessary
while (APELBG$CO_DACOM_DISKIN_APEL[1] > 200 ){
indAPELBACKGROUND = indAPELBACKGROUND - 1
if (indAPELBACKGROUND < 1){ # start from the end
indAPELBACKGROUND = length(apel.821.merge$CO_DACOM_DISKIN_APEL)
}
APELBG = apel.821.merge[indAPELBACKGROUND,]
}
} else{
doAPEL = 0
# just dummy variables so things dont break
APEL = apel.821.merge[1,]; APEL$CO_DACOM_DISKIN_APEL = NaN
APELBG = apel.821.merge[1,]
}
# Becky
indBECKY = which(newTOGA.821$Time_Start >= (start-0) & newTOGA.821$Time_Start <= stop & newTOGA.821$Percent_plume > 0.5) # check at least 5 sec before?
if (length(indBECKY) > 0){
doBECKY = 1
indBECKYBACKGROUND = indBECKY[1] - 1
BECKY = newTOGA.821[indBECKY,]
BECKYBG = newTOGA.821[indBECKYBACKGROUND,]
# go backwards till we get a background if necessary
while (BECKYBG$CO_DACOM_DISKIN_BECKY[1] > 200 ){
indBECKYBACKGROUND = indBECKYBACKGROUND - 1
if (indBECKYBACKGROUND < 1){ # start from the end
indBECKYBACKGROUND = length(newTOGA.821$CO_DACOM_DISKIN_BECKY)
}
BECKYBG = newTOGA.821[indBECKYBACKGROUND,]
}
} else{
doBECKY = 0
# just dummy variables so things dont break
BECKY = newTOGA.821[1,]; BECKY$CO_DACOM_DISKIN_BECKY = NaN
BECKYBG = newTOGA.821[1,]
}
if (doplot == 1){
plotpass5hzJUSTCO(aug21st.fire[ind2,])
plotpass5hz(aug21st.fire[ind2,])
plotpass1hz(aug21st.fire[ind2,])
plotpass5hzJUSTCO(tmp[ind,])
plotpass5hzJUSTCN(tmp[ind,])
plotpass5hz(tmp[ind,])
# plot background?
plotpass5hzJUSTCO(aug21st.fire[ind2B,])
plotpass5hzJUSTCO(tmp[indB,])
}
allfires.5hz = rbind.fill(allfires.5hz, tmp[ind,]); BECKY$fire = fire;BECKY$fuel=fuel;BECKY$pass = i; GILMAN$fire = fire;GILMAN$fuel=fuel;GILMAN$pass = i;blake$fire = fire;blake$fuel=fuel;blake$pass = i ; BECKY$fire = fire;BECKY$fuel=fuel;BECKY$pass = i; GILMAN$fire = fire;GILMAN$fuel=fuel;GILMAN$pass = i;blake$fire = fire;blake$fuel=fuel;blake$pass = i
allfires.1hz = rbind.fill(allfires.1hz, aug21st.fire[ind2,]); if (doBECKY == 1){toga.all=rbind(toga.all,BECKY)}; if (doBlake == 1){was.all = rbind(was.all, blake)}; if (doGILMAN == 1){iwas.all = rbind(iwas.all, GILMAN)}
# ------------------ 1Hz is slash correct?
tmpEF1 = ERsEFsALLhzv2(aug21st.fire[ind2,],aug21st.fire[ind2B,],xspecies,fire, fuel,1,SLOW,blake, blakeBG,doBlake,GILMAN,GILMANBG,doGILMAN,BECKY, BECKYBG, doBECKY)
tmpEF1$age = median(aug21st.fire$transect_smoke_age[ind2], na.rm=TRUE); tmpEF1$transect_type = median(aug21st.fire$transect_type[ind2], na.rm=TRUE)
tmpEF1$transect_fuel_class = median(aug21st.fire$transect_fuel_class[ind2], na.rm=TRUE); tmpEF1$transect_dominant_fuel = median(aug21st.fire$transect_dominant_fuel[ind2], na.rm=TRUE); tmpEF1$transect_fuel_confidence = median(aug21st.fire$transect_fuel_confidence[ind2], na.rm=TRUE)
# ------------------ 5Hz
tmpEF5 = ERsEFsALLhzv2(tmp[ind,],tmp[indB,],xspecies,fire, fuel,5,SLOW,blake, blakeBG,doBlake,GILMAN,GILMANBG,doGILMAN,BECKY, BECKYBG, doBECKY)
tmpEF5$age = median(aug21st.fire$transect_smoke_age[ind2], na.rm=TRUE) ; tmpEF5$transect_type = median(aug21st.fire$transect_type[ind2], na.rm=TRUE)
tmpEF5$transect_fuel_class = median(aug21st.fire$transect_fuel_class[ind2], na.rm=TRUE); tmpEF5$transect_dominant_fuel = median(aug21st.fire$transect_dominant_fuel[ind2], na.rm=TRUE); tmpEF5$transect_fuel_confidence = median(aug21st.fire$transect_fuel_confidence[ind2], na.rm=TRUE)
tmpEF1$pass = i ; tmpEF1$StartO = startO; tmpEF1$Start = start; tmpEF1$StopO = stopO; tmpEF1$Stop = stop
tmpEF5$pass = i ; tmpEF5$StartO = startO; tmpEF5$Start = start; tmpEF5$StopO = stopO; tmpEF5$Stop = stop
#tmpEF5$fuelMDead = fuelMDead[as.numeric(flags$II[indA[i]]),as.numeric(flags$JJ[indA[i]])]
#tmpEF5$fuelMLive = fuelMLive[as.numeric(flags$II[indA[i]]),as.numeric(flags$JJ[indA[i]])]
if (i == 1){Loretta.1hz.EF = tmpEF1 ;Loretta.5hz.EF = tmpEF5 }
if (i > 1){Loretta.1hz.EF = rbind(Loretta.1hz.EF, tmpEF1) ; Loretta.5hz.EF = rbind(Loretta.5hz.EF, tmpEF5) }
}
Loretta.1hz.EF = Loretta.1hz.EF[order(Loretta.1hz.EF$variable),]
Loretta.1hz.EF$transect_source_fire_ID = indA[1]
Loretta.5hz.EF = Loretta.5hz.EF[order(Loretta.5hz.EF$variable),]
Loretta.5hz.EF$transect_source_fire_ID = indA[1]
# ========================== LIL DEBBIE =========================================
fire="Lil Debby"; fuel = "corn"
indA = which(flags$transec_source_fire_namestr == fire)
#plotfire(aug21st.fire, flags, indA,"LilDebbie", c(66E3, 729E2)) # i = 2 start =68994 stop= 69006
for (i in 1:length(indA)){ #
print(c(fire,i) )
startO = flags$`transect_start_time (UTC s from midnight)`[indA[i]] ; start = startO
stopO = flags$`transect_end_time (UTC s from midnight)`[indA[i]]; stop = stopO
if (i == 1){start = startO + 6; stop = stopO -12.8; startB = startO -1; stopB = startO+1}
if (i == 2){start = startO + 1; stop = stopO -0.2; startB = startO -2; stopB = startO}
if (i == 3){start = startO + 0; stop = stopO -66; startB = 68992; stopB = 68994} # split from above
if (i == 4){start = startO + 4; stop = stopO -8; startB = startO + 0; stopB = startO+2 }
if (i == 5){start = startO + 24; stop = stopO - 0; startB = startO -1; stopB = startO+1}
if (i == 6){start = startO + 0; stop = stopO - 0; startB = 71330; stopB = 71332} #split from above
if (i == 7){start = startO + 0; stop = stopO - 8.2; startB = 71330; stopB = 71332} # split from above
tmp = time_align(start,stop,co2.821.5hz, co.ch4.821.5hz,
warneke.821.5hz, isaf.821.5hz,
rollinsno.821.5hz, rollinsso2.821.5hz,
cit.821.5hz, gtcims.821.5hz,moore.821fast, jimenez.821.5hz,met.821.5hz)
ind = which(tmp$Time_Start >= start & tmp$Time_Start <= stop )
indB = which(tmp$Time_Start >= startB & tmp$Time_Start <= stopB )
# just for i=1 or7, need one more point for 1hz data
if (i == 1){start = start - 1; startB=startB-1;stopB=stopB-1}
if (i == 2){start = start - 1}
if (i == 3){stop = stop + 1}
if (i == 4){start = start - 1}
if (i == 7){start = start - 1; stop=stop+1}
aug21st.fire = time_alignSLOWNOCANS(start,stop, co2.821.1hz, co.ch4.821.1hz,
warneke.821.1hz, isaf.821.1hz,rollinsno.821.1hz, rollinsso2.821.1hz,
cit.821.1hz,gtcims.821.1hz,ryerson.821.1hz , jimenez.821.1hz,
schwarz.821.1hz, freid.c2h6.821.1hz, freid.ch2o.821.1hz,
womack.821.1hz, stclair.821.1hz,veres.821.1hz, #wisthaler.821.1hz,
moore.821, met.821.1hz)
ind2 = which(aug21st.fire$Time_Start >= start & aug21st.fire$Time_Start <= stop )
ind2B = which(aug21st.fire$Time_Start >= startB & aug21st.fire$Time_Start <= stopB )
if (doplot == 1){
plotpass5hzJUSTCO(aug21st.fire[ind2,])
plotpass5hz(aug21st.fire[ind2,])
plotpass1hz(aug21st.fire[ind2,])
plotpass1hzHNO2(aug21st.fire[ind2,])
plotpass5hzJUSTCOHNO2(aug21st.fire[ind2B,])
plotpass5hzJUSTCO(tmp[ind,])
plotpass5hzJUSTCN(tmp[ind,])
plotpass5hz(tmp[ind,])
plotpass1hzBLAKE(aug21st.fire[ind2,])
# plot background?
plotpass5hzJUSTCO(aug21st.fire[ind2B,])