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

Leopoldo Alvarez lap.bolsa at gmail.com
Fri May 29 11:40:25 EDT 2015


Hi Jennifer,

I'm doing  some checking,  but I think there  went well.
It seems that  the solution  was not  trivial  for me,  thank you.

Leopoldo


- - - - - - - - - -
- - - - - - - - - -


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  <http://gradsusr.org/mailman/listinfo/gradsusr>> wrote:



El 23/5/15 a las 11:00, Leopoldo Alvarez escribió:
> 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 MM5model 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
>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150529/7d6edc5b/attachment-0001.html 


More information about the gradsusr mailing list