comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Reading GrADS data file in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Reading GrADS data file in IDL [message #23381] Wed, 24 January 2001 12:10 Go to next message
Kyong Hwan Seo is currently offline  Kyong Hwan Seo
Messages: 3
Registered: October 1999
Junior Member
Hi everybody,

I have a GrADS data file and control file.
Is there any easy way to read the data file in IDL.
If you have a program for this, could you please help me.
Thanks,

Seo
--
Kyong Seo
Florida State University Home :(850) 216-1985
Dept. of Meteorology Office:(850) 644-2274
Email: khseo@pacific.met.tamu.edu Fax :(850) 644-9642
Re: Reading GrADS data file in IDL [message #23489 is a reply to message #23381] Thu, 25 January 2001 19:36 Go to previous messageGo to next message
Kyong Hwan Seo is currently offline  Kyong Hwan Seo
Messages: 3
Registered: October 1999
Junior Member
msienkiewicz@my-deja.com wrote:

>
> The basic GrADS file format is very simple. The data are stored as
> a sequence of unformatted floating point arrays. If your '.ctl' file does
> not have any special options specified (i.e. 'options sequential',
> 'options byteswapped', 'options bigendian' or the like) and you are
> planning to read it on a computer that has the same 'endianness'
> as the computer that generated it - well you can just use the ASSOC
> command and access those arrays directly from the disk. To advise
> further, we'd need to have a look at your .ctl file.
>

>
> Meta
>

Thanks, Meta

I believe the ctl file is pretty much usual one.
Could you show me one example of using ASSOC command(function) for my
case.

Thanks again,

Seo

(Note that the z dimensions for variables are different (16 or 10).)
Below is the ctl file:


DSET csf_rNCEP_flux.data
undef -9999.
TITLE CSEOFs of NCEP reanalysis
* ------------------------------------------------------------ ------
XDEF 47 LINEAR 45.0 5.0
*
YDEF 47 LINEAR -57.5 2.5
*
ZDEF 16 LEVELS 925 850 700 600 500 400 300 250 200 150 100 70 50 30 20
10
*
TDEF 96 LINEAR Jan1958 1mo
*
vars 33
xubup 16 35,100,0 ** x1
xupup 16 35,100,0 ** x2
xvbup 16 35,100,0 ** x3
xvpub 16 35,100,0 ** x4
xvpup 16 35,100,0 ** x5
xwbup 10 35,100,0 ** x6
xwpub 10 35,100,0 ** x7
xwpup 10 35,100,0 ** x8
xtbup 16 35,100,0 ** x9
xtpub 16 35,100,0 ** x10
xtpup 16 35,100,0 ** x11
yubvp 16 35,100,0 ** y1
yupvb 16 35,100,0 ** y2
yupvp 16 35,100,0 ** y3
yvbvp 16 35,100,0 ** y4
yvpvp 16 35,100,0 ** y5
ywbvp 10 35,100,0 ** y6
ywpvb 10 35,100,0 ** y7
ywpvp 10 35,100,0 ** y8
ytbvp 16 35,100,0 ** y9
ytpvb 16 35,100,0 ** y10
ytpvp 16 35,100,0 ** y11
zubwp 10 35,100,0 ** z1
zupwb 10 35,100,0 ** z2
zupwp 10 35,100,0 ** z3
zvbwp 10 35,100,0 ** z4
zvpwb 10 35,100,0 ** z5
zvpwp 10 35,100,0 ** z6
zwbwp 10 35,100,0 ** z7
zwpwp 10 35,100,0 ** z8
ztbwp 10 35,100,0 ** z9
ztpwb 10 35,100,0 ** z10
ztpwp 10 35,100,0 ** z11
ENDVARS



--
Kyong Hwan Seo
Florida State University Home :(850) 216-1985
Dept. of Meteorology Office:(850) 644-2274
Email: khseo@pacific.met.tamu.edu Fax :(850) 644-9642
Re: Reading GrADS data file in IDL [message #23496 is a reply to message #23381] Thu, 25 January 2001 16:01 Go to previous messageGo to next message
msienkiewicz is currently offline  msienkiewicz
Messages: 8
Registered: October 2000
Junior Member
In article <3A6F36B2.F192F8CE@pacific.met.fsu.edu>,
Kyong Hwan Seo <khseo@pacific.met.fsu.edu> wrote:
> Hi everybody,
>
> I have a GrADS data file and control file.
> Is there any easy way to read the data file in IDL.
> If you have a program for this, could you please help me.
> Thanks,
>
> Seo

The basic GrADS file format is very simple. The data are stored as
a sequence of unformatted floating point arrays. If your '.ctl' file does
not have any special options specified (i.e. 'options sequential',
'options byteswapped', 'options bigendian' or the like) and you are
planning to read it on a computer that has the same 'endianness'
as the computer that generated it - well you can just use the ASSOC
command and access those arrays directly from the disk. To advise
further, we'd need to have a look at your .ctl file.

The GrADS file format is explained in the program manual, you can get
a copy at http://dao.gsfc.nasa.gov/grads_listserv/gadoc151.pdf

Meta


Sent via Deja.com
http://www.deja.com/
Re: Reading GrADS data file in IDL [message #23600 is a reply to message #23489] Mon, 29 January 2001 11:32 Go to previous message
msienkiewicz is currently offline  msienkiewicz
Messages: 8
Registered: October 2000
Junior Member
In article <3A70F0A5.575F123@pacific.met.fsu.edu>,
Kyong Hwan Seo <khseo@pacific.met.fsu.edu> wrote:
> msienkiewicz@my-deja.com wrote:
>
>>
>> The basic GrADS file format is very simple. The data are stored as
>> a sequence of unformatted floating point arrays. If your '.ctl'
file does
>> not have any special options specified (i.e. 'options sequential',
>> 'options byteswapped', 'options bigendian' or the like) and you are
>> planning to read it on a computer that has the same 'endianness'
>> as the computer that generated it - well you can just use the ASSOC
>> command and access those arrays directly from the disk. To advise
>> further, we'd need to have a look at your .ctl file.
>>
>
>>
>> Meta
>>
>
> Thanks, Meta
>
> I believe the ctl file is pretty much usual one.
> Could you show me one example of using ASSOC command(function) for my
> case.
>
> Thanks again,
>
> Seo
>
> (Note that the z dimensions for variables are different (16 or 10).)
> Below is the ctl file:
>
> DSET csf_rNCEP_flux.data
> undef -9999.
> TITLE CSEOFs of NCEP reanalysis
> * ------------------------------------------------------------ ------
> XDEF 47 LINEAR 45.0 5.0
> *
> YDEF 47 LINEAR -57.5 2.5
> *
> ZDEF 16 LEVELS 925 850 700 600 500 400 300 250 200 150 100 70 50 30 20
> 10
> *
> TDEF 96 LINEAR Jan1958 1mo
> *
> vars 33
> xubup 16 35,100,0 ** x1
> xupup 16 35,100,0 ** x2
> xvbup 16 35,100,0 ** x3
> xvpub 16 35,100,0 ** x4
> xvpup 16 35,100,0 ** x5
> xwbup 10 35,100,0 ** x6
> xwpub 10 35,100,0 ** x7
> xwpup 10 35,100,0 ** x8
> xtbup 16 35,100,0 ** x9
> xtpub 16 35,100,0 ** x10
> xtpup 16 35,100,0 ** x11
> yubvp 16 35,100,0 ** y1
> yupvb 16 35,100,0 ** y2
> yupvp 16 35,100,0 ** y3
> yvbvp 16 35,100,0 ** y4
> yvpvp 16 35,100,0 ** y5
> ywbvp 10 35,100,0 ** y6
> ywpvb 10 35,100,0 ** y7
> ywpvp 10 35,100,0 ** y8
> ytbvp 16 35,100,0 ** y9
> ytpvb 16 35,100,0 ** y10
> ytpvp 16 35,100,0 ** y11
> zubwp 10 35,100,0 ** z1
> zupwb 10 35,100,0 ** z2
> zupwp 10 35,100,0 ** z3
> zvbwp 10 35,100,0 ** z4
> zvpwb 10 35,100,0 ** z5
> zvpwp 10 35,100,0 ** z6
> zwbwp 10 35,100,0 ** z7
> zwpwp 10 35,100,0 ** z8
> ztbwp 10 35,100,0 ** z9
> ztpwb 10 35,100,0 ** z10
> ztpwp 10 35,100,0 ** z11
> ENDVARS
>
> --
> Kyong Hwan Seo
> Florida State University Home :(850) 216-1985
> Dept. of Meteorology Office:(850) 644-2274
> Email: khseo@pacific.met.tamu.edu Fax :(850) 644-9642
>
I'm assuming still that this is a regular GrADS file with unformatted
binary arrays. (I'm not familiar with the "35,100,0" notation in
the third column... so I could be missing something here.)

The control file says that you have a number of arrays
dimensioned 47 x 47 saved in the file. In the GrADS format all
the vertical levels for a single variable at a given time are
stored consecutively. The first sixteen arrays should be the 16
levels of your variable 'xubup', the next 16 are 'xupup', etc.

What I would try then is something like this:

; Open the file as unit 1
;
open,1,'csf_rNCEP_flux.data'
;
; Make an associated variable
;
arr = assoc(1,fltarr(47,47))
;
; Draw a contour plot of the first variable at the first level
;
contour, arr(0)
;
; Try reading in the 47x47x10 array 'xwpub'
;
skip = 5*16+10
xwpub = fltarr(47,47,10)
for j=0,9 do xwpub(*,*,j) = arr(skip+j)
;
; try reading the 47x47x10 array 'xwpub' at time 5
; "skipt" is the number of grids at a single time period to skip over
skipt = 16*16 + 17*10
for j = 0,9 do xwpub(*,*,j) = arr(5*skipt+skip+j)

... or something like that anyway. It's what I would try first,
anyway. Hope this helps.

Meta


Sent via Deja.com
http://www.deja.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: HELP: Linux can't run IDL_LMGRD
Next Topic: Re: Formatting output

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:04:53 PDT 2025

Total time taken to generate the page: 0.00858 seconds