[gradsusr] Save data every 10 minutes on a text file

Jennifer Adams jma at cola.iges.org
Fri May 29 07:40:28 EDT 2015


Hi, Leopoldo — 
Here is some code to parse the output from ‘q time’

'q time'
timestring=subwrd(result,3)
ck=substr(timestring,6,1)
if (ck='Z')
* minutes are in the time string
  hh=substr(timestring,1,2)
  mm=substr(timestring,4,2)
  dd=substr(timestring,7,2)
  mon=substr(timestring,9,3)
  yyyy=substr(timestring,12,4)
else
* minutes are not in the time string
  hh=substr(timestring,1,2)
  mm=00
  dd=substr(timestring,4,2)
  mon=substr(timestring,6,3)
  yyyy=substr(timestring,9,4)
endif 
say yyyy' 'mon' 'dd' 'hh' 'mm

On May 23, 2015, at 6:00 AM, Leopoldo Alvarez <lap.bolsa at gmail.com> wrote:

> Hi Jennifer, 
> 
>  
> Thanks for your answer
> I think I messed.. now I don´t work well..
> Attached my configuration and the result
> 
> Leopoldo
> 
> - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - - -
> 'open 10M.ctl'
> 
> 'set lon  -84.926257'
> 'set lat  10.430741'
> 
> # 0.9900545 -> 80 m
> #'set lev 0.99199'
> # 0.9888191 -> 90 m
> 'set lev 0.98818'
> 
> timeend = 20
> i = 1
> while(i <= timeend)
> 'set t 'i''
> 'q time'
> timeyr = substr(result, 16, 4)
> timemo = substr(result, 13, 3)
> timedy = substr(result, 11, 2)
> timehr = substr(result, 8, 3)
> timemi = substr(result, 8, 5)
> 
> #velocidad viento
> 'tg1=mag(u,v)'
> 'd tg1'
> a.nr1 = subwrd(result,4)
> 
> val = timeyr%"-"%timemo%"-"%timedy"-"%timehr"-"%timemi" "%a.nr1
> rec = write('10M_90v.txt',val, append)
> i = i + 1
> endwhile
> - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - - -
> 
> 
> - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - - -
> 2010-JAN-01-00Z-00Z01 9.12851
> JAN2-Z01-10-00:-00:10 11.1242
> JAN2-Z01-20-00:-00:20 13.8066
> JAN2-Z01-30-00:-00:30 15.007
> JAN2-Z01-40-00:-00:40 15.7414
> JAN2-Z01-50-00:-00:50 16.2283
> 2010-JAN-01-01Z-01Z01 17.4028
> JAN2-Z01-10-01:-01:10 18.1816
> JAN2-Z01-20-01:-01:20 19.0074
> JAN2-Z01-30-01:-01:30 20.133
> JAN2-Z01-40-01:-01:40 20.5452
> JAN2-Z01-50-01:-01:50 20.6561
> 2010-JAN-01-02Z-02Z01 20.4902
> JAN2-Z01-10-02:-02:10 19.8622
> JAN2-Z01-20-02:-02:20 19.2732
> JAN2-Z01-30-02:-02:30 18.8075
> JAN2-Z01-40-02:-02:40 18.5281
> JAN2-Z01-50-02:-02:50 18.3364
> 2010-JAN-01-03Z-03Z01 18.2838
> JAN2-Z01-10-03:-03:10 18.353
> - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - - -
> 
> 
> 
> 
> El 22/5/15 a las 17:05, Leopoldo Alvarez escribió:
>> 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/20150529/bbb7d0dc/attachment.html 


More information about the gradsusr mailing list