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

Home » Public Forums » archive » Re: frustrated by hdf_sd_adddata
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
Re: frustrated by hdf_sd_adddata [message #24182] Thu, 15 March 2001 10:52 Go to next message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
George McCabe wrote:
> attempting to replace a subset of existing data in an HDF SD, using
> idl procedure hdf_sd_adddata, receive the following error which i can
> not readily diagnose -
> % HDF_SD_ADDDATA: Unable to write the specified HDF-SD slice.
>
> hdf opens, sd starts /RDWR ok, sd selected ok
> i have veryfied the size and order of the data variable, count and
> start keyword variables.

George,

Does the following example work on your system?

hdfid = hdf_sd_start('test.hdf')
varid = hdf_sd_create(hdfid, 'data', [256, 256], /float)
hdf_sd_adddata, varid, dist(256)
hdf_sd_endaccess, varid
hdf_sd_end, hdfid

If it does, the HDF interface on you platform is working. You might be
having a problem with the definition of the START and COUNT keywords.
The following is from the IDL 5.3 online documentation:

---begin quote---
START

Set this keyword to a vector that contains the starting position for the
data. The default position is [0, 0, ..., 0].

COUNT

Set this keyword to a vector of counts (i.e., the number of items) to be
written in each dimension. The default is to write all available data.

STRIDE

Set this keyword to a vector that contains the strides, or sampling
intervals, between accessed values of the NetCDF variable. The default
stride vector is that for a contiguous write: [0, 0, ..., 0].
---end quote---

I'd try and reduce the code to the smallest number of lines which
reproduces the error. This process often makes the source of the error
obvious.

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
Re: frustrated by hdf_sd_adddata [message #24186 is a reply to message #24182] Thu, 15 March 2001 11:42 Go to previous messageGo to next message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
George McCabe wrote:
>
> this is the microsoft service model right? software modules that fail
> require system restart.
>
> sorry to be negative

I am really happy that at least there is *something* that helps. We
today take a working computer/software for granted. Given how complex
the processors, OSs and applications are these days, I am glad and
surprised they work at all. And a restart takes just a few seconds. What
are we complaining about? Our cars stall and need restarts, they break
and require engine rebuilds, and we don't demand perpetual engines for them.

Pavel
Re: frustrated by hdf_sd_adddata [message #24187 is a reply to message #24182] Thu, 15 March 2001 10:15 Go to previous messageGo to next message
George McCabe is currently offline  George McCabe
Messages: 23
Registered: June 1997
Junior Member
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
yah david,
<p>this is the microsoft service model right? software modules that fail
require system restart.
<p>sorry to be negative. your point is well taken. practically speaking
restarting the idl session sure does fix a lot of problems during development.
<p>thanks everyone for the comments,
<p>george
<br>&nbsp;
<p>David Fanning wrote:
<blockquote TYPE=CITE>Pavel A. Romashkin (pavel.romashkin@noaa.gov) writes:
<p>> They recommend to always try to reproduce a problem after a complete
IDL restart.
<p>They don't just recommend it. If they are any good they
<br>require it. When I was a technical support engineer we
<br>found that 80% of the calls could be solved just by this
<br>one simple procedure.
<p>But I find I still forget to use it 75% of the time when
<br>I'm trying to figure out my own stupid mistakes. :-(
<p>Cheers,
<p>David
<p>--
<br>David Fanning, Ph.D.
<br>Fanning Software Consulting
<br>Phone: 970-221-0438 E-Mail: davidf@dfanning.com
<br>Coyote's Guide to IDL Programming: <a href="http://www.dfanning.com/">http://www.dfanning.com/</a>
<br>Toll-Free IDL Book Orders: 1-888-461-0155</blockquote>

<pre>--&nbsp;
George McCabe (CUofA)
NASA / Goddard Space Flight Center / Code 693&nbsp;
Building 2, Room 151 / Greenbelt, MD 20771
voice: (301)286-8283, fax: (301)286-0212
george.mccabe@gsfc.nasa.gov</pre>
&nbsp;</html>
Re: frustrated by hdf_sd_adddata [message #24196 is a reply to message #24182] Thu, 15 March 2001 10:57 Go to previous messageGo to next message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
One other thought.

IDL may become confused if you open the same HDF file (even for
read-only) multiple times without closing it. This often happens when
you have a procedure which opens the HDF file at the beginning and
closes it at the end, but is crashing somewhere in the middle. As you
edit and recompile the procedure, the net result is that the file gets
opened multiple times without ever being closed.

Cheers,
Liam.
Re: frustrated by hdf_sd_adddata [message #24198 is a reply to message #24186] Thu, 15 March 2001 15:47 Go to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
"Pavel A. Romashkin" wrote:
>
> George McCabe wrote:
>>
>> this is the microsoft service model right? software modules that fail
>> require system restart.
>>
>> sorry to be negative
>
> I am really happy that at least there is *something* that helps. We
> today take a working computer/software for granted. Given how complex
> the processors, OSs and applications are these days, I am glad and
> surprised they work at all. And a restart takes just a few seconds. What
> are we complaining about? Our cars stall and need restarts, they break
> and require engine rebuilds, and we don't demand perpetual engines for them.

vodka% uptime
6:41pm up 138 days, 21:02, 3 users, load average: 0.02, 0.09, 0.05

Unless you do weird hardware things to it, Linux *never* crashes. It's
frightening what a little protected memory can do for you.

;)

jd
Re: frustrated by hdf_sd_adddata [message #24199 is a reply to message #24187] Thu, 15 March 2001 11:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel A. Romashkin (pavel.romashkin@noaa.gov) writes:

> They recommend to always try to reproduce a problem after a complete IDL restart.

They don't just recommend it. If they are any good they
require it. When I was a technical support engineer we
found that 80% of the calls could be solved just by this
one simple procedure.

But I find I still forget to use it 75% of the time when
I'm trying to figure out my own stupid mistakes. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: frustrated by hdf_sd_adddata [message #24200 is a reply to message #24187] Thu, 15 March 2001 08:18 Go to previous message
George McCabe is currently offline  George McCabe
Messages: 23
Registered: June 1997
Junior Member
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
james,
<p>thanks for you many suggestions.
<p>can you tell me what do you mean by 'corrupt'. though i think that i
understand the use of idl's hdf procedures, my general experience is limited.
i am curious about occurances of hdf file corruption.
<p>this discussion is perhaps no longer relevant to my particular problem+solution.
today, under a new idl session writing data to the same HDF&nbsp;file with
the same code it works, so i am wondering about software interface errors,
buffer problems, etc. maybe i'll just pretend it never happened.
<p>thank you again,
<br>george
<br>&nbsp;
<p>James Kuyper wrote:
<blockquote TYPE=CITE>George McCabe wrote:
<br>>
<br>> hello,
<br>>
<br>> attempting to replace a subset of existing data in an HDF SD, using
<br>> idl procedure hdf_sd_adddata, receive the following error which i
can
<br>> not readily diagnose -
<br>> % HDF_SD_ADDDATA: Unable to write the specified HDF-SD slice.
<br>>
<br>> hdf opens, sd starts /RDWR ok, sd selected ok
<br>> i have veryfied the size and order of the data variable, count and
<br>> start keyword variables.
<br>>
<br>> help is appreciated,
<br>> george
<p>Some things to check:
<p>You might not have access. What are the file permissions, owner, and
<br>group membership?
<p>The file may be corrupt. Can you view the HDF file with ncdump, or
<br>similar utilities? Can you open it read-only, and view its contents
<br>using HDF_SD_GETDATA?
<p>Is this new code, or code that has already worked on a different file,
<br>but is failing with this one?
<p>You imply that you've already collected the following information, and
<br>that it checked out OK, but maybe you've misinterpreted it - could
you
<br>tell us:
<p>What values does HDF_SD_GETINFO give you for DIMS, HDF_TYPE, and TYPE?
<p>What values are you giving HDF_SD_ADDDATA for START, COUNT, and STRIDE?
<p>What do you get when you type
<p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; HELP,mydata
<p>where 'mydata' represents the name of the field you're passing as the
<br>data argument to HDF_SD_ADDDATA?</blockquote>

<pre>--&nbsp;
George McCabe (CUofA)
NASA / Goddard Space Flight Center / Code 693&nbsp;
Building 2, Room 151 / Greenbelt, MD 20771
voice: (301)286-8283, fax: (301)286-0212
george.mccabe@gsfc.nasa.gov</pre>
&nbsp;</html>
Re: frustrated by hdf_sd_adddata [message #24207 is a reply to message #24200] Thu, 15 March 2001 10:30 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
George McCabe wrote:

> today, under a new idl session writing data to the
> same HDF file with the same code it works

They recommend to always try to reproduce a problem after a complete IDL restart.

Cheers,
Pavel
Re: frustrated by hdf_sd_adddata [message #24209 is a reply to message #24200] Thu, 15 March 2001 06:13 Go to previous message
George McCabe is currently offline  George McCabe
Messages: 23
Registered: June 1997
Junior Member
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
i checked that david. without write permission i would not be able to hdf_sd_start
as in the following,
<p>IDL> sd_id=HDF_SD_START(f,/RDWR)
<br>% HDF_SD_START: Unable to start the HDF-SD interface.
<p>which i am able to do.
<p>thank you,
<br>george
<p>David Fanning wrote:
<blockquote TYPE=CITE>George McCabe (george.mccabe@gsfc.nasa.gov) writes:
<p>> attempting to replace a subset of existing data in an HDF SD, using
idl
<br>> procedure hdf_sd_adddata, receive the following error which i can
not
<br>> readily diagnose -
<br>> % HDF_SD_ADDDATA: Unable to write the specified HDF-SD slice.
<br>>
<br>> hdf opens, sd starts /RDWR ok, sd selected ok
<br>> i have veryfied the size and order of the data variable, count and
start
<br>> keyword variables.
<br>>
<br>> help is appreciated,
<p>No file writing permissions?
<p>Cheers,
<p>David
<br>--
<br>David Fanning, Ph.D.
<br>Fanning Software Consulting
<br>Phone: 970-221-0438 E-Mail: davidf@dfanning.com
<br>Coyote's Guide to IDL Programming: <a href="http://www.dfanning.com/">http://www.dfanning.com/</a>
<br>Toll-Free IDL Book Orders: 1-888-461-0155</blockquote>

<pre>--&nbsp;
George McCabe (CUofA)
NASA / Goddard Space Flight Center / Code 693&nbsp;
Building 2, Room 151 / Greenbelt, MD 20771
voice: (301)286-8283, fax: (301)286-0212
george.mccabe@gsfc.nasa.gov</pre>
&nbsp;</html>
Re: frustrated by hdf_sd_adddata [message #24210 is a reply to message #24209] Thu, 15 March 2001 07:50 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
George McCabe wrote:
>
> hello,
>
> attempting to replace a subset of existing data in an HDF SD, using
> idl procedure hdf_sd_adddata, receive the following error which i can
> not readily diagnose -
> % HDF_SD_ADDDATA: Unable to write the specified HDF-SD slice.
>
> hdf opens, sd starts /RDWR ok, sd selected ok
> i have veryfied the size and order of the data variable, count and
> start keyword variables.
>
> help is appreciated,
> george

Some things to check:

You might not have access. What are the file permissions, owner, and
group membership?

The file may be corrupt. Can you view the HDF file with ncdump, or
similar utilities? Can you open it read-only, and view its contents
using HDF_SD_GETDATA?

Is this new code, or code that has already worked on a different file,
but is failing with this one?

You imply that you've already collected the following information, and
that it checked out OK, but maybe you've misinterpreted it - could you
tell us:

What values does HDF_SD_GETINFO give you for DIMS, HDF_TYPE, and TYPE?

What values are you giving HDF_SD_ADDDATA for START, COUNT, and STRIDE?

What do you get when you type

HELP,mydata

where 'mydata' represents the name of the field you're passing as the
data argument to HDF_SD_ADDDATA?
Re: frustrated by hdf_sd_adddata [message #24211 is a reply to message #24200] Thu, 15 March 2001 09:45 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
George McCabe wrote:
>
> james,
>
> thanks for you many suggestions.
>
> can you tell me what do you mean by 'corrupt'. though i think that i
> understand the use of idl's hdf procedures, my general experience is
> limited. i am curious about occurances of hdf file corruption.

When I talk about file corruption, I'm not talking about anything
particularly exotic. HDF expects the input file to have data is a
certain format. If the file is damaged, the data might not be in the
right format any more. Ways to damage a file include using non-HDF
facilities to modify the file, doing file transfers with no error
checking, using text mode ftp, or physical damage to your storage
medium.

There are probably ways to damage an HDF file by passing bad arguments
to HDF functions, but I've never bothered testing to see which kinds of
bad arguments HDF actually checks for, and which ones it lets through.
Re: frustrated by hdf_sd_adddata [message #24218 is a reply to message #24209] Wed, 14 March 2001 16:33 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
George McCabe (george.mccabe@gsfc.nasa.gov) writes:

> attempting to replace a subset of existing data in an HDF SD, using idl
> procedure hdf_sd_adddata, receive the following error which i can not
> readily diagnose -
> % HDF_SD_ADDDATA: Unable to write the specified HDF-SD slice.
>
> hdf opens, sd starts /RDWR ok, sd selected ok
> i have veryfied the size and order of the data variable, count and start
> keyword variables.
>
> help is appreciated,

No file writing permissions?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Regular Expressions
Next Topic: Gridding/Interpolating a large image

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

Current Time: Wed Oct 08 10:58:06 PDT 2025

Total time taken to generate the page: 0.00506 seconds