[gradsusr] Save data every 10 minutes on a text file
Jennifer Adams
jma at cola.iges.org
Fri May 22 12:27:05 EDT 2015
Hi, Leopoldo —
The result returned by ‘set t ’ does not include the minutes. You have to use ‘q time’ to get the minutes. Furthermore, GrADS will only show the minutes in the ‘q time’ output if it the minute value is something other than 00.
I created a fake data set with a tdef like this: TDEF 60 linear 1jan2000 10mn
ga-> open foo.ctl
Scanning description file: foo.ctl
Data file foo.dat is open as file 1
LON set to 1 1
LAT set to 1 1
LEV set to 1 1
Time values set: 2000:1:1:0 2000:1:1:0
E set to 1 1
ga-> q time
Time = 00Z01JAN2000 to 00Z01JAN2000 Sat to Sat
ga-> set t 2
Time values set: 2000:1:1:0 2000:1:1:0
ga-> q time
Time = 00:10Z01JAN2000 to 00:10Z01JAN2000 Sat to Sat
ga-> set t 6
Time values set: 2000:1:1:0 2000:1:1:0
ga-> q time
Time = 00:50Z01JAN2000 to 00:50Z01JAN2000 Sat to Sat
ga-> set t 7
Time values set: 2000:1:1:1 2000:1:1:1
ga-> q time
Time = 01Z01JAN2000 to 01Z01JAN2000 Sat to Sat
So, when parsing the output from ‘q time’, first thing to do is search for the “Z”, then get the substring of all characters preceding the Z. If the length is 2, then you have only an hour value and you assign minutes to be 00. If the length is 5, then you parse the hour and the minutes value. After the “Z”, it is straightforward to get the day, month, and year.
—Jennifer
On May 22, 2015, at 12:05 PM, Leopoldo Alvarez <lap.bolsa at gmail.com> wrote:
> Hi GrADS user,
>
> I use GrADS 2.0.2 version.
> I am using the MM5 model output and I have every 10 minutes outputs data...
> Can i save data every 10 minutes in text file?.. in my script I could only save the hourly data..
> I am using this script to create a text file with the data ->
>
> ***************
> ***************
> 'set lon -100.1829'
> 'set lat 54.6518'
> 'set lev 0.99199'
>
> timeend = 5000
> i = 1
> while(i <= timeend)
> 'set t 'i''
> 'q time'
> timehr = substr(result, 8, 3)
> timedy = substr(result, 11, 2)
> timemo = substr(result, 13, 3)
> timeyr = substr(result, 16, 4)
>
> #velocidad viento
> 'tg1=mag(u,v)'
> 'd tg1'
> a.nr1 = subwrd(result,4)
>
> val = timeyr%"-"%timemo%"-"%timedy"-"%timehr" "%a.nr1
> rec = write('sequoya_80v.txt',val, append)
> i = i + 1
> endwhile
> *******************
> *******************
>
> Thanks,
>
> Leopoldo ÁLVAREZ
> Tenerife - Canary Islands
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
--
Jennifer M. Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
111 Research Hall, Mail Stop 2B3
George Mason University
4400 University Drive
Fairfax, VA 22030
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150522/bc6b072d/attachment.html
More information about the gradsusr
mailing list