% plotLastPoker.m will plot the last hour of data for the last experiment NEL long pulse data above 70 degrees elevation % at Poker Flat. % % $Id: plotLastPoker.m,v 1.7 2012/07/27 18:28:24 brideout Exp $ % % constants url = 'http://isr.sri.com/madrigal/'; user_fullname = 'Bill Rideout'; user_email = 'brideout@haystack.mit.edu'; user_affiliation = 'MIT Haystack'; instCode = 61; % Poker Flat ISR (PFISR) kindat = 5950; % SRI's kindat for Long pulse data files % get the cgi url that all Matlab Madrigal commands require cgiurl = getMadrigalCgiUrl('http://isr.sri.com/madrigal/'); % set startDate to six months ago, and endDate to now endDate = now() + 1.0; startDate = endDate - 31*6.0; % call API to get experiments for a given instrument and time range expList = getExperimentsWeb(cgiurl, instCode, startDate, endDate, 1); % find last index index = 1 lastTime = 0.0 for i = 1:length(expList) if (expList(i).endtime > lastTime) lastTime = expList(i).endtime index = i end end ['end time of last experiment: ', datestr(expList(index).endtime)] % find one hour before end of experiment startTime = expList(index).endtime - 1/24.0; startTimeVec = datevec(startTime) filterStr = sprintf(' date1=%02i/%02i/%04i time1=%02i:%02i:%02i ', startTimeVec(2), ... startTimeVec(3), startTimeVec(1), startTimeVec(4), startTimeVec(5), startTimeVec(6)); filterStr = strcat(filterStr, ' filter=elm,70, ') % call API to get all files in the last experiment fileList = getExperimentFilesWeb(cgiurl, expList(index).id); % choose the first file with the right kind of data (kindat) code for i = 1:length(fileList) if (fileList(i).kindat == kindat) filename = fileList(i).name; end end % get data from that file data = isprintWeb(cgiurl, filename, 'uth,gdalt,nel', user_fullname, user_email, user_affiliation, filterStr); % create arrays needed for a pcolor plot shape = size(data); X = data(:,1,:); X = reshape(X, shape(1), shape(3)); Y = data(:,2,:); Y = reshape(Y, shape(1), shape(3)); C = data(:,3,:); C = reshape(C, shape(1), shape(3)); % create the pcolor plot pcolor(X,Y,C); % set reasonable limits for NEL - CHANGE FOR OTHER PARAMETERS caxis([10, 12]); shading flat; hold on; xlabel(['Hours since midnight UT of ', datestr(expList(index).starttime, 'yyyy-mm-dd')]); ylabel('Log(Ne m^-3)'); title('Last hour of latest experiment of Poker Flat data on Madrigal'); colorbar();