[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20040224: Hyperslab I/O of Varying Size: use of IMAP argument
- Subject: 20040224: Hyperslab I/O of Varying Size: use of IMAP argument
- Date: Tue, 24 Feb 2004 11:27:48 -0700
Ben,
>Date: Tue, 24 Feb 2004 11:58:20 -0600
>From: Ben Howell <address@hidden>
>Organization: University of Wisconsin, Madison/SSEC
>To: Steve Emmerson <address@hidden>
>Subject: Re: 20040224: Hyperslab I/O of Varying Size: use of IMAP argument
> Keywords: 200402181846.i1IIkk2N001457
The above message contained the following:
> Attached is the file "GOES1993nc.cdl", written by "ncdump -h".
> The 3-d variable "data" is the source of "btemp1".
...
> netcdf GOES1993 {
> dimensions:
> lines = 250 ;
> elems = 600 ;
> bands = 1 ;
...
> variables:
> float data(bands, lines, elems) ;
> data:long_name = "data" ;
> data:type = "VISR" ;
> data:units = "degrees K" ;
> float latitude(lines, elems) ;
> latitude:long_name = "latitude" ;
> latitude:units = "degrees" ;
> float longitude(lines, elems) ;
> longitude:long_name = "longitude" ;
> longitude:units = "degrees" ;
> }
Use the following code to read the above latitudes, longitudes, and
brightness temperatures into multi-dimensional, statically-sized arrays:
parameter (maxelems=1200, maxlines=500)
real*4 btemp1(maxelems, maxlines)
real*4 slat(maxelems, maxlines)
real*4 slon(maxelems, maxlines)
integer idcdf, idlon, idlat, idbtemp
integer start(3), count(3), stride(3), imap(3)
integer idlines, idelems, nlines, nelems
...
nf_inq_dimid(idcdf, 'lines', idlines)
nf_inq_dimid(idcdf, 'elems', idelems)
nf_inq_dimlen(idcdf, idlines, nlines)
nf_inq_dimlen(idcdf, idelems, nelems)
start(1) = 1
start(2) = 1
count(1) = nelems
count(2) = nlines
stride(1) = 1
stride(2) = 1
imap(1) = 1
imap(2) = maxelems
nf_get_varm_real(idcdf, idlat, start, count, stride, imap, slat)
nf_get_varm_real(idcdf, idlon, start, count, stride, imap, slon)
start(3) = 1
count(3) = 1
stride(3) = 1
imap(3) = maxelems * maxlines
nf_get_varm_real(idcdf, idbtemp, start, count, stride, imap, btemp1)
Look this over. Contact me if you have any questions.
Regards,
Steve Emmerson