function r1=do_adj_tripod_dep(tripod_number) % do_adj_tripod_dep- corrects tripod WATER_DEPTH attributes and depth var. % % usage retn=do_adj_tripod_dep(tripod_number) % inputs : tripod number -integer number of tripod to adjust % outputs : retn is 1 if everything was OK % requires lta_newdep_v3b.txt with new depths, and MassBay_cmab_ed2.xls % with the instrument height info in the cwd. Reads everything needed % from these files, and treats EVERY file starting with tripod_number. % The files to be fixed must be in the current directory! % % usage notes: % adj_tripod_dep tries to figure what values to used based on variable % name and type, and the parts of the filename. Not all possibilities are % dealt with, so sometimes you have to figure out what to enter. Here are % the main categories of answer you'll have to respond to: % 1)if the program finds more than one entry in the .xls it will prompt % for which to use: % 2)then if the variable name is not found it will ask you to enter the value % (which you find from the appropriate cmab column) % 3)it may not be able to figure out how to find nih (new inst. height). % % The rcm files are a good example of how the program responds when it doesn't % know what it's got: % did not get an exact match to use on 6903rcm-alp.nc- select which should be used. % how about: 6901WH ? (y or n) % n % how about: 6902MIDAS ? (y or n) % n % how about: 6903RCM ? (y or n) % y % no match for recnum in 6903rcm-alp.nc % Enter the instrument height (m) to use % 1.64 % 'cs_300' [1x65 char] % no instrument height known- please enter one (in m): % use: nih=###; return % nih=1.64; % return % % if the {'depth'} variable is empty in the log file, check to see that there % are entries for the sensor_depth. For Midas, often the basspod1_cmab and/or % basspod2_cmab were empty- default values of 100 & 40 had to be added. % Any empty field in the .xls will also be empty in the output .nc. % % Program written in Matlab v7.4.0336 (R2007a) % Program updated in Matlab 7.6.0.324 (R2008a) % Program ran on PC with Windows XP Professional OS. % % "Although this program has been used by the USGS, no warranty, % expressed or implied, is made by the USGS or the United States % Government as to the accuracy and functioning of the program % and related program material nor shall the fact of distribution % constitute any such warranty, and no responsibility is assumed % by the USGS in connection therewith." % This is a front-end to adj_tripod_depth that populated the input structures % with data from files Brad provided for MassBay Long Term files. % For other applications, populate the structures as seems most suitable for the dataset % sample structures are available in samp_instruct.mat % % first get the new water depth info from the file from Brad- he sent a % .xls. I had to edit it to have one answer per tripod, and then save as % CSV. you don't want ' or " around the pressure file name [tripodid, mname, pval, sd, sh, ndep]=textread('lta_newdep_v3b.txt','%n%s%n%n%n%n','delimiter',','); % Then you read the edited .xls file from Chris Sabens- Make sure you've % forced the _cmab columns to be numeric- the rest should be text- % particularly column 1. Also this file must contain only the tripods in % the to-be fixed list- ones with no new_depth must be removed. [cmab_dat, vals,vst]=extract_hab('MassBay_cmab_ed2.xls'); % Then put together the "new" structure for adj_tripod_dep new.tripod_no=(tripod_number); loc=strmatch(num2str(new.tripod_no), mname); new.new_water_depth=ndep(loc(1)) cmnt=['water depth computed using mean pressure from ' char(mname(loc)) ' - atmosphere (1013.3)'] new.cmnt=cmnt; % finally call adj_tripod_dep- % this actually modifies files (after copying to _old), so beware! r1=adj_tripod_depth(new, cmab_dat);