⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adcp2ep.m

📁 一个研究声多普勒计程仪很好的工具箱
💻 M
📖 第 1 页 / 共 2 页
字号:
   %**********************************************************************% Create the new output file.G = netcdf(epDataFile,'clobber');%Global Attributes%copy the globals from the Beam File%figure out what needs to be deleted, changed, or added to the final files%delete the following variablesdisp('Modifying the global attributes');A=att(B);Anames=ncnames(A);AN=length(Anames);for nn=1:AN-1   if isequal(Anames{AN-nn},'sensor_configuration');      A(AN-nn) = [];   elseif isequal(Anames{AN-nn},'transducer_attached');       A(AN-nn) = [];    elseif isequal(Anames{AN-nn},'simulated_data');       A(AN-nn) = [];    elseif isequal(Anames{AN-nn},'beams_in_velocity_calculation');       A(AN-nn) = [];    elseif isequal(Anames{AN-nn},'profiling_mode');       A(AN-nn) = [];    elseif isequal(Anames{AN-nn},'code_repetitions');       A(AN-nn) = [];    elseif isequal(Anames{AN-nn},'transmit_lag_distance');       A(AN-nn) = [];    elseif isequal(Anames{AN-nn},'transform');       A(AN-nn) = [];    end end  mm=1;while mm < AN-1	notenum = ['NOTE_',int2str(mm)];	Anames=ncnames(A); 	AN=length(Anames);	for nn=1:AN-1      if isequal(Anames{AN-nn},notenum);          A(AN-nn) = [];      end   end	mm=mm+1;end          %put the ones that are left into new file (G)G < A;%change the following attributes and variablesG.CREATION_DATE = datestr(now,0);%RENAME A FEWmoor = G.Mooring_number;moor = rename(moor,'MOORING');pulse = G.transmit_pulse_length;pulse = rename(pulse,'transmit_pulse_length_cm');%Define some new ones for Epic compatabilityG.transform = 'EARTH';G.DATA_TYPE = 'ADCP';G.DATA_SUBTYPE = 'MOORED';G.DATA_ORIGIN = 'USGS WHFS Sed Trans Group';G.COORD_SYSTEM = 'GEOGRAPHIC';G.WATER_MASS = ncchar('?');G.POS_CONST = nclong(0);  %1 if consistentG.DEPTH_CONST = nclong(0);  %1 if consistentG.WATER_DEPTH = wdepth;G.DRIFTER = nclong(0);G.VAR_FILL = theFillValue;if running(batch)   experiment = get(batch);    eval(['experiment = ' experiment ';'])   project = get(batch);   eval(['project = ' project ';'])   descript = get(batch);   eval(['descript = ' descript ';'])   long = get(batch);   eval(['long = ' long ';'])   lonUnits = get(batch);   eval(['lonUnits = ' lonUnits ';'])   latit = get(batch);   eval(['latit = ' latit ';'])   latUnits = get(batch);   eval(['latUnits = ' latUnits ';'])   cmnt = get(batch);  	eval(['cmnt = ' cmnt ';'])else   %NEED TO ASK FOR the following Data_Collection_Information.Mooring = {G.MOORING(:)}; Data_Collection_Information.Experiment = {{'Mass Bay Longterm', 'Globec', 'Southern California','Monterey Bay','GEOPROBE','ECOHAB'...             'Orange County Sanitation District','OTHER'}};   % 1 or 2. Data_Collection_Information.Project = {{'MWRA', 'NOAA', 'WCMG','WHFC','NOPP','OTHER'}} ;   Data_Collection_Information.descript = {{'Boston Buoy B ADCP','Scituate Buoy ADCP','Georges Bank ADCP',...             'Great South Channel ADCP','Socal ADCP','Montery ADCP','Santa Monica Bay ADCP','Casco Bay ADCP','Jordan Basin ADCP',...
          'Gulf of Maine ADCP','OTHER ADCP','LA Shelf ADCP M03','LA Shelf ADCP M05','LA Shelf ADCP M07','LA Shelf ADCP M11'}}; Data_Collection_Information.comments = {' '}; 	Data_Collection_Information.longitude.value = {0};   Data_Collection_Information.longitude.format = {'decimal degrees'};   Data_Collection_Information.longitude.units = {'degree_east','degree_west'}; 	Data_Collection_Information.latitude.value = {0};   Data_Collection_Information.longitude.format = {'decimal degrees'};   Data_Collection_Information.latitude.units = {'degree_north','degree_south'};     Data_Collection_Information = uigetinfo(Data_Collection_Information);  % Revised so getinfo will work with Matlab 6.0, r. 12 (ALR) experiment= getinfo(Data_Collection_Information,'Experiment'); project = getinfo(Data_Collection_Information,'Project'); descript = getinfo(Data_Collection_Information,'descript'); longInfo = getinfo(Data_Collection_Information,'longitude'); long = getinfo(longInfo,'value'); lonUnits = getinfo(longInfo,'units'); latitInfo = getinfo(Data_Collection_Information,'latitude'); latit = getinfo(latitInfo,'value'); latUnits=getinfo(latitInfo,'units'); cmnt = getinfo(Data_Collection_Information,'comments');end G.EXPERIMENT =experiment; G.PROJECT = project; G.DESCRIPT = descript; G.longitude = long; G.latitude = latit; G.DATA_CMNT = cmnt;  %Need to calculate or derive the followingG.FILL_FLAG=nclong(fill_flag);G.COMPOSITE=nclong(0);G.VAR_DESC='u:v:w:Werr:AGC:PGd:Tx';%calculate dt** this section removed FH 10 May 2000 %tim=B{'TIM'};%gt=gregorian(tim(:));%dt=diff(gt);%delta=(dt(1,4).*60)+(dt(1,5))+(dt(1,6)./60);G.DELTA_T=ncchar(num2str(delta));G.start_time = start_time;G.stop_time = stop_time;magnetic = B{'Hdg'}.heading_bias(:);if isempty(magnetic)   magnetic = B.heading_bias(:)/100;endG.magnetic_variation = magnetic;%define the dimensionsG('time') = 0;G('depth') = length(B{'D'});G('lon') = 1;G('lat') = 1;%Variables and Attributesdisp('Defining variables and their attributes')disp('...Defining "time"')G{'time'} = nclong('time');G{'time'}.FORTRAN_format = ncchar('F10.2');G{'time'}.units = ncchar('True Julian Day');G{'time'}.type = ncchar('UNEVEN');G{'time'}.epic_code = nclong(624);G{'time'}.FillValue_ = theFillValue;disp('...Defining "time2"')G{'time2'} = nclong('time') ;G{'time2'}.FORTRAN_format = ncchar('F10.2');G{'time2'}.units = ncchar('msec since 0:00 GMT');G{'time2'}.type = ncchar('UNEVEN');G{'time2'}.epic_code = nclong(624);G{'time2'}.FillValue_ = theFillValue;disp('...Defining "depth"')G{'depth'} = ncfloat('depth'); G{'depth'}.FORTRAN_format = ncchar('F10.2');G{'depth'}.units = ncchar('m');G{'depth'}.type = ncchar('EVEN');G{'depth'}.epic_code = nclong(3);G{'depth'}.long_name = ncchar('DEPTH (m)');G{'depth'}.blanking_distance = B{'D'}.blanking_distance(:);G{'depth'}.bin_size = B{'D'}.bin_size(:);G{'depth'}.xducer_offset_from_bottom = B{'D'}.xducer_offset_from_bottom(:);G{'depth'}.FillValue_ = theFillValue;G{'depth'}.NOTE = ncchar(dnote);disp('...Defining "lon"')G{'lon'} = ncfloat('lon'); %% 1 element.G{'lon'}.FORTRAN_format = ncchar('f10.4');G{'lon'}.units = ncchar(lonUnits);G{'lon'}.type = ncchar('EVEN');G{'lon'}.epic_code = nclong(502);G{'lon'}.name = ncchar('LON');G{'lon'}.long_name = ncchar('LONGITUDE');G{'lon'}.generic_name = ncchar('lon');G{'lon'}.FillValue_ = theFillValue;disp('...Defining "lat"')G{'lat'} = ncfloat('lat'); %% 1 element.G{'lat'}.FORTRAN_format = ncchar('F10.2');G{'lat'}.units = ncchar(latUnits);G{'lat'}.type = ncchar('EVEN');G{'lat'}.epic_code = nclong(500);G{'lat'}.name = ncchar('LAT');G{'lat'}.long_name = ncchar('LATITUDE');G{'lat'}.generic_name = ncchar('lat');G{'lat'}.FillValue_ = theFillValue;disp('...Defining "u_1205"')G{'u_1205'} = ncfloat('time', 'depth', 'lat', 'lon');G{'u_1205'}.name = ncchar('u');G{'u_1205'}.long_name = ncchar('Eastward Velocity');G{'u_1205'}.generic_name = ncchar('u');G{'u_1205'}.FORTRAN_format = ncchar(' ');G{'u_1205'}.units = ncchar('cm/s');G{'u_1205'}.epic_code = nclong(1205);G{'u_1205'}.sensor_type = B.INST_TYPE(:);G{'u_1205'}.sensor_depth = wdepth - xducer_off;G{'u_1205'}.serial_number = nclong(serial);G{'u_1205'}.minimum = ncfloat(minsc(1));G{'u_1205'}.maximum = ncfloat(maxsc(1));%Not sure this is the right valid range, but what Fran hadG{'u_1205'}.valid_range = ncfloat([1000 1000]);G{'u_1205'}.FillValue_ = theFillValue;disp('...Defining "v_1206"')G{'v_1206'} = ncfloat('time', 'depth', 'lat', 'lon'); G{'v_1206'}.name = ncchar('v');G{'v_1206'}.long_name = ncchar('Northward Velocity');G{'v_1206'}.generic_name = ncchar('v');G{'v_1206'}.FORTRAN_format = ncchar(' ');G{'v_1206'}.units = ncchar('cm/s');G{'v_1206'}.epic_code = nclong(1206);G{'v_1206'}.sensor_type = B.INST_TYPE(:);G{'v_1206'}.sensor_depth = wdepth - xducer_off;G{'v_1206'}.serial_number = nclong(serial);G{'v_1206'}.minimum = ncfloat(minsc(2));G{'v_1206'}.maximum = ncfloat(maxsc(2));G{'v_1206'}.valid_range = ncfloat([1000 1000]);G{'v_1206'}.FillValue_ = theFillValue;disp('...Defining "w_1204"')G{'w_1204'} = ncfloat('time', 'depth', 'lat', 'lon'); G{'w_1204'}.name = ncchar('w');G{'w_1204'}.long_name = ncchar('Vertical Velocity');G{'w_1204'}.generic_name = ncchar('w');G{'w_1204'}.FORTRAN_format = ncchar(' ');G{'w_1204'}.units = ncchar('cm/s');G{'w_1204'}.epic_code = nclong(1204);G{'w_1204'}.sensor_type = B.INST_TYPE(:);G{'w_1204'}.sensor_depth = wdepth - xducer_off;G{'w_1204'}.serial_number = nclong(serial);G{'w_1204'}.minimum = ncfloat(minsc(3));G{'w_1204'}.maximum = ncfloat(maxsc(3));G{'w_1204'}.valid_range = ncfloat([1000 1000]);G{'w_1204'}.FillValue_ = theFillValue;disp('...Defining "Werr_1201"')G{'Werr_1201'} = ncfloat('time', 'depth', 'lat', 'lon'); G{'Werr_1201'}.name = ncchar('Werr');G{'Werr_1201'}.long_name = ncchar('Error Velocity');G{'Werr_1201'}.generic_name = ncchar('w');G{'Werr_1201'}.FORTRAN_format = ncchar('F8.1');G{'Werr_1201'}.units = ncchar('cm/s');G{'Werr_1201'}.epic_code = nclong(1201);G{'Werr_1201'}.sensor_type = B.INST_TYPE(:);G{'Werr_1201'}.sensor_depth = wdepth - xducer_off;G{'Werr_1201'}.serial_number = nclong(serial);G{'Werr_1201'}.minimum = ncfloat(minsc(4));G{'Werr_1201'}.maximum = ncfloat(maxsc(4));G{'Werr_1201'}.valid_range = B.error_velocity_threshold(:);G{'Werr_1201'}.FillValue_ = theFillValue;disp('...Defining "AGC_1202"')G{'AGC_1202'} = ncfloat('time', 'depth', 'lat', 'lon'); G{'AGC_1202'}.name = ncchar('AGC');G{'AGC_1202'}.long_name = ncchar('Average Echo Intensity (AGC)');G{'AGC_1202'}.generic_name = ncchar('AGC');G{'AGC_1202'}.FORTRAN_format = ncchar('F5.1');G{'AGC_1202'}.units = ncchar('counts');G{'AGC_1202'}.epic_code = nclong(1202);G{'AGC_1202'}.sensor_type = B.INST_TYPE(:);G{'AGC_1202'}.sensor_depth = wdepth - xducer_off;G{'AGC_1202'}.serial_number = nclong(serial);G{'AGC_1202'}.norm_factor = B{'AGC1'}.norm_factor(:);G{'AGC_1202'}.NOTE = ncchar('normalization to db');G{'AGC_1202'}.minimum = ncfloat(min(min(iavg)));G{'AGC_1202'}.maximum = ncfloat(max(max(iavg)));G{'AGC_1202'}.valid_range = B.false_target_reject_values(:);G{'AGC_1202'}.FillValue_ = theFillValue;disp('...Defining "PGd_1203"')G{'PGd_1203'} = ncfloat('time', 'depth', 'lat', 'lon');G{'PGd_1203'}.name = ncchar('PGd');G{'PGd_1203'}.long_name = ncchar('Percent Good Pings');G{'PGd_1203'}.generic_name = ncchar('PGd');G{'PGd_1203'}.FORTRAN_format = ncchar(' ');G{'PGd_1203'}.units = ncchar('counts');G{'PGd_1203'}.epic_code = nclong(1203);G{'PGd_1203'}.sensor_type = B.INST_TYPE(:);G{'PGd_1203'}.sensor_depth = wdepth - xducer_off;G{'PGd_1203'}.serial_number = nclong(serial);G{'PGd_1203'}.minimum = ncfloat(min(min(pavg)));G{'PGd_1203'}.maximum = ncfloat(max(max(pavg)));G{'PGd_1203'}.valid_range = B.minmax_percent_good(:);G{'PGd_1203'}.FillValue_ = theFillValue;disp('...Defining "hght_18"')G{'hght_18'} = ncfloat('time', 'lat', 'lon'); G{'hght_18'}.name = ncchar('hght');G{'hght_18'}.long_name = ncchar('height of sea surface');G{'hght_18'}.generic_name = ncchar('height');G{'hght_18'}.FORTRAN_format = ncchar('f10.2');G{'hght_18'}.units = ncchar('m');G{'hght_18'}.epic_code = nclong(18);G{'hght_18'}.sensor_depth = wdepth - xducer_off;G{'hght_18'}.minimum = ncfloat(min(height));G{'hght_18'}.maximum = ncfloat(max(height));G{'hght_18'}.serial_number = nclong(serial);G{'hght_18'}.valid_range = ncfloat([0 1000]);G{'hght_18'}.FillValue_ = theFillValue;G{'hght_18'}.NOTE = ncchar('height of sea surface relative to transducer head from surface.exe');disp('...Defining "Tx_1211"')G{'Tx_1211'} = ncfloat('time', 'lat', 'lon');G{'Tx_1211'}.name = ncchar('Tx');G{'Tx_1211'}.long_name = ncchar('ADCP Transducer Temp.');G{'Tx_1211'}.generic_name = ncchar('temp');G{'Tx_1211'}.units = ncchar('degrees.C');G{'Tx_1211'}.epic_code = nclong(1211);G{'Tx_1211'}.sensor_type = B.INST_TYPE(:);G{'Tx_1211'}.sensor_depth = wdepth - xducer_off;G{'Tx_1211'}.serial_number = nclong(serial);G{'Tx_1211'}.minimum = ncfloat(min(tempC));G{'Tx_1211'}.maximum = ncfloat(max(tempC));G{'Tx_1211'}.valid_range = B{'Tx'}.valid_range(:);G{'Tx_1211'}.FillValue_ = theFillValue;disp('...Defining "P_4"')G{'P_4'} = ncfloat('time', 'lat', 'lon') G{'P_4'}.name = ncchar('P');G{'P_4'}.long_name = ncchar('PRESSURE (PASCALS)');G{'P_4'}.generic_name = ncchar('depth');G{'P_4'}.units = ncchar('Pa');G{'P_4'}.epic_code = nclong(4);G{'P_4'}.sensor_type = B.INST_TYPE(:);G{'P_4'}.sensor_depth = wdepth - xducer_off;G{'P_4'}.serial_number = nclong(serial);G{'P_4'}.minimum = ncfloat(min(Press));G{'P_4'}.maximum = ncfloat(max(Press));G{'P_4'}.valid_range = B{'Pressure'}.valid_range(:);G{'P_4'}.FillValue_ = theFillValue;G{'P_4'}.NOTE = ncchar('Pressure of the water at the transducer head relative to one atmosphere (sea level)');endef(G)%Put in the Datam=ensemble;n=bin;disp(['Copying data to ' epDataFile]);disp('... time')G{'time'}(1:m)= Time;disp('... time2')G{'time2'}(1:m) = Time2;disp('... lat')G{'lat'}(1) = G.latitude(:);disp('... lon')G{'lon'}(1) = G.longitude(:);disp('... depth')G{'depth'}(1:n) = depth;disp('... u_1205')G{'u_1205'}(1:m, 1:n, 1, 1) = cur{1}(:,:);disp('... v_1206')G{'v_1206'}(1:m, 1:n, 1, 1) = cur{2}(:,:);disp('... w_1204')G{'w_1204'}(1:m, 1:n, 1, 1) = cur{3}(:,:);disp('... Werr_1201')G{'Werr_1201'}(1:m, 1:n, 1, 1) = cur{4}(:,:);disp('... AGC_1202')G{'AGC_1202'}(1:m, 1:n, 1, 1) = iavg;disp('... PGd_1203')G{'PGd_1203'}(1:m, 1:n, 1, 1) = pavg;disp('...hght_18')G{'hght_18' }(1:m, 1, 1) = height;disp('... Tx_1211')G{'Tx_1211'}(1:m, 1, 1) = tempC;disp('... P_4')G{'P_4'}(1:m, 1, 1) = Press;      close(B)      close(G)            thecomment = sprintf('%s\n','Written to an EPIC standard data file by adcp2ep.m (version 1.1)');history(epDataFile,thecomment);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -