X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Apr 2008 05:32 PM by  anon
IDL contour plot with date/time stamp
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
09 Apr 2008 05:32 PM
    Dear all, I am trying to read and make a contour (time,position,value) plot of data on a running time window of the last hour. An example of the (ascii) data file I would like to use is formatted as follows: date (yyyymmdd) time (hhmm) position (m) value 20080330 23:30 pos1 99 20080330 23:30 pos2 97 20080330 23:30 pos3 97 20080330 23:30 pos4 98 20080330 23:30 pos5 93 .... 20080330 23:40 pos1 99 20080330 23:40 pos2 93 20080330 23:40 pos3 94 20080330 23:40 pos4 97 20080330 23:40 pos5 90 .... 20080330 23:50 pos1 92 20080330 23:50 pos2 93 20080330 23:50 pos3 92 20080330 23:50 pos4 97 20080330 23:50 pos5 95 ..... 20080331 00:00 pos1 94 20080331 00:00 pos2 93 20080331 00:00 pos3 94 20080331 00:00 pos4 92 20080331 00:00 pos5 96 ..... 20080331 00:10 pos1 94 20080331 00:10 pos2 95 20080331 00:10 pos3 94 20080331 00:10 pos4 98 20080331 00:10 pos5 99 ..... 20080331 00:20 pos1 98 20080331 00:20 pos2 92 20080331 00:20 pos3 94 20080331 00:20 pos4 92 20080331 00:20 pos5 94 So, I should take care of the day transitions, and, if possible, missing data should result appear as blank in the contour plot. I looked at the TIMEGEN function, but it seems to generate a time array based on years, months, days, hours, minutes or so. Does anyone have an idea of how to construct a proper IDL routine here (for a specified number of 5 or 10 minute intervals, including day transitions)? Best regards, David

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Apr 2008 05:32 PM
    If your question is just about generating the time axis data, you have two options: 1) Just parse the date data from your ASCII file, convert the parsed data to Julian date/time data, and don't worry about setting up time intervals with TIMEGEN. Here is a parser for the date on a line with this exact format: "20080330 23:30 pos1 99" IDL> ; Put example data in a file IDL> importedDataLine = '20080330 23:30 pos1 99' IDL> openw, lun, 'trash.dat', /GET_LUN IDL> printf, lun, importedDataLine IDL> free_lun, lun IDL> ; How to read the data into IDL IDL> openr, lun, 'trash.dat', /GET_LUN IDL> yr = 0 & mo = 0 & day = 0 & hr = 0 & min = 0 IDL> posNo = 0 & posValue = 0 IDL> readf, lun, yr, mo, day, hour, min, posNo, posValue, $ IDL> FORMAT='(I4, I2, I2, X, I2, X, I2, 4X, I1, X, I2)' IDL> help, mo, day, yr, hr, min, posNo, posValue ;MO INT = 3 ;DAY INT = 30 ;YR INT = 2008 ;HR INT = 23 ;MIN INT = 30 ;POSNO INT = 1 ;POSVALUE INT = 99 IDL> print, julday(mo, day, yr, hr, min, 0) ; 2454556.5 2) If you do not want to parse every time, you can instead run a JULDAY function like the one I showed just above on the first date and time in your series, then generate, let's say, 30 days worth of time intervals of 10 minutes with code like the following: nIntervals = 6 * 24 * 30 myStartTime = julday(mo, day, yr, hr, min, 0) times = timegen(nIntervals, START=myStartTime, STEP_SIZE=10, UNITS='Minutes') print, times[0:9}, FORMAT='(D18.10)' James Jones
    You are not authorized to post a reply.