Re: SST data [message #70825] |
Tue, 11 May 2010 06:12  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Nayan Khataniar writes:
> I am trying to get sst data for an area in NW shelf of Western
> Australia. I got the images of the area and have processed them on
> ENVI. I dont have any experience with IDL programming and I have been
> reading through books to help me out but I am stuck now. I have hdf
> files for each month of the year and I would like IDL to give me plots
> of SST vs. Latitude/Longitude. Can any one please help me with it?
> Below is the program I have already started
>
> pro january2009
> hdfid=hdf_sd_start('C:\Documents and Settings\Nayan\My Documents
> \raw_data\2009\February\IMOS-20100505T144046_1851.hdf')
> ;index=hdf_sd_nametoindex(hdfid,'SST')
> varid=hdf_sd_select(hdfid,sst)
> hdf_sd_getdata,varid,data
I think you were on the right track here with
trying to get the index of the variable.
index=hdf_sd_nametoindex(hdfid,'SST')
varid=hdf_sd_select(hdfid,index)
hdf_sd_getdata,varid,data
If this *doesn't* work, it is probably because
the variable you are looking for is not spelled
as "SST". These variable names are case sensitive.
It might be helpful to browse the file first to
see what is in it. I always use my NCDF_Browser
for this purpose. You can read the variables and
other file information directly from the browser
if you want. The files you need are here:
http://www.dfanning.com/programs/ncdf_tools.zip
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: SST data [message #70826 is a reply to message #70825] |
Tue, 11 May 2010 03:44   |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On May 11, 3:29 am, Nayan Khataniar <naya...@gmail.com> wrote:
> Hi
> I am trying to get sst data for an area in NW shelf of Western
> Australia. I got the images of the area and have processed them on
> ENVI. I dont have any experience with IDL programming and I have been
> reading through books to help me out but I am stuck now. I have hdf
> files for each month of the year and I would like IDL to give me plots
> of SST vs. Latitude/Longitude. Can any one please help me with it?
> Below is the program I have already started
>
> pro january2009
> hdfid=hdf_sd_start('C:\Documents and Settings\Nayan\My Documents
> \raw_data\2009\February\IMOS-20100505T144046_1851.hdf')
> ;index=hdf_sd_nametoindex(hdfid,'SST')
> varid=hdf_sd_select(hdfid,sst)
> hdf_sd_getdata,varid,data
> hdf_sd_endacces,varid
> ;hdf_sd_end,hdfid
> ;tvcl,data
> index=hdf_sd_nametoindex(hdfid,'lon')
> varid=hdf_sd_getdata,varid,londata
> hdf_sd_endacess.varid
> hdf_sd_end,hdfid
> print,londata[0],londata[n_elements(londata)-1]
> ;tvscl,data
> tempvec=data[*,1000,1]
> tempvec=tempvec*0.01
> set_plot,'ps'
> ;device,file='C:\Documents and Settings\Nayan\My Documents\raw_data
> \2009\February\test.ps'
> plot,tempvec,yrange=[0.40],ystyle=1
> ;device,/close
> end
>
> I get an error which says 'HDF_SD_SELECT: Unable to select the HDF-SD
> dataset (HDFID).
> % Execution halted at: JANUARY2009 4 C:\Documents and Settings
> \Nayan\My Documents\raw_data\2009\January\january2009.pro'
>
> ANY HELP WILL BE APPRECIATED.
>
> CHEERS
> NAYAN
Use this widget (very easy) http://www.dfanning.com/fileio_tips/ncdf_browser.html
for reading HDF files and then read variables in deferent names and ….
Dave
|
|
|
Re: SST data [message #70912 is a reply to message #70825] |
Wed, 12 May 2010 01:48  |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On May 11, 6:12 am, David Fanning <n...@dfanning.com> wrote:
> Nayan Khataniar writes:
>> I am trying to get sst data for an area in NW shelf of Western
>> Australia. I got the images of the area and have processed them on
>> ENVI. I dont have any experience with IDL programming and I have been
>> reading through books to help me out but I am stuck now. I have hdf
>> files for each month of the year and I would like IDL to give me plots
>> of SST vs. Latitude/Longitude. Can any one please help me with it?
>> Below is the program I have already started
>
>> pro january2009
>> hdfid=hdf_sd_start('C:\Documents and Settings\Nayan\My Documents
>> \raw_data\2009\February\IMOS-20100505T144046_1851.hdf')
>> ;index=hdf_sd_nametoindex(hdfid,'SST')
>> varid=hdf_sd_select(hdfid,sst)
>> hdf_sd_getdata,varid,data
>
> I think you were on the right track here with
> trying to get the index of the variable.
>
> index=hdf_sd_nametoindex(hdfid,'SST')
> varid=hdf_sd_select(hdfid,index)
> hdf_sd_getdata,varid,data
>
> If this *doesn't* work, it is probably because
> the variable you are looking for is not spelled
> as "SST". These variable names are case sensitive.
>
> It might be helpful to browse the file first to
> see what is in it. I always use my NCDF_Browser
> for this purpose. You can read the variables and
> other file information directly from the browser
> if you want. The files you need are here:
>
> http://www.dfanning.com/programs/ncdf_tools.zip
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
@David:How could we read HDF5 data with (ncdf_tools)?
Cheers
Dave
|
|
|