Try this version of the test file where I try mapping the QUALITY
component as a _DOUBLE. Although it seems to work the hdsShow gave a
strange output indicating some sort of problem:
[echapin@bends test]$ ./ndf_ctest
Both NDFs open
/home/echapin/star-build/test/ndf_test.sdf, disp=[K], mode=[U], refcnt=1,
64-bit=[N]
/home/echapin/star-build/test/frame.sdf, disp=[K], mode=[R], refcnt=1,
64-bit=[N]
Output NDF open
/home/echapin/star-build/test/ndf_test.sdf, disp=[K], mode=[U], refcnt=1,
64-bit=[N]
/home/echapin/star-build/test/t7e92.sdf, disp=[D], mode=[U], refcnt=1,
64-bit=[N]
Both NDFs closed
/home/echapin/star-build/test/t7e92.sdf, disp=[D], mode=[U], refcnt=1,
64-bit=[N] ^^^^^^^^^
?
cheers,
Ed
On Fri, 9 Jun 2006, Edward L. Chapin wrote:
>
> Hello,
>
>>> The HDS locator problem was tracked down to the following call to
>>> ndfMap:
>>>
>>> ndfMap( indf, "QUALITY", dtype, mode, &outdata[2], &nout, status );
>>>
>>> which looks OK, except that dtype is set to "_DOUBLE" rather than
>>> "_UBYTE". (Brought to you today by cut & paste :)
>>>
>>> Now I would have thought that checking status would have told us that
>>> something was wrong here but status is still good on return, so we had
>>> no way of knowing a) that there was a problem and b) what the problem
>>> was until we got the HDS locator error.
>>
>> Hi Andy,
>>
>> the data type given to ndfMap doesn't need to match that of the underlying
>> data, it's a requested type, not the data type. NDF takes care of
>> converting to the type you asked for, and converting it back when the data
>> is released (write or update access). So this is a valid operation. Now if
>> you'd tried to do an "ndfStype" on a quality component, then that would
>> throw an error as the underlying data type cannot be modified.
>
> So at least it makes sene that no error was thrown. However, this is
> the procedure that was generating the extra HDS locator that didn't seem
> to get cleaned up properly. If I get a chance today I'll see if I can
> reproduce the problem with the test code you sent around yesterday.
>
> cheers,
> Ed
>
--
+----------------------------------------------------------------+
| Dr. Edward Chapin (604) 822-6709 (work) |
| Dept. of Physics and Astronomy |
| University of British Columbia |
| 6224 Agricultural Road, Vancouver, B.C. |
| V6T 1Z1, Canada [log in to unmask] |
+----------------------------------------------------------------+
#include <stdio.h>
#include "sae_par.h"
#include "star/ndg.h"
#include "star/grp.h"
#include "star/hds.h"
#include "ndf.h"
int main( int argc, char *argv[] ) {
Grp *igrp;
Grp *ogrp;
int el;
int indf;
int ondf;
int status;
void *pntr;
status = SAI__OK;
cnfInitRTL( argc, argv );
ndfInit( argc, argv, &status );
igrp = grpNew( "IN", &status );
grpPut1( igrp, "frame", 1, &status );
ogrp = grpNew( "OUT", &status );
grpPut1( ogrp, "ndf_test", 1, &status );
ndgNdfas( igrp, 1, "READ", &indf, &status );
ndgNdfpr( indf, " ", ogrp, 1, &ondf, &status );
printf( "Both NDFs open\n" );
hdsShow( "FILES", &status );
ndfAnnul( &indf, &status );
ndfStype( "_DOUBLE", ondf, "DATA", &status );
ndfStype( "_DOUBLE", ondf, "VARIANCE", &status );
ndfMap( ondf, "DATA", "_DOUBLE", "WRITE", &pntr, &el, &status );
ndfMap( ondf, "VARIANCE", "_DOUBLE", "WRITE", &pntr, &el, &status );
/* Added by EC --------------------------------------------------*/
ndfMap( ondf, "QUALITY", "_DOUBLE", "WRITE", &pntr, &el, &status );
/* --------------------------------------------------------------*/
printf( "Output NDF open\n" );
hdsShow( "FILES", &status );
ndfAnnul( &ondf, &status );
grpDelet( &igrp, &status );
grpDelet( &ogrp, &status );
printf( "Both NDFs closed\n" );
hdsShow( "FILES", &status );
return ( status != SAI__OK );
}
|