Re: questions about H5DSiterate_scales

Hi Ed

>> I also noticed that H5DSget_num_scales returns -1 (FAIL) in one case
>> when there is no scale attached. I'll take a look why we did that
>> this way, but probably we can return 0 for this case

>Well that would be better.

I changed the return value of H5DSget_num_scales for a case when there are no 
scales attached from FAIL (-1) to 0
the code  is checked in our cvs repo

the lines of code that were returning -1 in your case are inside the 
H5DSget_num_scales function

/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
 if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0)
  return FAIL;

 /* it does not exist */
 if (has_dimlist == 0)
  return 0;

previously it returned FAIL here , the rationale was because it did not find 
the DIMENSION_LIST attribute.
it is more correct to return 0, like you noticed, meaning that there was no 
attempt to previously attach a dimension scale to this dataset

thanks for the suggestion

> > in a group (H5Gget_num_objs) and iterating with
>> H5Gget_objtype_by_idx

>What is a less original way of solving this problem?

that was just original for me because those functions are relatively new, and I 
do not use them very much

Pedro


At 05:22 PM 7/12/2005, you wrote:
>Pedro Vicente Nunes <pvn@xxxxxxxxxxxxx> writes:
>
>> Hi Ed
>>
>> thank you so much for trying our dimension scales software.
>
>Thanks for putting it there!
>
>>
>> Your program is very interesting, it uses an original approach to iterate 
>> trough the objects 
>> in a group (H5Gget_num_objs) and iterating with
>> H5Gget_objtype_by_idx
>
>What is a less original way of solving this problem?
>
>>
>> can we use it for our repository tests ?
>
>Of course.
>
>>
>> regarding your question, the approach you are using to verify that a 
>> dimension scale ID is really pointing to the dimscale dataset, won't work.
>>
>> that is because you are using the H5Iget_name function, but the ID that this 
>> function accepts
>> was obtained (inside the H5DSiterate_scales function) with the 
>> H5Rdereference function, so
>> it was a "dereferenced" object , which has "no name", so to speak.
>>
>> so, we have to find another way to verify those IDs.
>> one option that comes to mind is to use the H5Gget_objinfo function
>> , that returns a unique object address in the file
>
>Yes, I've already worked that out with Quincey, and implemented it in
>netcdf-4. I'm playing with it now, but I'm still not sure that it will
>work.
>
>>
>> however to use this, you'll have to modify the design of your program. 
>> you must obtain the dim scale ID, save it, 
>> then compare it inside the cycle with H5Gget_objinfo with the 2 IDs
>> and compare those adresses.
>
>Yes, this is exactly what I now do.
>
>>
>> the test file test_ds.c has several examples of iterator functions
>> that obtain information about a dimension scale
>
>Thanks, I will look at it closely.
>
>>
>> I modified your alien_visitor function so that it uses H5Gget_objinfo . 
>> however, like this, it does not do what you want, but it is an example
>>
>> sorry for not being more specific, but it's been a while sine I wrote that 
>> code.
>> I'll go tru it again to see if I can find a way to match your
>> original goal
>
>That's OK, I've moved on. But I'm sure I'll hit the next problem soon!
>
>>
>> I also noticed that H5DSget_num_scales returns -1 (FAIL) in one case
>> when there is no scale attached. I'll take a look why we did that
>> this way, but probably we can return 0 for this case
>
>Well that would be better.
>
>>
>> here is the new function, complete code is attached 
>> Pedro
>
>Thanks Pedro!
>
>Ed
>
>-- 
>Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx

</Pedro Vicente Nunes>
--------------------------------------------------------------
hdf.ncsa.uiuc.edu
Tel. 1-217-265 0311