function [table_str]=meta_to_table(url,lon,lat, mvals); % META_TO_TABLE Convert meta data to Nx2 cell array format used by "ge_point". % this program creates the tables that are displayed by GoogleEarth when a % placemark is clicked. Mvals can be populated using get_whfc_meta. table_str{1,1}='URL'; table_str{1,2}=[url '.html']; table_str{2,1}='Latitude'; table_str{2,2}=sprintf('%12.6f',lat); table_str{3,1}='Longitude'; table_str{3,2}=sprintf('%12.6f',lon); table_str{4,1}='Start time'; table_str{4,2}=datestr(mvals.jd_start,'yyyy-mm-dd HH:MM:SS Z'); table_str{5,1}='Stop time'; table_str{5,2}=datestr(mvals.jd_stop,'yyyy-mm-dd HH:MM:SS Z');; table_str{6,1}='water depth (m)'; if isnumeric(mvals.wdep) table_str{6,2}=num2str(mvals.wdep); else table_str{6,2}=num2str(mvals.wdep); end table_str{7,1}='measurement depth(s) (m)'; depstr=[]; %most adcp data has depth ordered deepest to shallowest % looks nicer as shallowest to deepest so flip dep=mvals.meas_dep; if length(mvals.meas_dep > 1) if mvals.meas_dep(end) < mvals.meas_dep(1) dep=flipud(mvals.meas_dep); end end for ik=1:length(dep) if ik==1 depstr = num2str(dep(ik)); else depstr = [depstr ', ' num2str(dep(ik))]; end end table_str{7,2}=depstr; table_str{8,1}='Instrument Type'; if isnumeric(mvals.sensr) table_str{8,2}=num2str(mvals.sensr); else table_str{8,2}=num2str(mvals.sensr); end varstr=[]; ncnt=9; % establish a counter for additonal lines % % when using ncnames(var(nc)) the coordinate vars are always at the front % %Can't count on any particular order of coordinate vars, but there will % %be at least 5- thinge like waves files will have more. % endcoord=5; zcnt=1; % for ik=endcoord+1:length(mvals.varnames) % varstr= char(mvals.long_names{ik}); % if ~(strcmp(varstr,'LATITUDE')) && ~isempty(varstr) % exclude lat when it follows lon % table_str{ncnt,1}=['variable ' num2str(zcnt) ':']; % table_str{ncnt,2}=varstr; % ncnt=ncnt+1; varstr=[]; zcnt=zcnt+1; % end % when variables gotten from mDataset, the order could be anything % however, the long_names that are coordinates are type mVar not char zcnt=1; for ik=1:length(mvals.varnames) if ischar(mvals.long_names{ik}) varstr= char(mvals.long_names{ik}); table_str{ncnt,1}=['variable ' num2str(zcnt) ':']; table_str{ncnt,2}=varstr; ncnt=ncnt+1; varstr=[]; zcnt=zcnt+1; end end % table_str