%NY_Tides_Curr.m % %Program to do a tidal analysis on the available current data from the NY %Bight. Requires the input of a station and depth, and runs "t_tide.m" %program. % %Soupy Alexander, 03/08/02 %The tidal information is saved to a file; this file was modified for relevent %information and appearance in wordpad %Select a station to use. station = input('Station to analyze? '); %Select a depth to use hit_depth = input('Depth? (Input B bottom) '); %Pull the proper file for analysis - using hourly averaged data (naturally) if station == 'A'; file_name = netcdf('5951adc-a1h.nc','nowrite'); file_name_B = netcdf('5952v-a1h_d1.nc','nowrite'); elseif station == 'B'; file_name = netcdf('5971adc-a1h.nc','nowrite'); file_name_B = netcdf('5972v-a1h_d1.nc','nowrite'); elseif station == 'C'; file_name = netcdf('5991adc-a1h.nc','nowrite'); file_name_B = netcdf('5992v-a1h.nc','nowrite'); elseif station == 'D'; file_name = netcdf('6011adc-a1h.nc','nowrite'); file_name_B = netcdf('6012v-a1h_d1.nc','nowrite'); elseif station == 'E'; file_name = netcdf('6031adc-a1h.nc','nowrite'); file_name_B = netcdf('6032v-a1h.nc','nowrite'); elseif station == 'F'; file_name = netcdf('6041adc-a1h.nc','nowrite'); else error('Not a valid station. Remember to use a capital letter in single quotes'); end %Pull out the data of interest (time, current, latitude,depth) t = file_name{'time'}(:); t2 = file_name{'time2'}(:); lat = file_name{'lat'}(:); depth = file_name{'depth'}(:); u_1205 = file_name{'u_1205'}(:); v_1206 = file_name{'v_1206'}(:); %Combine the two time vectors into one julian day vector time = singleJD(t,t2); %Pull out the data from the proper depth if hit_depth ~= 'B'; hit_index = value2Index(depth,hit_depth); elseif hit_depth == 'B' hit_index = find(depth == max(depth)); end u = u_1205(:,hit_index); v = v_1206(:,hit_index); u = ridfill_nan(u); v = ridfill_nan(v); %Combine into a complex vector current = u + i.*v; %Determine the start time greg_start = gregorian(min(time)); start_time = [greg_start(1),greg_start(2),greg_start(3),greg_start(4),... greg_start(5),greg_start(6)]; %Set up the output file name out_name = ['tide_curr' station num2str(hit_depth)]; [name,freq,tidecon,xout] = t_tide(current,'start time',start_time,... 'latitude',lat,'output',out_name); %For the bottom, pull the BASS/MAVS data as well if hit_depth == 'B' & station ~= 'F'; tB = file_name_B{'time'}(:); t2B = file_name_B{'time2'}(:); latB = file_name_B{'lat'}(:); u_1205B = file_name_B{'u_1205'}(:); v_1206B = file_name_B{'v_1206'}(:); timeB = singleJD(tB,t2B); uB = ridfill_nan(u_1205B); vB = ridfill_nan(v_1206B); currentB = uB + i.*vB; greg_startB = gregorian(min(timeB)); out_nameB = ['tide_curr' station 'bot']; [name,freq,tidecon,xout] = t_tide(currentB,'start time',start_time,... 'latitude',lat,'output',out_nameB); end