processing bs3 2012->2013 CMP using Paula's code ================================================ started onboard Healy, 2013/10/18 ran UnPacker-2.01.26.exe. It kept crashing after C file 707. Tried different computers, firmware versions etc ... no luck Used Unpacker 3, firmware version 4.17. That worked, but only unpacked every other CTD file, while all Eng files and all SUNA files were unpacked. Its very unclear why the CTD files were not all unpacked, given that the engineering data indicate that CTD pressure was collected. Ran that on c:\projects\aon13\cmp_bs3_2012to2013 to create cmp_bs3_2012to13_unpackv3; mv that to healy10_ta\cmp_process\bs3_2012to13 copy mkdirs.src from bs3_2011to2012, run it in cygwin. - cp proc_paula from bs3_2011to12 to bs3_2012to13 - profiles range from 000 to 1467. However, last good profile is in 1456. Note: only every other C file has data. - edit cmp_asc2mat_fb2.m to allow for reading of different RBR C*.TXT files. Used to have just three data columns; now has 7, and leading/trailing text. Save as cmp_asc2mat_fb4.m Then set input files and range (by profile number), stas = [0:2:1456]; % [0:10]; % [0:1027]; % from UnPacker dialog direc = 'c:\projects\healy10_ta\cmp_process\bs3_2012to13\cmp_bs3_2012to13_unpackv3'; % input dir outdir = 'c:\projects\healy10_ta\cmp_process\bs3_2012to13\raw'; % input dir then run cmp_asc2mat_fb4.m make initial plots with proc_ini programs ------------------2013/10/19: done up to here ---------------------------- ------------------ interlude -------------------------------------------- 2013/11/07 in prep for SUNA decoding: add a time variable "dday_prf" that previously was only available in my proc_ini decoding of unpacked data: re-run the CTD raw file generation. But: shift file (profile) numbers while I am at it: increase CTD output file number by 1. Reasons came about when looking at SUNA data, which needs to have CTD and ENG merged in: compare times: C0001000.TXT: ascend 13/06/24 11:58:15 to 13/06/24 12:17:28 Profile 1000 RBR turned on at 06/24/2013 11:58:38 RBR turned off at 06/24/2013 12:17:32 E0001000.TXT: descent 06/24/2013 06:00:38 to 06:03:38 E0001001.TXT: ascend Profile 1001 Sensors were turned on at 06/24/2013 11:58:38 Vehicle began profiling at 06/24/2013 12:00:04 S0001000.TXT: Profile 1000 SUNA turned on at 06/24/2013 05:58:38 SUNA turned off at 06/24/2013 00:17:59 from SNSRTIME.TXT: Profile 1000 RBR turned on at 06/24/2013 11:58:38 Profile 1000 RBR turned off at 06/24/2013 12:17:32 Profile 1000 SUNA turned on at 06/24/2013 05:58:38 Profile 1000 SUNA turned off at 06/24/2013 00:17:59 from TIMETAGS.TXT: 1000 06/24/2013 05:58:38 06/24/2013 06:00:09 06/24/2013 06:03:49 06/24/2013 06:06:03 0 [SMOOTH RUNNING] 14 [BOTTOM PRESSURE] ===>!! further: looking at raw/raw1000.mat: has mismatch of CTD and engineering data, e.g., pressure. Also time, once I include CTD time! Conclusion: =========== modify file number of C files by 1: C0001000.TXT -> C0001001.TXT etc. reasoning: E files and TIMETAGS.TXT set profile 1000 as descent at 06:00 (stop at bottom). SUNA 1000 is at 06:00. RBR (C file) has 1000 as ascent, and 6 hours later. So the renumbered C files would match E and S files. ============================================================================== so: re-run cmp_asc2mat_fb5.m (version 5 because of the addition of dday_prf and dt), and change number in output file name by 1: C0001000.TXT will be raw1001.mat It will ingest E0001001.TXT, not E0001000.TXT as before. mv previous version to c_filnoerr. make version cmp_asc2mat_fb5_filenoerr.m to handle this - hopefully - single case. also modify: apply adj_atm_pres to engineering pressure as well, which after all comes from the same RBR CTD. ------------------ end interlude -------------------------------------------- ------------------2013/11/07: done up to here ---------------------------- In March 2014, I did another intermediate procesing job including an initial cal check by comparing the bottom bins to the nearby microcat. The comparison was done graphically, rather than with Paula's programs. Below are my notes from that processing job: % BS3 2012->13 CMP initial processing for Bob, 2014/03/13 unpacked data with unpacker version 3; earlier one (2.02.26) did not work. in projects/aon13/cmp_proc_ini, used r_cmpdata2.m and r_upackcmp2.m to convert unpacked .txt into matlab profiles. Added special parts: - in r_cmpdata2.m: towards the end, select every other profile, as specified in vector "files", to wipe out the NaN profiles caused by the firmware bug of this CMP, which allowed us to only unpack every other profile. - in r_upackcmp2: added code to subtract atmospheric pressure from RBR CTD: its the only CTD I know of that does not automatically do that. In order to get an initial look to Bob, do not go through the complete processing, but instead do a quick cal check of C versus the deep microcat. ------------------------------- interlude: get mc record. quite far, in c:\projects\healy10_ta\mc_process\bs3_201213_mcd copy there file bs3_lr75_2134_2012to13.asc; edit, then run r_mc.m normally: edit, then run corr_mc.m here, however, I only take snippets from corr_mc.m to get a structure mc with fields C, S, T, P, dates, dday MC pressure: 127.75; 127.5 to 128 dbar. last p-bin at bin 90, 124.5; P(90,:) time series = 124.7 with seasonal cycle +_ 0.15 dbar first p-in at bin 5; 39.5; P(5,:) time series 39.85 +- 0.125 dbar save as bs3_lr75_2134_2012to13_tmp.mat copy to c:\projects\aon13\cmp_proc_ini -------------------------------- plot mc cond time series, and cmp cond time series for bins 80:95. Bin 80 is a solid one, while bin 95 is never reached. Visually: early, with little stratification at dday 358, mc is 2.659 - 2.657 S/m = 0.002 more (for dT=0, mc sal > by 0.026 psu) late, with little cond stratification at dday 643: mc is 2.622 - 2.617 S/m = 0.005 S/m more (for dT=0, mc sal > by 0.066 psu) Temperature was not recognizeably different; much better than 0.01, perhaps to within 0.001 If the MC did not drift, it would follow that the CMP got about 0.04 fresher. I compared several recent years, and the MCs usually drifted towards saltier (meaning: correction reduced salinity at the record end). However, the magnitude was less: 2011->12 0.01 PSU as one of the highest. => middle: increase CMP salinity from by 0 (start) to 0.03 (end). Do so via adjusting conductivity. Should make a multiplicative correction, rather than addition. conclusion: With C around 2.7 S/m, multiply CMP_C by 1 (start) to 1.008 (end) revision: we DO have the MC cal. 2134 did drift, but only for C>3.5S/m. In our range, two cal points showed that the mc did NOT drift. => adjust CMP conductivity by from 0 (start) to 0.003 S/m (end): multiply by 1.0011. Rcalculated salinity. make those adjustments in adj_cmpcal_tmp.m make structure MP with MP = time: [733x1 double] pave: [95x733 double] s_ave: [95x733 double] tave: [95x733 double] cond: [95x733 double] dday: [733x1 double] dates: [733x19 char] plot, and save to bs3_cmp_201213_tmpadjcal ------------------2015/02/20: back to Paula processing ---------------------------- Bob asked to provide processed data. But no funding, no time: agree to do prelim version that includes cal, but not editing and other qc such as lag determinations. ===================================================== return 2015/02/19 by now, I also have shallow microcat (though connector had been sheared off, the data were retrieved at SeaBird. Also: deep mc has been re-processed. C cal did not change, though I did a slight adjustment to T cal, and edited some spikes. ------ see whether I can run parts of Paula's programs, to get to the calibration portion had run a version of cmp_asc2mat_fb#.m previously to generate raw#####.mat files now make tlags_str structure and save to nominal_ctd_calfile.mat then run cmp_pgrd_mfile_after_rp.m get the deep microcat record; make sure the structure "mc" contains the field "datenumm", equal to "datenum" (both are present now). run MP_extract_bs.m using bin 45 run MP_cal_w_SEACAT_EGC.m (note, I am not running MP_cal_w_SEACAT_EGC_fb.m) ---- error---- Depth difference between MP and SC is 5.7866 Calculate gradient over what depth? 10 edepth = 10 Gradient will be calculated over 8 points Do you want to change the depth range ("y" to change)? okay = '' rawdir: c:\projects\healy10_ta\cmp_process\bs3_2012to13\raw outdir: c:\projects\healy10_ta\cmp_process\bs3_2012to13\grd looks okay?? hit to continue .. \n ??? Error using ==> load Unable to read file c:\projects\healy10_ta\cmp_process\bs3_2012to13\proc_paula\..\/grd/bs3_flag.mat: No such file or directory. Error in ==> gradient_check at 62 eval(['load ' ddir '/grd/' inst '_flag.mat']); Error in ==> MP_cal_w_SEACAT_EGC at 171 gradient_check(inst,MP.time(1),MP.time(end),ddir); >> ----- end error ------------------------------------------------------ run make_bs3flag to make a "fake" bs3_flag.mat file with zero inversions flagged. rerun MP_cal_w_SEACAT_EGC get linear cal factor of 1.0001 to 1.0027 or conductivity change from 0 to 0.007 S/m run MP_applycal_EGC; Did bs3 stop profiling partway through deployment (y/n)? n (did not stop) use 1 for grd (usually, use "2" for edit) --------------------------- cycle around once more: - gross editing of averaged data program gross_echeck.m - plots small (1:10) and larger context (80) profiles to identify bad outliers. - if 0 loop near the end of code indicates how to mark bins as bad in the flag file - same if 0 loop indicates how MP with flags applied is saved to edit/bs3_edt.mat substitute the edited CMP data in the file containing the time series of the microcat and the time series of the CMP bin(s) used for cal: program adj_MP_bot.m rerun MP_cal_w_SEACAT_EGC. no obvious change ---------------------------------------- 2015/02/22 rerun the whols she-bang, but with a differnt cal bin: use 40 instead of 45. run MP_extract_bs.m using bin 40 run MP_cal_w_SEACAT_EGC.m very different cal! 1.0047 to 1.0028 try with intermediate: using bin 43 similar to bin 45: 1.0009 to 1.0030 stick with the cal from bin 45: 1.0009 to 1.0017 rerun MP_applycal_EGC.m; special version copied to local directory c:\projects\healy10_ta\cmp_process\bs3_2012to13\proc_paula that does not seek MP.cadj. 1) mkdir ../final don't use writeout_egc.m; instead make much simpler writeout_egc_ds3.m modified here as writeout_egc_bs3.m run writeout_egc_bs3.m takes cal/bs3_cal.m, generates final/bs3_edt.mat Note: check if transpose is needed (not here). We want final/[]_edt.mat to have MP(prof_no, bin_no): yes. ----------------------------------------- 2015/02/23 trouble with time: looks like all the way back to grd/bs3.mat return to cmp_pgrid_mfile_after_rp.m: - when running, got lots of weirdo case: raw1415.mat trouble with time from eng data pausing for 3 seconds found problem: the code was looking for and throwing out eng pressure of 0. However, since I subtract atm. pressure now, 0 became -10. Now, throw out eng pressure < 0. to redo grd/bs3.mat: re-run MP_extract_bs; again, chose bin 45 for cal. apply my "manual editing" from gross_echeck.m by re-running gross_echeck.m, than manually saving: save ../edit/bs3_edt MP re-run MP_cal_w_SEACAT_EGC (this may not be necessary, but it is in keeping my previous order) ; load edited data cal slightly different: MP.cal(1) 1.0009; MP.cal(end)= 1.0017 that is very similar to my earlier result "outside of Paula_proc". rerun MP_applycal_EGC.m run writeout_egc_bs3.m r_timetags_bs3.m: uses as input the unacked TIMETAGS.TXT file. For 2012-13, I have to take out leading ascii text, "/" and ":" before I can load it into matlab => TIMEAGS_mr.TXT ("mr" for machine readable) check final/bs3_edt.mat with TIMETAGS_mr.TXT: - first time are the same( good) - eliminate times in TIMETAGS_mr beyond the end of MP.time - edit r_timetags_bs3.m to use only every other TIMETAGS_mr line since only every other C file could be decoded run f_rawprftimes_bs3.m to generate ../final/bs3_edt_fb.mat ========================================================================= ========================================================================= ========================================================================= SUNA notes 2013/11/07 try to get a quick version out for Bob. This past year had a weird firmware - 4.17 - with different data formats. For one, all odd-numbered CTD files are empty. All SUNA files are there, but now the even ones are very short. Hm ... compare times: C0001000.TXT: ascend 13/06/24 11:58:15 to 13/06/24 12:17:28 Profile 1000 RBR turned on at 06/24/2013 11:58:38 RBR turned off at 06/24/2013 12:17:32 E0001000.TXT: descent 06/24/2013 06:00:38 to 06:03:38 E0001001.TXT: ascend Profile 1001 Sensors were turned on at 06/24/2013 11:58:38 Vehicle began profiling at 06/24/2013 12:00:04 S0001000.TXT: Profile 1000 SUNA turned on at 06/24/2013 05:58:38 SUNA turned off at 06/24/2013 00:17:59 from SNSRTIME.TXT: Profile 1000 RBR turned on at 06/24/2013 11:58:38 Profile 1000 RBR turned off at 06/24/2013 12:17:32 Profile 1000 SUNA turned on at 06/24/2013 05:58:38 Profile 1000 SUNA turned off at 06/24/2013 00:17:59 from TIMETAGS.TXT: 1000 06/24/2013 05:58:38 06/24/2013 06:00:09 06/24/2013 06:03:49 06/24/2013 06:06:03 0 [SMOOTH RUNNING] 14 [BOTTOM PRESSURE] Conclusion: =========== modify file number of C files by 1: C0001000.TXT -> C0001001.TXT etc. reasoning: E files and TIMETAGS.TXT set profile 1000 as descent at 06:00 (stop at bottom). SUNA 1000 is at 06:00. RBR (C file) has 1000 as ascent, and 6 hours later. So the renumbered C files would match E and S files. ---------------------- 2015/02/24 late addition: when doing (yet another prelim) processing of the CMP CTD, also look into SUNA. Go with "CTD binned". Notes are bit vague on the difference between "CTD binned" and "eng binned", but all further routines use CTD binned. Add one nan profile ahead of existing SUNA profiles, to make the profile count of CTD and SUNA match. There were several save guard checks such as plotting profile length, time, profno etc to ensure that the CTD and SUNA profiles of the same count within their structures match. ------------------------------------------------------------------------- ---- done with Feb 2015 prelim proc ------------------------------------- ------------------------------------------------------------------------- ============================================================================== previous notes from 2011 -> 2012 ============================================================================== copy dir "suna" from c:\projects\healy10_ta\cmp_process\bs3_2011to12 to c:\projects\healy10_ta\cmp_process\bs3_2012to13; take out previous .mat and .png files edit r_sunadata_1.m: change input dir. Since r_upacksuna_1.m looks for strings with specific identifiers, the additional comment lines this year (unpacker 3 only does "human readable"). mkdir smatfiles % for .mat version of S*.TXT) mkdir smatfiles1 % for SUNA data matched with C pressure) run r_sunadata_1 run call_reng to convert eng files into matlab. For HLY1203: scheme was to find match of ENG pressure and SUNA time, then go into CTD time series to match SUNA time to CTD pressure. Will do that still for HLY1303 as well. In addition, however, I will also JUST use ENG pressure to cover those SUNA profiles where we don't have CTD data (got only every other CTD profile) original scheme: use t_match_se_3: modified to get eng data not from E*.TXT files, but from raw/raw####.mat files that contain the CTD data. modifed scheme: only use eng data. 1) convert eng E*.TXT files, which for Unpacker3, are "human readable" with extra comments, into .mat files: suna/call_reng.m and suna/r_upackeng.m 2) use t_match_se_engonly.m that got me all SUNA files. curiously: for the files with CTD data, the last SUNA data was sampled after the crawler stopped. For those without, the last ENG pressure is still changing. Could have to do with up/down rather than CTD/no_CTD. -------------------------------- HLY1203: --------------------------------- CTD on CMP start down CMP stop CTD off 0000010 10 24 2011 17 58 26 10 24 2011 18 00 01 10 24 2011 18 05 15 10 24 2011 18 07 22 0 14 Profile 10 SUNA turned on at 10 24 2011 17 58 26 Profile 10 SUNA turned off at 10 24 2011 18 07 22 Profile 10 RBR turned on at 10 24 2011 17 58 26 Profile 10 RBR turned off at 10 24 2011 18 07 22 1:34 + 7:22 = 9:56 min ontime SATSDB0052 149.113 0.000000 10/24/2011 18:00:30 419.652 0.000000 10/24/2011 18:05:01 270.5 seconds 4:29min = 271 looking at C0000010.TXT: starting (second) time stamp: TIMESTAMP: TIM 11/10/24 17:58:25 ending time stamp (has only one) TIMESTAMP: STP 11/10/24 18:07:20 08:55 minutes: 535 seconds 537 data lines times from the TIMETAGS.TXT (shown above) work out a bit better: there, CTD off occurs 07:22 start occurs one second later, though. steps: - in c:\projects\healy10_ta\cmp_process\bs3_2011to12\suna, mkdir smatfiles % for .mat version of S*.TXT) mkdir smatfiles1 % for SUNA data matched with C pressure) - convert SUNA files from unpacked, not "human readable" S*.TXT files: run r_sunadata_1 note: only every other file is non-zero; => convert files 1:2:1430, where files is an index into the structure "D=dir('S0*.TXT') (need the "0" to exclude SNSRTIME.TXT) - derive SUNA pressure by matching SUNA dark readings with E stopgap lines. Note: this requires a parsed version of the C*.TXT files as typically generated in the proc_ini run onboard ship. currently, that (derive p) is done by t_match_se_1.m. Note: it sets the file name by specifying the file number, rather than the index into a D=dir structure. This makes a difference since our C,E,S files begin with number 0, not 1. - ran t_match_se_1.m for files 0:2:1426, or 714 files (SUNA appears to be collected on only every other profile; the other files are 0 size). - vertically bin the SUNA profiles: call_binsuna.m calls (a local copy of) depth_bin_cmp.m, set to match to match the 2-dbar bins of the final processed CMP, not the initial depth_bin_cmp.m settings used in proc_ini. Still, given the interrupted sampling (see fig of SUNA depth/time series) of the SUNA, I interpolate cross gaps within a SUNA profile. The final .mat file keeps the initial time series (SUNAraw), as well as the original binned and the interpolated binned data (structure SUNA with fields "_i" for interplated variables). - plot the data: p_cmpsuna_final.m; puts .png file into ../doc ===================================================================================== ===================================================================================== ===================================================================================== Return to CMP 2012-13 in June 2020 ===================================================================================== ===================================================================================== ===================================================================================== In this push to finish the AON BS3 backlog, I had finished the 2013-14 CMP in May of this year (2020). I will base the processing of 2012-13 on the modified+new 2013-14 code. So first: here are the CMP2013-14 notes from May 2020: ===================================================================================== On the re-start in May 2020, I will use the structure of previous CMP processing, but not necessarily Paula Fratantoni's code (based on John Toole / Rick Krishfield's code for MMP processing). While I like that package, its best tools were developed for SeaBird CTDs, not the "open cell" RBRs. Over the years, I had already started to address that by adding more and more specifics to Paula's routines. The general processing route had been: - remove start/end bits before CMP profiling starts/after it ends; - determine sensor lags that minimize S spiking - bin average to 2 dbar - visual editing of 2 dbar data I had long ago added raw data editing; but compare them to the average profiles in the process. So it becomes a bit iterative: - remove start/end bits before CMP profiling starts/after it ends ("cutstop") - determine sensor lags that minimize S spiking - bin average to 2 dbar - visual editing of raw data - re-run bin averaging - visual check of 2 dbar data. - conductivity calibration adjustment based on MC To outline the whole thing, take a look at parts first: - cutstop - should be able to work outside Paula's code - find lags: looks do-able as well. ------------------------------------------------------------------- 1) cutstops ------------------ work with already parsed raw data saved in bs3_201314\cmp_proc_ini\matfiles\C#######_tmp.mat dday_prf = interp1( [1, nn], [dt0, dt1], [1:nn]'); % time within the profile dt = mean(dday_prf); % one time as time stamp of the profile from: rupackcmp2.m: % for RBR CTD's, barometric pressure is not removed ip = 3; % pressure index fprintf(2, '\n removing atm. pressure (10 dbar) from pressure variable'); x(:,ip) = x(:,ip) - 10; eval(['save ', outfile, ' x dt dday_prf ']) with x : P = x(:,3); C = x(:,1); T = x(:,2); S = sal; O2 = x(:,4); PH = x(:,5); V1 = x(:,6); V2 = x(:,7); dd = mean_nan(dt); remove start/stops: mfiles/e_cutstops3.m pay close attention to the many stop-only profiles, trying to get a fairly constant measurement (if it moved a bit without enough to generate multiple depth bins, but enough to introduce variability, cut that out). 2020/05/12 for C0000894_tmp.mat : T and S fluctuations are outrageous for this stopped "profile". It seems very likely unreal. Its easier to wipe this one than to push further (not a >50 subset was realistic!) I miss that number in the series of every-other prfiles 0:2:1456 So its: [0:2:892, 896:2:1456] 2020/05/13 moving on to lags finished lags; t_lags3p.m mostly 0 and 1; couple 2's. run fill_lags; remove ifile 894 manually (told you: this will be a pitb!) make new procfb_cmp.m ideally, meant as an overall program, but we are starting a bit late for that. First job: make structure; add ifile; add lags profles 90 and 1078 (cmp index 46 and 539) fail the limit tests. Check them out: In both cases, the CTD appeared to have failed. look at raw data for 90, 864, and 1078 2020/05/18 Found problem: profile 1078 was actually on deck. It was the last profile (well empty 1079 was) of the record, from July 17, 2014. The mooring was recovered that day. Wipe rawcutstop files after that. Wipe matfiles after that. Files with larger numbers were leftovers from the 2012-13 CMP processing! Also move 90 and 1078 to rawcutstop/deleted 2020/05/20 got edit_rawcb going. Struggled for a while to keep vars etc. general so that similar programs can work for ARGO, AW, and others. But details were too different. Use flag matrices as for ARGO rather than ascii lists of editing "bins" as I do for S-ADCP. Before applying first edits (to raw S before averaging), copy: !copy bs3_cmp201314.mat bs3_cmp201314_noedit.mat 1 file(s) copied. 2020/05/22 finished profile editing. But now wonder about the single-bin "profiles" when the CMP was stuck at the top stop. Their raw data seemed to have a lot of spread (e.g. density range) that makes me wonder how meaningful the mean is. check with p_zerolength.m 2020/05/30 Bob replied that S shall be dropped for now, but kept for later if wanted; like the shallowest MC for 2016-18. When making final format, note that earlier on-line versions have time for each bin, not just the profile. Silly. But could cause "issues" with the submission to the data archive if I change the format. Add binned time back in: conv2final.m look at input files: >> load ../rawcutstops/raw0630.mat >> whos Name Size Bytes Class Attributes ans 1x1 8 double ccond 278x1 2224 double cpres 278x1 2224 double csnum 1x278 2224 double ctemp 278x1 2224 double >> load ../matfiles/C0000430_tmp.mat >> whos Name Size Bytes Class Attributes ans 1x1 8 double ccond 278x1 2224 double cpres 278x1 2224 double csnum 1x278 2224 double ctemp 278x1 2224 double dday_prf 443x1 3544 double dt 1x1 8 double x 443x7 24808 double but note that the pre-cutstop raw files had a time error, using 2012-13 code to set refyear: 2012. subtract 366 Format to shoot for: MP = time: [729x54 double] pave: [729x54 double] cave: [729x54 double] s_ave: [729x54 double] tave: [729x54 double] pden: [729x54 double] ptmp: [729x54 double] dday: [729x1 double] profno: [729x1 double] pgrid: [1x54 double] ===================================================================================== ===================================================================================== now back to CMP2012-13: 2020/06/24 I make a new base directory "bs3_2012to13" after moving the existing one of this name to "bs3_2012to13_earlier". Then copy the directory "bs3_2013to14\mfiles" to the new "bs3_2012to13". The approach will be as for the May 2020 run for bs3_2013to14: - remove start/end bits before CMP profiling starts/after it ends ("cutstop") - determine sensor lags that minimize S spiking - bin average to 2 dbar - visual editing of raw data - re-run bin averaging - visual check of 2 dbar data. - conductivity calibration adjustment based on MC A couple basic things first: - was pressure offset applied: yes, in going from direc = 'c:\projects\healy10_ta\cmp_process\bs3_2012to13\cmp_bs3_2012to13_unpackv3'; % input dir to outdir = 'c:\projects\healy10_ta\cmp_process\bs3_2012to13\raw'; % input dir see bs3_2012to13_earlier\proc_paula\cmp_asc2mat_fb5_filenoerr.m 1) cutstops 2020/06/25 finished e_cutstops3.m skipped three files with a stuck CMP: 357, 385, and 571. Learn: skipping is not good for later processing. Don't. Wipe things later if you need to. 2020/06/26 2) lags use t_lags3p.m view its plots, then type in prof# and lag to lags_manual_v0.txt; will be filled in by modified to t_lags3p_1.m which writes the lags to a file (t_lags3p.m required that to be done manually ) as for 201314: mostly 0 and 1; couple 2's. run fill_lags for just the earliest portion, which I had done with t_lags3p.m; patch together with the output of t_lags3p_1.m for one lags file: lags_bs3_201213.txt 3) setup the cmp and CMP0 data structures: procfb_cmp.m (it is now "set up" to do the above steps as well; so it serves as the processing guide is is meant to be) Before applying first edits (to raw S before averaging), copy: !copy bs3_cmp201314.mat bs3_cmp201314_noedit.mat 1 file(s) copied. 2020/06/27 finished visual editing via edit_rawcb1.m; took out quite a few blibs especially early. There were definitely stretches of very clean profiles, but also small series of noisy ones. It seems related to the water column structure, rather than to sensor changes, but I did not look deeply for evidence. 2020/06/28 cond cal: I started looking into my previous cal results yesterday, but also decided to start over and produce a set of numbers based on the code I used for 2013-14. 1) what depths to calcuate a vertical cond gradient from? use similar to 2013-14: below 80m. 2) modify inv_ccal.m written for 2013-14 and run it for 2012-13: There is a lot of scatter early, and also towards the end. But there is a period in the middle into the second half where cond gradients are small, and the comparison to the MC is very clear. There is a cal difference, but it is not nearly as strong as calculated (years) earlier using Paula's programs: 1.0009 to 1.0017 I go back and re-run those programs once more, and find that the cal ratio and overall fit is heavily influenced by the early/late periods of large scatter, I believe based on a poorly fitted vertical conductivity gradient at the base of the CMP profiles. There is a roughly 50 day period in the Spring 2013 when the gradients are small and nearly constant, so that a linear fit works well. The time series of the MC/CMP cond ratio there is fitted well by a constant 1.0005. I plan to use that as the cal throughout. This implies a change of salinity between 0.01 and 0.04 psu from the previously processed version. Emailing Bob, he replies that he's fine with that. program test_newcal.m 2020/06/29 one more revision for cond cal: up to now, I had calculated the vertical conductivity gradient from all CMP bins below 80 dbar, as I did for BS3 2013 to 14. In that case, however, the vertical coverage was very poor, with few deep profiles available. Here, vertical coverage is quite good, and there are large changes in the conductivity gradient below 80 dbar. So I repeat the calculations with gradients determined from CMP bins from 110 to 124 dbar. program inv_ccal.m Also, I follow a scheme similar to that employed by Paula's code, where we iterate a fit to the MP/CMP conductivity ratio time series by tighening the spread (i.e., reduce the outlier included). My one difference is that I first exclude all large outliers around 1.0. That way, the iteration does not get "torqued" by those large outliers. program inv_ccal_localfitonly1.m I now arrive at a cond adjustment varying from 1.00015 to 1.00123. So it is in fact similar to Paula's initial result, though still not quite as large. Check what this cal does: inv_ccal_check.m Also plot TS including with MC: p_ts_prepostcal.m 2020/06/30 Apply the calibration, which took a bit to get the order right: % - start with unedited data; % - apply cond drift % - derive salinity % - apply editing flags % - average. Saved to bs3_2012to13edtcal program apply_drift.m use a modified writeout_egc_bs3.m to write the final .mat file mfiles\final\be3_201213_final.mat