[gradsusr] using fwrite

krishnamohan krishmet at gmail.com
Thu Jun 17 00:45:22 EDT 2010


Hai  Alauda,

              If you are using grads version 2 or above, then you can use
sdfwrtie command for writing output. Then grads will write output on netcdf
file so that you dont have to bother about the ctl file. A sample gs file is
attached with this mail.

KrishnaMohan

-- 
Krishnamohan.K.S
Junior Research Fellow
Department Of Atmospheric Sciences
Cochin University of Science and Technology
Cochin,India


On Thu, Jun 17, 2010 at 3:39 AM, Alauda arvensis <a.arvensis at gmail.com>wrote:

> Dear GrADS users,
>
> I wish to open a GrADS file (test.ctl) and save one variable to a different
> file (out4.ctl).  For this purpose I type the following:
>
>
> open test.ctl
>
> set fwrite out4.dat
>
> set gxout fwrite
> d var130
>
> I now have a binary file called "out4.dat" which contains my variable
> "var130". To open it in GrADS I need to create the respective .ctl-file. I
> copy it from test.ctl and make a few changes (see both test.ctl and out4.ctl
> below). I can open "out4" in GrADS and display "var130". Unfortunately the
> data does not display correctly: all longitude values are displayed
> correctly but all latitude values are upside down, comparible to the effect
> of a mirrow.
>
> My questions:
>
>
> (1) Why is my data not displaying correctly and what do I need to do to fix
> this?
>
> (2) Is it possible to save more than 1 variable in a binary file? I tried
> this by applying the steps above and typing after "d var130" also "d
> var157". I then apply the respective changes in the .ctl-file (i.e. VARS 2
> and var157 14 157,100 var157). However, I can only display "var130" and not
> "var157".
> (3) Is this methodology (fwrite) the best way to save changes after the
> manipulation of a GrADS file?
>
>
> Thank you very much in advance.
>
>
>
> With kind regards,
>
> Chris
>
> ###################################
> test.ctl
>
>
> * Generated by CDO version 1.4.0
>
> *
>
> DSET ^test.grb
>
> DTYPE GRIB
>
> INDEX ^test.gmp
>
> XDEF 55 LINEAR 270.000000 1.125000
>
> YDEF 47 LEVELS -40.934 -39.813 -38.691 -37.570 -36.448 -35.327
>
> -34.205 -33.084 -31.962 -30.841 -29.719 -28.598
>
> -27.476 -26.355 -25.234 -24.112 -22.991 -21.869
>
> -20.748 -19.626 -18.505 -17.383 -16.262 -15.140
>
> -14.019 -12.897 -11.776 -10.654 -9.533 -8.411
>
> -7.290 -6.168 -5.047 -3.925 -2.804 -1.682
>
> -0.561 0.561 1.682 2.804 3.925 5.047
>
> 6.168 7.290 8.411 9.533 10.654
>
> ZDEF 14 LEVELS 1000 925 850 700 500 400 300 250 200 150
>
> 100 70 50 30
>
> TDEF 4 LINEAR 00:00Z01jan1960 1dy
>
> TITLE test.grb T31 grid
>
> OPTIONS yrev
>
> UNDEF -9e+33
>
> VARS 5
>
> var130 14 130,100 var130
>
> var157 14 157,100 var157
>
> var129 14 129,100 var129
>
> var131 14 131,100 var131
>
> var132 14 132,100 var132
> ENDVARS
>
> ###################################
>
> out4.ctl
>
>
> * Generated by CDO version 1.4.0
>
> *
>
> DSET ^out4.dat
>
> XDEF 55 LINEAR 270.000000 1.125000
>
> YDEF 47 LEVELS -40.934 -39.813 -38.691 -37.570 -36.448 -35.327
>
> -34.205 -33.084 -31.962 -30.841 -29.719 -28.598
>
> -27.476 -26.355 -25.234 -24.112 -22.991 -21.869
>
> -20.748 -19.626 -18.505 -17.383 -16.262 -15.140
>
> -14.019 -12.897 -11.776 -10.654 -9.533 -8.411
>
> -7.290 -6.168 -5.047 -3.925 -2.804 -1.682
>
> -0.561 0.561 1.682 2.804 3.925 5.047
>
> 6.168 7.290 8.411 9.533 10.654
>
> ZDEF 14 LEVELS 1000 925 850 700 500 400 300 250 200 150
>
> 100 70 50 30
>
> TDEF 4 LINEAR 00:00Z01jan1960 1dy
>
> TITLE out4.dat
>
> OPTIONS yrev
>
> UNDEF -9e+33
>
> VARS 1
>
> var130 14 130,100 var130
>
> ENDVARS
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100617/fdf39d61/attachment-0003.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: netcdfoutput.gs
Type: application/octet-stream
Size: 172 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20100617/fdf39d61/attachment-0003.obj 


More information about the gradsusr mailing list