-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofiles_NP.m
6671 lines (5620 loc) · 236 KB
/
profiles_NP.m
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
%% North Pacific
% 2005
clear
pack
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_QC_NP.mat
t1 = datenum(2005,01,01);
t2 = datenum(2006,01,01);
ind = find(time >= t1 & time <= t2);
temp = temp(:,ind); pres = pres(:,ind); psal = psal(:,ind);
latitude = latitude(ind); longitude = longitude(ind); time = time(ind);
fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(ind,:); pres_qc = pres_qc(ind,:); psal_qc = psal_qc(ind,:);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
temp_qc_adj = temp_qc_adj(ind,:); pres_qc_adj = pres_qc_adj(ind,:); psal_qc_adj = psal_qc_adj(ind,:);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_2005.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat
t1 = datenum(2005,01,01);
t2 = datenum(2006,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind); time_adj = time_adj(ind);
datamode = datamode(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_adj_2005.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_err_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat time_adj
t1 = datenum(2005,01,01);
t2 = datenum(2006,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind); time_adj = time_adj(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_err_2005.mat');
% 2006
clear
pack
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_QC_NP.mat
t1 = datenum(2006,01,01);
t2 = datenum(2007,01,01);
ind = find(time >= t1 & time <= t2);
temp = temp(:,ind); pres = pres(:,ind); psal = psal(:,ind);
latitude = latitude(ind); longitude = longitude(ind); time = time(ind);
fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(ind,:); pres_qc = pres_qc(ind,:); psal_qc = psal_qc(ind,:);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
temp_qc_adj = temp_qc_adj(ind,:); pres_qc_adj = pres_qc_adj(ind,:); psal_qc_adj = psal_qc_adj(ind,:);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_2006.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat
t1 = datenum(2006,01,01);
t2 = datenum(2007,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind); time_adj = time_adj(ind);
datamode = datamode(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_adj_2006.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_err_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat time_adj
t1 = datenum(2006,01,01);
t2 = datenum(2007,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind); time_adj = time_adj(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_err_2006.mat');
% 2007
clear
pack
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_QC_NP.mat
t1 = datenum(2007,01,01);
t2 = datenum(2008,01,01);
ind = find(time >= t1 & time <= t2);
temp = temp(:,ind); pres = pres(:,ind); psal = psal(:,ind);
latitude = latitude(ind); longitude = longitude(ind); time = time(ind);
fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(ind,:); pres_qc = pres_qc(ind,:); psal_qc = psal_qc(ind,:);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
temp_qc_adj = temp_qc_adj(ind,:); pres_qc_adj = pres_qc_adj(ind,:); psal_qc_adj = psal_qc_adj(ind,:);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_2007.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat
t1 = datenum(2007,01,01);
t2 = datenum(2008,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind); time_adj = time_adj(ind);
datamode = datamode(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_adj_2007.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_err_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat time_adj
t1 = datenum(2007,01,01);
t2 = datenum(2008,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind); time_adj = time_adj(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_err_2007.mat');
% 2008
clear
pack
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_QC_NP.mat
t1 = datenum(2008,01,01);
t2 = datenum(2009,01,01);
ind = find(time >= t1 & time <= t2);
temp = temp(:,ind); pres = pres(:,ind); psal = psal(:,ind);
latitude = latitude(ind); longitude = longitude(ind); time = time(ind);
fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(ind,:); pres_qc = pres_qc(ind,:); psal_qc = psal_qc(ind,:);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
temp_qc_adj = temp_qc_adj(ind,:); pres_qc_adj = pres_qc_adj(ind,:); psal_qc_adj = psal_qc_adj(ind,:);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_2008.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat
t1 = datenum(2008,01,01);
t2 = datenum(2009,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind); time_adj = time_adj(ind);
datamode = datamode(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_adj_2008.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_err_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat time_adj
t1 = datenum(2008,01,01);
t2 = datenum(2009,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind); time_adj = time_adj(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_err_2008.mat');
% 2009
clear
pack
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_QC_NP.mat
t1 = datenum(2009,01,01);
t2 = datenum(2010,01,01);
ind = find(time >= t1 & time <= t2);
temp = temp(:,ind); pres = pres(:,ind); psal = psal(:,ind);
latitude = latitude(ind); longitude = longitude(ind); time = time(ind);
fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(ind,:); pres_qc = pres_qc(ind,:); psal_qc = psal_qc(ind,:);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
temp_qc_adj = temp_qc_adj(ind,:); pres_qc_adj = pres_qc_adj(ind,:); psal_qc_adj = psal_qc_adj(ind,:);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_2009.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat
t1 = datenum(2009,01,01);
t2 = datenum(2010,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind); time_adj = time_adj(ind);
datamode = datamode(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_adj_2009.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_err_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat time_adj
t1 = datenum(2009,01,01);
t2 = datenum(2010,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind); time_adj = time_adj(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_err_2009.mat');
% 2010
clear
pack
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_QC_NP.mat
t1 = datenum(2010,01,01);
t2 = datenum(2011,01,01);
ind = find(time >= t1 & time <= t2);
temp = temp(:,ind); pres = pres(:,ind); psal = psal(:,ind);
latitude = latitude(ind); longitude = longitude(ind); time = time(ind);
fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(ind,:); pres_qc = pres_qc(ind,:); psal_qc = psal_qc(ind,:);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
temp_qc_adj = temp_qc_adj(ind,:); pres_qc_adj = pres_qc_adj(ind,:); psal_qc_adj = psal_qc_adj(ind,:);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_2010.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat
t1 = datenum(2010,01,01);
t2 = datenum(2011,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind); time_adj = time_adj(ind);
datamode = datamode(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_adj_2010.mat');
clear; pack;
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_err_NP.mat
load /home/alison/Matlab/Mat' files'/Global' Mapping 2'/North' Pacific'/profiles_adj_NP.mat time_adj
t1 = datenum(2010,01,01);
t2 = datenum(2011,01,01);
ind = find(time_adj >= t1 & time_adj <= t2);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind); time_adj = time_adj(ind);
clear t1 t2 dir_name ind float_num
save('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/prof_err_2010.mat');
%% quality control
% 2005
clear; pack
load /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/prof_2005.mat;
load /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/prof_adj_2005.mat;
load /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/prof_err_2005.mat;
pres_qc = pres_qc';
psal_qc = psal_qc';
temp_qc = temp_qc';
pres_qc_adj = pres_qc_adj';
psal_qc_adj = psal_qc_adj';
temp_qc_adj = temp_qc_adj';
longitude(longitude < 0) = longitude(longitude < 0) + 360;
% plot locations of data
figure(1); clf
axesm('mercator','MapLatLimit',[-5 80],'MapLonLimit',[100 280])
plotm(latitude,longitude,'.');
geoshow('landareas.shp','FaceColor',[.9 .9 .9])
setm(gca, 'grid','on','meridianlabel','on','parallellabel','on','plinelocation',5,'mlinelocation',5,'plabellocation',5,'mlabellocation',5)
axis tight
figure(2); clf
plot(longitude,latitude,'.'); grid on;
% lat/lon range
ind = find(longitude <= 290 & longitude >= 100 & latitude <= 80 & latitude >= 0);
temp = temp(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres = pres(:,ind);
psal = psal(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(:,ind); pres_qc = pres_qc(:,ind); psal_qc = psal_qc(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
datamode = datamode(ind); time_adj = time_adj(ind);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
% remove gulf of mexico & atlantic profiles
ind = find(~(longitude >= 270 & latitude >= 16));
temp = temp(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres = pres(:,ind);
psal = psal(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(:,ind); pres_qc = pres_qc(:,ind); psal_qc = psal_qc(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
datamode = datamode(ind); time_adj = time_adj(ind);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
% remove sea of japan profiles
ind = find(~((longitude < 138 & latitude < 44 & latitude > 34.5) | (longitude < 141 & latitude < 44 & latitude > 37)));
temp = temp(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres = pres(:,ind);
psal = psal(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(:,ind); pres_qc = pres_qc(:,ind); psal_qc = psal_qc(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
datamode = datamode(ind); time_adj = time_adj(ind);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
% plot locations of data
figure(1); clf
axesm('mercator','MapLatLimit',[-5 80],'MapLonLimit',[-100 50])
plotm(latitude,longitude,'.');
geoshow('landareas.shp','FaceColor',[.9 .9 .9])
setm(gca, 'grid','on','meridianlabel','on','parallellabel','on','plinelocation',10,'mlinelocation',10,'plabellocation',10,'mlabellocation',10)
axis tight
% look at maximum pressures
maxp = (max(abs(pres),[],1))';
% find & remove profiles with maxp < 800 db
indp = find(maxp < 800);
per800 = 100*length(indp)/length(maxp) %#ok<*NOPTS,*NASGU>
num_800 = [fnum(indp) time(indp)];
ind = find(maxp >= 800);
temp = temp(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres = pres(:,ind);
psal = psal(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(:,ind); pres_qc = pres_qc(:,ind); psal_qc = psal_qc(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
datamode = datamode(ind); time_adj = time_adj(ind);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
clear ans ind indp per800 t2
save /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/bad_floats.mat num_800
clear num_800 maxp
% delete all Nan profiles
clear ind; k = 1;
for i = 1:length(fnum)
t = temp(:,i); s = psal(:,i); p = pres(:,i);
ss = sum(~isnan(s)); tt = sum(~isnan(t)); pp = sum(~isnan(p));
if ~(tt == 0 || ss == 0 || pp == 0)
ind(k) = i; k = k+1; %#ok<NAGROW>
end
end
clear t s p ss tt pp k i
ind = ind';
temp = temp(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres = pres(:,ind);
psal = psal(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc = temp_qc(:,ind); pres_qc = pres_qc(:,ind); psal_qc = psal_qc(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
datamode = datamode(ind); time_adj = time_adj(ind);
temp_adj = temp_adj(:,ind); pres_adj = pres_adj(:,ind); psal_adj = psal_adj(:,ind);
temp_err = temp_err(:,ind); pres_err = pres_err(:,ind); psal_err = psal_err(:,ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
indt = find(sum(~isnan(temp),2) == 0); %#ok<MXFND>
indp = find(sum(~isnan(pres),2) == 0); %#ok<MXFND>
inds = find(sum(~isnan(psal),2) == 0); %#ok<MXFND>
ind = max([min(indt) min(indp) min(inds)]);
temp = temp(1:ind,:); psal = psal(1:ind,:); pres = pres(1:ind,:);
temp_qc = temp_qc(1:ind,:); pres_qc = pres_qc(1:ind,:); psal_qc = psal_qc(1:ind,:);
temp_adj = temp_adj(1:ind,:); psal_adj = psal_adj(1:ind,:); pres_adj = pres_adj(1:ind,:);
temp_qc_adj = temp_qc_adj(1:ind,:); pres_qc_adj = pres_qc_adj(1:ind,:); psal_qc_adj = psal_qc_adj(1:ind,:);
temp_err = temp_err(1:ind,:); psal_err = psal_err(1:ind,:); pres_err = pres_err(1:ind,:);
clear indt indp inds ind
save /home/alison/Matlab/M'at files'/Global' Mapping 2'/North' Pacific'/tmp.mat
% graylist floats
cd('/home/alison/Matlab/M files/Global Mapping 2/');
[grayfloat,~,start_date,end_date,errtype] = graylist('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/');
%% %%%% quality control flags %%%%
% examine flags on temperature data
[mm,nn] = size(temp);
tqc = NaN(size(temp));
for j = 1:nn
for i = 1:mm
if ~isnan(temp(i,j))
if (strcmp(temp_qc_adj(i,j),'1') || strcmp(temp_qc_adj(i,j),'0') || strcmp(temp_qc_adj(i,j),'2') || strcmp(temp_qc_adj(i,j),' ') || double(temp_qc_adj(i,j))==0)
tqc(i,j) = 1;
else
tqc(i,j) = 0;
end
end
end
end
% examine flags on salinity data
[mm,nn] = size(psal);
sqc = NaN(size(psal));
for j = 1:nn
for i = 1:mm
if ~isnan(psal(i,j))
if (strcmp(psal_qc_adj(i,j),'1') || strcmp(psal_qc_adj(i,j),'0') || strcmp(psal_qc_adj(i,j),'2') || strcmp(psal_qc_adj(i,j),' ') || double(psal_qc_adj(i,j))==0)
sqc(i,j) = 1;
else
sqc(i,j) = 0;
end
end
end
end
% examine flags on pressure data
[mm,nn] = size(pres);
pqc = NaN(size(pres));
for j = 1:nn
for i = 1:mm
if ~isnan(pres(i,j))
if (strcmp(pres_qc_adj(i,j),'1') || strcmp(pres_qc_adj(i,j),'0') || strcmp(pres_qc_adj(i,j),'2') || strcmp(pres_qc_adj(i,j),' ') || double(pres_qc_adj(i,j))==0)
pqc(i,j) = 1;
else
pqc(i,j) = 0;
end
end
end
end
clear mm nn i j
% display number of profiles with one or more bad qc flag
num_bad_temp = length(find(sum(tqc == 0,1) > 0))
num_bad_pres = length(find(sum(pqc == 0,1) > 0))
num_bad_psal = length(find(sum(sqc == 0,1) > 0))
clear num_bad_*
% make 2nd variable set with data with qc ~= 0,1,2,' ' set to NaN
temp2 = temp_adj; temp2(tqc == 0) = NaN;
psal2 = psal_adj; psal2(sqc == 0) = NaN;
pres2 = pres_adj; pres2(pqc == 0) = NaN;
% need t, s, and p at every point - make NaN's consistent across all data
ind = find(isnan(pres2));
temp2(ind) = NaN;
psal2(ind) = NaN;
ind = find(isnan(psal2));
temp2(ind) = NaN;
pres2(ind) = NaN;
ind = find(isnan(temp2));
pres2(ind) = NaN;
psal2(ind) = NaN;
% delete profiles that are all NaNs
clear ind indb; k = 1; l = 1;
for i = 1:length(fnum)
t = temp2(:,i); s = psal2(:,i); p = pres2(:,i);
ss = sum(~isnan(s)); tt = sum(~isnan(t)); pp = sum(~isnan(p));
if ~(tt == 0 || ss == 0 || pp == 0)
ind(k) = i; k = k+1; %#ok<SAGROW>
else
indb(l) = i; l = l+1; %#ok<SAGROW>
end
end
clear t s p ss tt pp k i l
ind = ind'; indb = indb';
num_badQC = [fnum(indb) time(indb)];
save /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/bad_floats.mat num_badQC -APPEND
clear indb num_badQC
temp2 = temp2(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres2 = pres2(:,ind);
psal2 = psal2(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
pqc = pqc(:,ind); pres = pres(:,ind); psal = psal(:,ind); sqc = sqc(:,ind); temp = temp(:,ind); tqc = tqc(:,ind);
pres_adj = pres_adj(:,ind); pres_err = pres_err(:,ind); pres_qc = pres_qc(:,ind);
psal_adj = psal_adj(:,ind); psal_err = psal_err(:,ind); psal_qc = psal_qc(:,ind);
temp_adj = temp_adj(:,ind); temp_err = temp_err(:,ind); temp_qc = temp_qc(:,ind);
datamode = datamode(ind); time_adj = time_adj(ind);
clear ind
% find & remove profiles with maxp < 800 db
maxp = (max(abs(pres2),[],1))';
indp = find(maxp < 800);
per800 = 100*length(indp)/length(maxp) %#ok<*NOPTS,*NASGU>
num_800_2 = [fnum(indp) time(indp)];
ind = find(maxp >= 800);
temp2 = temp2(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres2 = pres2(:,ind);
psal2 = psal2(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
pqc = pqc(:,ind); pres = pres(:,ind); psal = psal(:,ind); sqc = sqc(:,ind); temp = temp(:,ind); tqc = tqc(:,ind);
pres_adj = pres_adj(:,ind); pres_err = pres_err(:,ind); pres_qc = pres_qc(:,ind);
psal_adj = psal_adj(:,ind); psal_err = psal_err(:,ind); psal_qc = psal_qc(:,ind);
temp_adj = temp_adj(:,ind); temp_err = temp_err(:,ind); temp_qc = temp_qc(:,ind);
datamode = datamode(ind); time_adj = time_adj(ind);
clear ind
clear ans ind indp per800 t2
save /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/bad_floats.mat num_800_2
clear num_800_2 maxp
% % compute percentage of good values in each profile
% [~,nn] = size(pres2);
% percentNaN = NaN(nn,3);
% for i = 1:nn
% p = pqc(:,i); t = tqc(:,i); s = sqc(:,i);
% np = sum(p == 0); nt = sum(t == 0); ns = sum(s == 0);
% npp = sum(~isnan(p)); ntt = sum(~isnan(t)); nss = sum(~isnan(s));
% percentNaN(i,:) = 100*[np./npp nt/ntt ns/nss];
% end
% clear i p np lastp mm nn npp t nt ntt s ns nss
%
% ind = find(percentNaN(:,1) > 25 | percentNaN(:,2) > 25 | percentNaN(:,3) > 25);
% for ii = 1:length(ind)
% fnum(ind(ii))
% figure(1); clf
% plot(temp(:,ind(ii)),-pres(:,ind(ii)),'m.-'); hold on;
% plot(temp2(:,ind(ii)),-pres2(:,ind(ii)),'r.-');
% disp(temp_qc(:,ind(ii))');
% disp(pres_qc(:,ind(ii))');
% disp(psal_qc(:,ind(ii))');
% figure(2); clf
% plot(psal(:,ind(ii)),-pres(:,ind(ii)),'c.-'); hold on;
% plot(psal2(:,ind(ii)),-pres2(:,ind(ii)),'b.-');
% pause
% end
% clear ii ans
%
% num_percentNaN = [fnum(ind) time(ind)];
% save /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/bad_floats.mat num_percentNaN -APPEND
% clear num_percentNaN
%
% temp2(:,ind) = NaN; pres2(:,ind) = NaN; psal2(:,ind) = NaN;
% find & delete short profiles
n = sum(~isnan(temp2),1)';
% for i = 1:10
% disp(i); ind = find(n == i); length(ind)
% figure(1); clf
% plot(temp2(:,ind),-pres2(:,ind),'.-');
% pause
% end
ind = find(n <= 10 & n > 0); length(ind)
num_shortprof = [fnum(ind) time(ind)];
save /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/bad_floats.mat num_shortprof -APPEND
clear num_shortprof
temp2(:,ind) = NaN; pres2(:,ind) = NaN; psal2(:,ind) = NaN;
clear n i ind ans
% delete profiles that are all NaNs
clear ind indb; k = 1; l = 1;
for i = 1:length(fnum)
t = temp2(:,i); s = psal2(:,i); p = pres2(:,i);
ss = sum(~isnan(s)); tt = sum(~isnan(t)); pp = sum(~isnan(p));
if ~(tt == 0 || ss == 0 || pp == 0)
ind(k) = i; k = k+1; %#ok<SAGROW>
else
indb(l) = i; l = l+1; %#ok<SAGROW>
end
end
clear t s p ss tt pp k i l
ind = ind'; indb = indb';
temp2 = temp2(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres2 = pres2(:,ind);
psal2 = psal2(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
pqc = pqc(:,ind); pres = pres(:,ind); psal = psal(:,ind); sqc = sqc(:,ind); temp = temp(:,ind); tqc = tqc(:,ind);
pres_adj = pres_adj(:,ind); pres_err = pres_err(:,ind); pres_qc = pres_qc(:,ind);
psal_adj = psal_adj(:,ind); psal_err = psal_err(:,ind); psal_qc = psal_qc(:,ind);
temp_adj = temp_adj(:,ind); temp_err = temp_err(:,ind); temp_qc = temp_qc(:,ind);
datamode = datamode(ind); time_adj = time_adj(ind);
clear ind indb
save /home/alison/Matlab/M'at files'/Global' Mapping 2'/North' Pacific'/tmp.mat
%% remove greylist floats
k = 1;
badfloats = 0; type_err = cell(1,1); bad_start = 0; bad_end = 0;
for i = 1:length(grayfloat)
if sum(grayfloat(i) == fnum) > 0
if grayfloat(i) ~= badfloats
badfloats(k,1) = grayfloat(i); %#ok<SAGROW>
type_err(k,1) = errtype(i);
bad_start(k,1) = start_date(i); %#ok<SAGROW>
bad_end(k,1) = end_date(i); %#ok<SAGROW>
k = k+1;
end
end
end
clear k i
% ind = find(~strcmp(type_err,'potential problem with bin assignment'));
% badfloats = badfloats(ind);
% type_err = type_err(ind);
% bad_start = bad_start(ind);
% bad_end = bad_end(ind);
badstart = cellstr(num2str(bad_start));
badend = cellstr(num2str(bad_end));
for i = 1:length(badstart)
bs = char(badstart(i));
bs = datenum([sscanf(bs(1:4),'%f'),sscanf(bs(5:6),'%f'),sscanf(bs(7:8),'%f')]);
bad_st(i,1) = bs; %#ok<SAGROW>
be = char(badend(i));
if ~strcmp(be,' NaN') && ~strcmp(be,'NaN')
be = datenum([sscanf(be(1:4),'%f'),sscanf(be(5:6),'%f'),sscanf(be(7:8),'%f')]);
bad_end(i) = be;
else
bad_end(i) = NaN;
end
end
fnumb = []; timeb = [];
for j = 1:length(badfloats)
if isnan(bad_end(j))
ind = find(~((fnum == badfloats(j))&(time > bad_st(j))));
indb = find((fnum == badfloats(j)) & (time > bad_st(j)));
else
ind = find(~(fnum == badfloats(j) & time > bad_st(j) & time < bad_end(j)));
indb = find(fnum == badfloats(j) & time > bad_st(j) & time < bad_end(j));
end
fnumb = [fnumb; fnum(indb)]; %#ok<AGROW>
timeb = [timeb; time(indb)]; %#ok<AGROW>
temp2 = temp2(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres2 = pres2(:,ind);
psal2 = psal2(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
pqc = pqc(:,ind); pres = pres(:,ind); psal = psal(:,ind); sqc = sqc(:,ind); temp = temp(:,ind); tqc = tqc(:,ind);
pres_adj = pres_adj(:,ind); pres_err = pres_err(:,ind); pres_qc = pres_qc(:,ind);
psal_adj = psal_adj(:,ind); psal_err = psal_err(:,ind); psal_qc = psal_qc(:,ind);
temp_adj = temp_adj(:,ind); temp_err = temp_err(:,ind); temp_qc = temp_qc(:,ind);
datamode = datamode(ind); time_adj = time_adj(ind);
end
num_gray = [fnumb timeb];
save /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/bad_floats.mat num_gray -APPEND
clear num_gray fnumb timeb indb ind
clear bad* end_date j ind param start_date be bs i
clear ans errtype grayfloat ii percentNaN type_err
% graylist floats
cd('/home/alison/Matlab/M files/Global Mapping 2/');
[grayfloat,param,start_date,end_date,errtype] = graylist('/home/alison/Matlab/Mat files/Global Mapping 2/North Pacific/');
save /home/alison/Matlab/M'at files'/Global' Mapping 2'/North' Pacific'/tmp.mat
%% look for out-of-range pressures
figure(1); clf; imagesc(pres); colorbar;
figure(2); clf; imagesc(pres2); colorbar
outofrangenum = [];
ind = find(pres > 2200); length(ind)
[i,j] = find(pres2 > 2200); length(i)
tempnum = fnum(j);
presnum = 0; k = 1;
for ii = 1:length(tempnum)
if tempnum(ii) ~= presnum
presnum(k,1) = tempnum(ii); %#ok<SAGROW>
k = k+1;
end
end
outofrangenum = [outofrangenum; presnum];
% for ii = 1:length(i)
% figure(1); clf
% plot(temp2(i(ii),:),-pres2(i(ii),:),'r.-'); hold on
% plot(psal2(i(ii),:),-pres2(i(ii),:),'b.-');
% pres2(i(ii),1:30)
% pause
% end
ind = find(pres < 0); length(ind)
[~,j] = find(pres2 < 0); length(j)
tempnum = fnum(j);
presnum = 0; k = 1;
for ii = 1:length(tempnum)
if tempnum(ii) ~= presnum
presnum(k,1) = tempnum(ii); %#ok<SAGROW>
k = k+1;
end
end
outofrangenum = [outofrangenum; presnum];
% for ii = 1:length(i)
% figure(1); clf
% plot(temp(i(ii),:),-pres(i(ii),:),'r.-'); hold on
% plot(psal(i(ii),:),-pres(i(ii),:),'b.-');
% pres2(i(ii),1:30)
% pause
% end
% look for out-of-range temperatures
figure(1); clf; imagesc(temp); colorbar;
figure(2); clf; imagesc(temp2); colorbar
ind = find(temp > 40); length(ind)
[~,j] = find(temp2 > 40); length(j)
tempnum = fnum(j);
tmpnum = 0; k = 1;
for ii = 1:length(tempnum)
if tempnum(ii) ~= tmpnum
tmpnum(k,1) = tempnum(ii); %#ok<SAGROW>
k = k+1;
end
end
outofrangenum = [outofrangenum; tmpnum];
% for ii = 1:length(i)
% figure(1); clf
% plot(temp2(i(ii),:),-pres2(i(ii),:),'r.-'); hold on
% plot(psal2(i(ii),:),-pres2(i(ii),:),'b.-');
% temp2(i(ii),1:30)
% pause
% end
ind = find(temp <= -3); length(ind)
[~,j] = find(temp2 <= -3); length(j)
tempnum = fnum(j);
tmpnum = 0; k = 1;
for ii = 1:length(tempnum)
if tempnum(ii) ~= tmpnum
tmpnum(k,1) = tempnum(ii); %#ok<SAGROW>
k = k+1;
end
end
outofrangenum = [outofrangenum; tmpnum];
% for ii = 1:length(i)
% figure(1); clf
% plot(temp2(i(ii),:),-pres2(i(ii),:),'r.-'); hold on
% plot(psal2(i(ii),:),-pres2(i(ii),:),'b.-');
% temp2(i(ii),1:30)
% pause
% end
% look for out-of-range salinities
figure(1); clf; imagesc(psal); colorbar;
figure(2); clf; imagesc(psal2); colorbar
ind = find(psal > 39); length(ind)
[~,j] = find(psal2 > 39); length(j)
tempnum = fnum(j);
psalnum = 0; k = 1;
for ii = 1:length(tempnum)
if tempnum(ii) ~= psalnum
psalnum(k,1) = tempnum(ii); %#ok<SAGROW>
k = k+1;
end
end
outofrangenum = [outofrangenum; psalnum];
% for ii = 1:length(i)
% figure(1); clf
% % plot(temp2(i(ii),:),-pres2(i(ii),:),'r.-'); hold on
% plot(psal2(:,j(ii)),-pres2(:,j(ii)),'b.-'); grid on
% % psal2(i(ii),1:30)
% pause
% end
ind = find(psal <= 20); length(ind)
[~,j] = find(psal2 <= 20); length(j)
tempnum = fnum(j);
psalnum = 0; k = 1;
for ii = 1:length(tempnum)
if tempnum(ii) ~= psalnum
psalnum(k,1) = tempnum(ii); %#ok<SAGROW>
k = k+1;
end
end
outofrangenum = [outofrangenum; psalnum];
% for ii = 1:length(i)
% figure(1); clf
% % plot(temp2(i(ii),:),-pres2(i(ii),:),'r.-'); hold on
% plot(psal2(:,j(ii)),-pres2(:,j(ii)),'b.-'); grid on
% % psal2(i(ii),1:30)
% pause
% end
badnum = sort(outofrangenum);
clear psalnum tmpnum tempnum presnum i ii ind j k outofrangenum NaNnum ans
badnum = badnum(6:end)
fnumb = []; timeb = [];
badnum(i)
ind = find(fnum == badnum(i));
figure(1); clf; plot(temp2(:,ind),-pres2(:,ind),'.-'); grid on;
figure(2); clf; plot(psal2(:,ind),-pres2(:,ind),'.-'); grid on;
tmpt = temp2(:,ind); tmps = psal2(:,ind); tmpp = pres2(:,ind); tmpj = datestr(time(ind));
if sum(badnum(i) == grayfloat) > 0
disp('greylisted');
ii = find(badnum(i) == grayfloat);
disp(param(ii)); disp(errtype(ii)); disp(start_date(ii)); disp(end_date(ii));
end
i = 1;
% set bad values to Nan
temp2(3,ind(8)) = NaN;
psal2(isnan(temp2)) = NaN;
fnumb = [fnumb; fnum(ind(8))];
timeb = [timeb; time(ind(8))];
num_lowS = [fnumb timeb];
save /home/alison/Matlab/Ma't files'/Global' Mapping 2'/North' Pacific'/bad_floats.mat num_lowS -APPEND
clear num_lowS fnumb timeb indb ind ans i ii tmpj tmpp tmps tmpt
% for ii = 1:length(ind)
% ii
% figure(1); clf; plot(psal2(ind,:)',-pres2(ind,:)','-','color',[.9 .9 .9]);
% hold on; plot(psal2(ind(ii),:)',-pres2(ind(ii),:)','r.-'); grid on;
% figure(2); clf;
% axesm('mercator','MapLatLimit',[min(latitude(ind))-5 max(latitude(ind))+5],'MapLonLimit',[min(longitude(ind))-5 max(longitude(ind))+5])
% plotm(latitude(ind),longitude(ind),'.-'); hold on;
% plotm(latitude(ind(ii)),longitude(ind(ii)),'r.');
% geoshow('landareas.shp','FaceColor',[.9 .9 .9])
% setm(gca, 'grid','on','meridianlabel','on','parallellabel','on','plinelocation',10,'mlinelocation',10,'plabellocation',10,'mlabellocation',10)
% axis tight;
% figure(3); clf; plot(temp2(ind,:)',-pres2(ind,:)','-','color',[.9 .9 .9]);
% hold on; plot(temp2(ind(ii),:)',-pres2(ind(ii),:)','r.-'); grid on;
% pause
% end
% delete profiles that are all NaNs
clear ind indb; k = 1; l = 1;
for i = 1:length(fnum)
t = temp2(:,i); s = psal2(:,i); p = pres2(:,i);
ss = sum(~isnan(s)); tt = sum(~isnan(t)); pp = sum(~isnan(p));
if ~(tt == 0 || ss == 0 || pp == 0)
ind(k) = i; k = k+1; %#ok<SAGROW>
else
indb(l) = i; l = l+1; %#ok<SAGROW>
end
end
clear t s p ss tt pp k i l
ind = ind'; indb = indb';
temp2 = temp2(:,ind); latitude = latitude(ind); longitude = longitude(ind); time = time(ind); pres2 = pres2(:,ind);
psal2 = psal2(:,ind); fnum = fnum(ind); type = type(ind);
temp_qc_adj = temp_qc_adj(:,ind); pres_qc_adj = pres_qc_adj(:,ind); psal_qc_adj = psal_qc_adj(:,ind);
position_qc = position_qc(ind); juld_qc = juld_qc(ind); prof_temp_qc = prof_temp_qc(ind);
prof_psal_qc = prof_psal_qc(ind); prof_pres_qc = prof_pres_qc(ind);
pqc = pqc(:,ind); pres = pres(:,ind); psal = psal(:,ind); sqc = sqc(:,ind); temp = temp(:,ind); tqc = tqc(:,ind);
pres_adj = pres_adj(:,ind); pres_err = pres_err(:,ind); pres_qc = pres_qc(:,ind);
psal_adj = psal_adj(:,ind); psal_err = psal_err(:,ind); psal_qc = psal_qc(:,ind);
temp_adj = temp_adj(:,ind); temp_err = temp_err(:,ind); temp_qc = temp_qc(:,ind);
datamode = datamode(ind); time_adj = time_adj(ind);
clear ind indb
%% find profiles with repeat pressures
clear ind1; k = 1;
for i = 1:length(fnum)
p = pres2(:,i);
for j = 1:length(p)
if ~isnan(p(j))
if sum(p == p(j)) > 1
ind1(k) = i; %#ok<SAGROW>
k = k+1;
end
end
end
end
clear p i j k
ind1 = ind1';
% individual float numbers of profiles with repeat pressures
k = 1; ind = 0;
for i = 1:length(ind1)
if fnum(ind1(i)) ~= ind
ind(k) = fnum(ind1(i)); %#ok<SAGROW>
k = k+1;
end
end
ind = ind'; clear i k
length(ind)
for i = 1:length(ind)
ii = find(fnum == ind(i));
plot(temp2(:,ii),-pres2(:,ii),'.-');
ind(i)
pres2(1:2,ii)
pause
end
clear ii i
i = 1;
temp2(71:72,ii(29)) = NaN;
temp2(69,ii(32)) = NaN;
psal2(isnan(temp2)) = NaN;
i = 2;
temp2(14,ii(10)) = NaN;
psal2(isnan(temp2)) = NaN;
i = 3;
temp2(31,ii(18)) = NaN;
psal2(isnan(temp2)) = NaN;
i = 4;
i = 5;
i = i+1
ind(i)
ii = find(fnum == ind(i));
figure(1); clf; plot(temp2(:,ii),-pres2(:,ii),'.-'); grid on;
figure(2); clf; plot(psal2(:,ii),-pres2(:,ii),'.-'); grid on;
tmpt = temp2(:,ii); tmps = psal2(:,ii); tmpp = pres2(:,ii); tmpj = datestr(time(ii));
if sum(ind(i) == grayfloat) > 0
disp('greylisted');
jj = find(ind(i) == grayfloat);
disp(param(jj)); disp(errtype(jj)); disp(start_date(jj)); disp(end_date(jj));
end
clear ind2 ind3;
k = 1;
for iii = 1:length(ii)
p = pres2(:,ii(iii));
for j = 1:length(p)
if ~isnan(p(j))
if sum(p == p(j)) > 1