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

Home » Public Forums » archive » supressing messages
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: supressing messages [message #16421 is a reply to message #16334] Wed, 21 July 1999 00:00 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Mark Rehbein wrote:
> I use IDL5.2 on Solaris2.6 Sun machine.
> My program uses the HDF file routines including HDF_SD_ATTRFIND.
>
> usage: attribute_index=HDF_SD_ATTRFIND(SDS_ID, 'attribute_name')
>
> if the specified attribute is not found then -1 is returned....fair
> enough
>
> If I call the HDF_SD_ATTRFIND and the attribute is not found I get -1
> returned but also a message is directed to the screen which says
>
> "%HDF_SD_ATTRFIND: Unable to find the HDF-SD attribute."
>
> I want to suppress this message so that it doesn't appear on my screen.
>
> I've looked through my manuals and the tips at dfanning.com but couldn't
> find and reference to this sort of thing.

To get around this problem, you should first scan the SDS to see what
attribute names are available. Let's say you want to get the attribute
'scale_factor' if it exists:

;---cut here---

;- Get the number of attributes

hdf_sd_getinfo, sds_id, natt=natt

;- Get the name of each attribute

if natt gt 0 then begin
att_names = strarr(natt)
for i = 0, natt - 1 do begin
hdf_sd_attrinfo, sds_id, i, name=name
att_names[i] = name
endfor
endif

;- If the requested attribute was found, get it's value

requested_name = 'scale_factor'
if natt gt 0 then begin
index = where(att_names eq requested_name, count)
if count gt 0 then begin
att_id = hdf_sd_attrfind(sds_id, requested_name)
hdf_sd_attrinfo, sds_id, att_id, data=requested_value
endif
endif
if n_elements(requested_value) gt 0 then begin
help, requested_value
print, requested_value
endif

;---cut here---

This method is used in my general purpose HDF SDS reader procedure
SDS_READ, which is available at
http://cimss.ssec.wisc.edu/~gumley/sds_read.html

Cheers,
Liam.

--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Line thickness & Z-buffer
Next Topic: How can I change GUI background?

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

Current Time: Wed Oct 08 17:28:02 PDT 2025

Total time taken to generate the page: 0.00462 seconds