Print

Print


Tim,

> >>    ARR_xTOx( USEBAD, NDIMS, DIMS, LBND, UBND, INARR, OUTARR, IERR, NERR,
> >>              STATUS)
> >>
> >> (with USEBAD, IERR and NERR simply there to match the prm interface for
> >> VEC_). Then if LBND is all ones and UBND == DIMS then this is a vec_
> >> copy, else it's a manual copy of a subarray (it's actually a VEC_
> >> copy if the first NDIMS-1 dims match DIMS).
> >
> > Sounds good to me. The only other suggestion may be to replace the DIMS
> > argument by a LBND_IN/UBND_IN pair since otherwise the LBND(_OUT)/UBND(_OUT)
> > values would need to be supplied in GRID indicies rather than PIXEL
> > indices. I know its not a big deal to convert backwards and forwards
> > between GRID and PIXEL, but it is at least an annoyance and introduces
> > scope for bugs.
> >
>
> But then don't I have to address a negative index in a fortran array?

I was imagining that ARR_xTOx would calculate the DIMS corresponding to
the supplied LBND_IN/UBND_IN, then convert the supplied LBND(_OUT)/UBND(_OUT)
from PIXEL to GRID indices, then do the copy using the calculated DIMS
and GRID bounds. I was only saying that it would be better for these
PIXEL<>GRID conversions to be done inside ARR_xTOx rather than outside.

>    OUTARR(-1, -20) = INARR(-1, -20)
>
> looks a bit dangerous to me.... [I realise that I have to trust the caller
> tha NDIMS is actually within the declared bounds of the array...]

But presumably you would be accessing both arrays as 1D vectors within
ARR_xTOx and calculating the offsets yourself?

> I was intending LBND/UBND to be the array indices (GRID coordinates) of
> both the input and output, not a mapping from one region of the input to a
> different region in the output. Feel free to convince me of complexity
> though.

No complexity - no Mappings. I'm just saying that if you have (say) a 2D
NDF with bounds  (-100:50,120:200) and you want to copy the section
(-50:10,140:160) to a new NDF, then an application writer would like to
define the shape of the input array using the bounds LBND_IN=[-100,120]
UBND_IN=[50,200] rather than having to calculate the dimensions
DIMS=[221,151], and would also like to supply LBND(_OUT)=[-50,140] and
UBND(_OUT)=[10,160] to define the section to be copied, rather than
having to convert these bounds from PIXEL indices to GRID indices.

David