function noaa_nos2latest % nos_sablam2latest % % Last modified: Time-stamp: <2004-08-05 16:16:14 haines> % % Abstract: Get latest NOS wind data from temporary raw-data directories % Data are screen scraped into table form. % These scripts further parse and process latest 48 hour obs % into netCDF files as part of the SEACOOS merged product effort. % % Usage: >> noaa_nos2latest % % % Author: Sara Haines, Dec 09, 2003 % Processing: % In general, for each station want to produce a file of last 48 % hours of obs. This file is a netCDF file with agreed upon conventions (Sep % 12, 2003 -- see Celoxis Metadata Project, and Data Sourcing Project % for metadata content, structure, format, and naming conventions. % % Uses the re-formatted files archived for each station. % raw_dir = ['/seacoos/data/nos/raw_data/temp/']; out_nc_v20_dir = ['/seacoos/data/nos/proc_data/latest_v2.0']; station_info_file = ['/opt/local/seacoos/bin/nos_locs.txt']; % get the current time (GMT), as processing time reference point especially % for auto mode. This unix call is required to get date in GMT since MATLAB % has no function to get this without hardcoding it. [e,z]=unix(['date -u ''+%d-%b-%Y %H:%M:%S''']); current_time_dn = datenum(z(1:end-1)); % show time of run for the log files fprintf(2,'\nStart time: %s\n', datestr(current_time_dn, 'dd-mmm-yyyy HH:MM:SS')); fprintf(2,['Processing latest 48 hour data from all NOS stations in' ... ' SEACOOS region ...\n']); % start_time_str = datestr(current_time_dn-2,30); % start_time_str = [start_time_str(1:8) start_time_str(10:11)]; % end_time_str = datestr(current_time_dn,30); % end_time_str = [end_time_str(1:8) end_time_str(10:11)]; info.current_time_dn = current_time_dn; info.raw_dir = raw_dir; info.out_nc_v20_dir = out_nc_v20_dir; % read stations_seacoos.txt and find index of station id, name, % state/country, lat, lon, elev all_lines = textread(station_info_file,'%s','delimiter','\n','whitespace',''); [numstations,n]=size(all_lines); % disp(['Looking for data from ' start_time_str ' to ' end_time_str]); % for each station for i=1:numstations station_str = char(all_lines(i)); NAME = station_str(22:end); [STATID,LAT,LON] = ... strread(station_str(1:21), '%s %f %f'); STATID = char(STATID); LAT = LAT; LON = -1*LON; info.platform_name = STATID; info.package_name = 'WL'; info.location_name = NAME; info.rawdirname = [info.raw_dir '/' STATID '.txt']; info.location_lat = LAT; info.location_lon = LON; try datum_info_file = ['./datum/' STATID '.txt']; all_datum_info = textread(datum_info_file,'%s',... 'delimiter','\n', ... 'whitespace',''); % this is a cell array of each line read from datum info file info.datum = all_datum_info; catch info.datum = {}; end get_latest(info); end