[gradsusr] fprintf for aave loop

Martin V. Mathew vmartinmathew at gmail.com
Thu Jun 7 00:42:41 EDT 2012


Hi

You could also use fprintf script available in OpenGrADS Cookbooks.

 http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file#Problem

You can use commands similar to one given below to prepare required o/p files.

--------------------------------------------------------------------
'define sstarea=aave(sst.1,lon=50,lon=78,lat=5,lat=30)'

*Write ASCII output.
'run fprintf sstarea opfilname.txt %9.4f 1 1 1'
----------------------------------------------------------------------

> Hi Roberto!
>
> You must follow these steps: http://www.iges.org/grads/gadoc/gradcomdsetfwrite.html
> and http://www.iges.org/grads/gadoc/gradcomdqfwrite.html
>
> Another option is to use the command SED
> Example:
> After the display, you keep the information in a new variable, how to:
> chv1=sublin(result, 4)
> chv1=subwrd(chv1, 1)
>
> then,   '!echo 'yy','mm','dd','hh','lon','lat','chv1' | sed s@\ @@g >> verific.dat'
> All this inside the loop.
>
> I hope this helps.
> Cheers,
>
> --
> Rafael Censi Borges
> Meteorologia - Epagri/Ciram
> +55 (48)3239-8064/8066
> http://ciram.epagri.sc.gov.br
>
>
>
> 2012/6/4 Roberto Mera <rjmera at coas.oregonstate.edu>
>>
>> Hi all,
>>
>> I'm trying to write a script to write a bunch of area average numbers to
>> a single text file for analysis with other software. The fprintf command
>> only returns one value for area average when I run my area average
>> script. Below is my area average script. How do I go about creating a
>> text file for this?
>>
>> Thanks
>>
>>
>> count = 1
>> while (count < 151)
>> 'set e 'count
>> *'set e 1 10'
>> *Cascades, Peuget north of 45N
>> *'areal=aave(maskout(pmax1,mskgrd(t=1)),x=147.934,x=194.184,y=209.807,y=246.807)'
>> *Olympic Peninsula
>> 'areal=aave(pmax1,x=154.871,x=166.434,y=228.307,y=239.869)'
>> 'fprintf areal aereal.txt'
>> 'd areal'
>> areal=subwrd(result,4)
>> say areal
>> if (rc != 0) ; break ; endif
>> count = count +1
>> *count = count +12
>> endwhile
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>



-- 
Martin V. Mathew
Research scholar
Centre for Oceans, Rivers, Atmosphere and Land Sciences (CORAL)
IIT Kharagpur
India.




More information about the gradsusr mailing list