On Jul 26, 9:16 am, Snow53 <jennifer_wa...@hotmail.com> wrote:
> On Jul 26, 8:13 am, Snow53 <jennifer_wa...@hotmail.com> wrote:
>
>
>
>
>
>> On Jul 23, 4:17 pm, Snow53 <jennifer_wa...@hotmail.com> wrote:
>
>>> Hello all. I'm now trying to work with HDF-EOS files. I've been using
>>> the IDL guide as a reference in trying to make this work. My data are
>>> associated with lat, long coordinates. These data originated from
>>> MODIS swath files (HDF4), but were converted to lat/long gridded HDF-
>>> EOS using ModisTool. In reading the IDL guide, it looks like I need to
>>> define the grid system for my file, attatch the grid to my file, and
>>> then I can use EOS_GD_GETPIXVALUES (?) to extract pixel data. I've
>>> tried to set this project up as follows; currently I'm getting stuck
>>> at EOS_GD_CREATE (apparently I haven't created the grid properly).
>>> Would anyone be willing to do a quick read-through and throw out
>>> thoughts or suggestions?
>
>>> Thanks!
>
>>> pro hdftest1
>
>>> ; open and extract data from MODIS HDF-EOS file
>>> path = 'X:\MODIS_GPP\Lena\2003\test\'
>
>>> file_array=file_search(path, '*.hdf', count=num_file)
>>> file=file_array
>
>>> print, num_file
>>> ;print, file
>
>>> for i=0, num_file-1 do begin
>>> file_name=file_basename(file[i], '.hdf')
>>> ;print, file_name
>
>>> fid=EOS_GD_OPEN(file[i], /READ)
>
>>> upx=172.763114356
>>> upy=79.9999999993
>>> lrx=116.952175961
>>> lry=69.99999994
>>> ydim=1110
>>> xdim=10239
>
>>> gridname='geo'
>>> gridID=EOS_GD_CREATE ( fid, gridname, xdim, ydim, [upx, upy], [lrx,
>>> lry]) ; this part isn't working. need to fix. failed .
>>> print, gridID
>
>>> ;gridname=EOS_GD_INQGRID(file[i], gridlist)
>>> ;print, gridlist
>
>>> out=EOS_GD_ATTACH(fid, gridname)
>>> print, out
>
>>> pixCol=[2,2]
>>> pixRow=[2,2]
>
>>> result=EOS_GD_GETPIXVALUES (out, 1, pixCol, pixRow,'Gpp_1km', buffer)
>>> print, result
>
>>> print, buffer
>
>>> status=EOS_GD_CLOSE(fid)
>>> endfor
>>> end
>
>> Still trying to get the EOS_GD_CREATE to work. I've attempted to
>> change the format to the following, but still no luck.
>> fid=EOS_GD_OPEN(file[i], /RDWR)
>> ;print, fid
>
>> upl=dblarr(87.74131944, 80)
>
>> lowr=dblarr(179.957375, 70)
>
>> ydim=1110
>> xdim=10239
>
>> gridname='geo'
>> gridID=EOS_GD_CREATE( fid, gridname, xdim, ydim, upl, lowr) ; this
>> part isn't working. need to fix. failed .
>> print, gridID- Hide quoted text -
>
>> - Show quoted text -
>
> Ok, got that part working. Now trying to figure out why this attach
> grid won't work.
>
> pro hdftest1
>
> ; open and extract data from MODIS HDF-EOS file
> path = 'X:\MODIS_GPP\Lena\2003\test\'
>
> file_array=file_search(path, '*.hdf', count=num_file)
> file=file_array
>
> print, num_file
> ;print, file
>
> for i=0, num_file-1 do begin
> file_name=file_basename(file[i], '.hdf')
> ;print, file_name
>
> fid=EOS_GD_OPEN(file[i], /READ)
> print, fid
> ffid=fid
> upl=[87.74131944, 80]
>
> lowr=[179.957375, 70]
>
> ydim=1110
> xdim=10239
>
> gridname='geo'
> gridID=EOS_GD_CREATE(ffid, gridname, xdim, ydim, upl, lowr)
> print, gridID
>
> out=EOS_GD_ATTACH(ffid, gridname)
> print, ffid
> print, gridname- Hide quoted text -
>
> - Show quoted text -
All is happy now :).
pro hdftest1
; open and extract data from MODIS HDF-EOS file
path = 'X:\MODIS_GPP\Lena\2003\test\'
file_array=file_search(path, '*.hdf', count=num_file)
file=file_array
print, num_file
;print, file
for i=0, num_file-1 do begin
file_name=file_basename(file[i], '.hdf')
;print, file_name
fid=EOS_GD_OPEN(file[i], /READ)
print, fid
result=EOS_GD_INQGRID(file[i], gridlist)
;print, gridlist
gridname=gridlist
print, gridname
out=EOS_GD_ATTACH(fid, gridname)
print, fid
print, gridname
upl=[87.74131944, 80]
lowr=[179.957375, 70]
ydim=1110
xdim=10239
pixCol=[2]
pixRow=[2]
result=EOS_GD_GETPIXVALUES(out, 1, pixCol, pixRow,'Gpp_1km', buffer)
print, result
print, buffer
output=EOS_GD_DETACH(gridname)
status=EOS_GD_CLOSE(fid)
endfor
end
|