I'm having some trouble taking an existing NDF with only a DATA component,
and attempting to create a VARIANCE component. If I explain what I'm
trying to do, maybe someone will have a clever suggestion...
I have an input NDF, with a DATA component (whose dimensions happen
to be 3d although it is not important - 1st two dimensions are x- and y-
pixel coordinates for a camera, z- is a time axis). My goal is to create a
new NDF with the same dimensions as the input, but including a VARIANCE
component (and in the future QUALITY as well) to which I will write new
values. I want to only ever open the input NDF with READ access and never
modify its contents.
1. The input NDF is the element of a group. I create a copy of it doing
the following:
ndgNdfas( igrp, i, "READ", &indf, status );
ndgNdfpr( indf, " ", ogrp, i, &ondf, status );
ndfAnnul( &indf, status );
2. I then set parameters for the data and variance arrays and map them (I
believe this will make the components "active" so that they are defined
when I annul the output NDF):
ndfStype( "_DOUBLE", ondf, "DATA", status );
ndfStype( "_DOUBLE", ondf, "VARIANCE", status );
ndfMap( ondf, "DATA", "_DOUBLE", "WRITE", &(ptr[0]), &nmap, status );
ndfMap( ondf, "VARIANCE", "_DOUBLE", "WRITE", &(ptr[1]), &nmap, status );
ndfAnnul( ondf );
Using this code no VARIANCE component seems to get created in ondf
(verified with hdstrace). However, if in step #2 I compare ondf with and
without the ndfStype/ndfMap for the VARIANCE component I get different
file sizes, i.e. it seems to be allocating more space to accomodate the
VARIANCE component but somehow it isn't getting stored properly?
Another weird thing: I have gotten a nearly identical piece of code to
this to work (in fact I'm not sure what the difference is - it is a much
more complicated routine that does other things that don't appear to be
related to this NDF copying...). Although it works, the code has a check
for the total number of HDS locators at the start and finish of execution,
and they're off by 1. I've tracked it down, and it seems that when the
VARIANCE component is created in #2 by the ndfMap, the # of HDS locators
increases by 1, but then it doesn't go down by the correct amount with the
ndfAnnul.
Either I'm using NDF incorrectly, or perhaps I've found a bug? (or
both...)
I did a fresh checkout yesterday, and I'm using 64bit Fedora Core 4. Any
help would be greatly appreciated.
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] |
+----------------------------------------------------------------+
|