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

Home » Public Forums » archive » Extract pixel values from HDF-EOS file
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
Extract pixel values from HDF-EOS file [message #71832] Fri, 23 July 2010 15:17 Go to next message
Snow53 is currently offline  Snow53
Messages: 32
Registered: July 2010
Member
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
Re: Extract pixel values from HDF-EOS file [message #71894 is a reply to message #71832] Mon, 26 July 2010 10:02 Go to previous message
Snow53 is currently offline  Snow53
Messages: 32
Registered: July 2010
Member
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
Re: Extract pixel values from HDF-EOS file [message #71906 is a reply to message #71832] Mon, 26 July 2010 08:16 Go to previous message
Snow53 is currently offline  Snow53
Messages: 32
Registered: July 2010
Member
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
Re: Extract pixel values from HDF-EOS file [message #71909 is a reply to message #71832] Mon, 26 July 2010 07:13 Go to previous message
Snow53 is currently offline  Snow53
Messages: 32
Registered: July 2010
Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL 8.0 questions
Next Topic: Object filenames

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

Current Time: Wed Oct 08 19:05:06 PDT 2025

Total time taken to generate the page: 0.00813 seconds