;+ ; NAME: ; plotLastPoker ; ; PURPOSE: ; Write a program that will plot the last hour of NEL long pulse data above 70 degrees elevation ; at Poker Flat. ; ; Warning - I am very much a novice IDL programmer - feel free to modify the plotting code which ; is probably very sub-optimal ; ; $Id: plotLastPoker.pro,v 1.4 2012/07/31 05:16:24 brideout Exp $ ; pro plotLastPoker FORWARD_FUNCTION madgetexperiments, madprint ; constants madurl = '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 ; set start time to six months ago, and end time to now endDT = SYSTIME( /JULIAN , /UTC) startDT = endDT - (31.0*6.0) CALDAT, startDT, startmonth, startday, startyear, starthour, startmin, startsec CALDAT, endDT, endmonth, endday, endyear, endhour, endmin, endsec ; call API to list all experiments for given instruments and a time range expArr = madgetexperiments(madurl, instcode, startyear, startmonth, startday, starthour, startmin, startsec, $ endyear, endmonth, endday, endhour, endmin, endsec) lastExp = expArr[n_elements(expArr)-1] ; print the time the last experiment ran print, 'End time of last experiment = ', string(format='(%"%i-%02i-%02i %02i-%02i-%02i")', $ lastExp.endyear, lastExp.endmonth, lastExp.endday, $ lastExp.endhour, lastExp.endmin, lastExp.endsec) ; create string to filter out all except lastHour lastHour = julday(lastExp.endmonth, lastExp.endday, lastExp.endyear, lastExp.endhour, lastExp.endmin, lastExp.endsec) - 1/24.0 CALDAT, lastHour, lmonth, lday, lyear, lhour, lmin, lsec filterStr = ' date1=' + string(lmonth, FORMAT='(I02)') + '/' + string(lday, FORMAT='(I02)') + '/' + string(lyear, FORMAT='(I04)') filterStr = filterStr + ' time1=' + string(lhour, FORMAT='(I02)') + ':' + string(lmin, FORMAT='(I02)') + ':' + string(lsec, FORMAT='(I02)') ; get a list of all files in that experiment fileArr = madgetexperimentfiles(madurl, long64(lastExp.strid)) ; loop through each file until the right kindat found for the long pulse data for i=0, n_elements(fileArr)-1 do begin if fileArr[i].kindat ne kindat then continue ; right file found filename = fileArr[i].name break endfor ; get data data = madprint(madurl, filename, 'ut1,gdalt,nel', 'filter=elm,70, ' + filterStr, $ user_fullname, user_email, user_affiliation) ; the rest of this code is a complete hack because I don't know how to create a Matlab-like ; pcolor plot - instead I'm doing a simple surface ; loop through to count the number of times - hard-code 16 altitudes sizeData = size(data) numRows = long(sizeData[2]) numTimes = 1 lastTime = data[0, 0] for i=0L, numRows-1 do begin if (lastTime lt data[0, i]) then begin lastTime = data[0, i] numTimes = numTimes + 1 endif endfor imageArr = fltarr(numTimes, 16) ; loop through again to populate imageArr timeIndex = 0 heightIndex = 0 lastTime = data[0, 0] for i=0L, numRows-1 do begin if (lastTime lt data[0, i]) then begin lastTime = data[0,i] timeIndex = timeIndex + 1 heightIndex = -1 endif heightIndex = heightIndex + 1 if heightIndex gt 15 then continue ; violates our hacky assumption if heightIndex lt 0 then continue ; violates our hacky assumption imageArr[timeIndex, heightIndex] = data[2, i] endfor ; plot imageArr surface, imageArr, min_value=9.0, max_value=13.0, $ xtitle='time index', ytitle='range index', ztitle='nel', charsize=3.0 print, 'done' end