Hi John,
Yes - NDF_AMAP works. It's used all over the place. If
you build and run the attached example program:
% g95 -fno-second-underscore example.f -o example -L/star/lib
-I/star/include `ndf_link`
% ./example
it will create an ndf called "junk.sdf" in your current directory that
is a spectrum containing a copy of the AXIS array from
/star/bin/kappa/spectrum.sdf. Using NDFTRACE will verify that the AXIS
arrays are the same.
I'm not sure I follow the ins and outs of your code, but hopefully the
example.f program will show how to use NDF_AMAP.
BTW - starlink applications are tending to move away from the use of
the AXIS component, and are instead using the more versatile WCS
component. Admittedly, using the WCS component is harder than using
the AXIS component, but gives much more flexibility for attaching
whole collections of arbitrary coordinate systems to your NDF,
including proper support for celestial coordinates like (RA,Dec), etc.
David
On 15 October 2010 13:46, John Barnes <[log in to unmask]> wrote:
> Hi,
>
> Does anyone know whether NDF_AMAP is working correctly?
>
> I am able to read the axes from an NDF structure but unable to write the
> axis back to another structure.
>
> e.g.
>
> CALL NDF_ASSOC('SPECT','READ',SPECT,STATUS)
> CALL NDF_MAP(SPECT,'Data', '_REAL','READ',SPCPTR,NELM,STATUS)
> CALL NDF_MAP(SPECT,'Variance','_REAL','READ',SPVPTR,NELM,STATUS)
> CALL NDF_AMAP(SPECT,'Cent',1,'_REAL','READ',AX1PTR,NELM,STATUS)
>
> Enables me to use the axis(1) data array values in a subroutine where the
> mapped elements are the correct values.
>
> However,
>
> CALL NDF_CREAT('OUTPT','_REAL',1,LBND,UBND,OUTPT,STATUS)
> CALL NDF_MAP(OUTPT,'DATA','_REAL','WRITE',OUTPTR,NSPEC,STATUS)
> CALL NDF_AMAP(OUTPT,'Cent',1,'_REAL','WRITE',AX1PTR,NELM,STATUS)
>
> Does not work. I have tried copying the values of the array pointed to be
> AX1PTR
> to another location and using the pointer to that array (AX1OUTPTR):
>
> i.e. CALL
> NDF_AMAP(OUTPT,'Cent',1,'_REAL','WRITE',AX1OUTPTR,NELM,STATUS)
>
> This writes an array but the values are the default - i.e. 0.5, 1.5, 2.5,
> etc.
>
> It IS also possible to directly map AX1PTR into OUTPT as long as the
> original 'READ' statements
> are replaced with 'UPDATE'.
>
> However, in both instances, the contents held at AX1OUTPTR or AX1PTR are
> correct before NDF_AMAP is called but on
> exit, have been modified to the default values (0.5, 1.5, 2.5, etc.).
>
> I have also tried running NDF_ASTAT to verify that the axis is defined
> before I try to write. A value of "T" is always returned.
>
> Is NDF_AMAP working correctly or is there perhaps another routine I can try
> to write the axis/axes? I just want to copy the whole AXIS structure from
> SPECT to OUTPT.
>
> Many thanks,
> John
>
> --
> **********************************************************
> John Barnes
> Centre for Astrophysics Research,
> Science& Technology Research Institute
> University of Hertfordshire,
> College Lane, Hatfield.
> Herts AL10 9AB. UK
> Tel: 01707 285162
> http://star-www.herts.ac.uk/~jbarnes
>
> **********************************************************
>
|