I think I understand the issue now. "Badness" is a concept that is not
present in HDS - there are no references to VAL__BAD anywhere in HDS.
HDS considers all numerical values to be the same. Badness is only
understood at higher levels (i.e. ARY, NDF, etc). Presumably this is
for two reasons, both based on the fact that there is no equivalenent
to the NDF bad pixel flag in HDS (i.e. no way for HDS to decide
whether to look for bad pixels or not):
1) There just may be situations in which you want to treat the
VAL_BADx values as literal values
2) Checking for bad values is an unnecessary overhead in cases where
there are no bad pixels
So the fact that HDS does not convert bad pixel values is probably a
feature rather than a bug.
David
On 25 November 2010 08:27, David Berry <[log in to unmask]> wrote:
> On 25 November 2010 02:30, Tim Jenness <[log in to unmask]> wrote:
>> On Nov 23, 2010, at 10:21 PM, David Berry wrote:
>>
>>> Do all conversions (e.g. _double -> _integer, etc) handle bad values
>>> incorrectly, or is it just _integer -> _word ?
>>>
>>
>> Confirmed. Well, it depends on the size. For example, reading a VAL__BADD into an integer fails because of the size test regardless so this is only an issue when you map something into a larger size.
>>
>> Mapping a _REAL into _DOUBLE ends up with all the VAL__BADRs coming out in the double array as VAL__BADR and not VAL__BADD. This seems like a bug to me. Surely the point of the bad value and the automatic type conversion is that badness will be converted?
>
> You'd have thought so. NDF does not rely on HDS to do bad value
> conversion. In ARY1_GT1x it says
>
> * If type conversion is required, then map the data without type
> * conversion, perform the type conversion explicitly and unmap the
> * data.
> ELSE
> CALL DAT_MAP( LOC, TYPE, 'READ', 1, DIM, PNTR, STATUS )
> CALL ARY1_CVT<T>( BAD, EL, TYPE, PNTR, RESULT, DCE, STATUS )
> CALL ARY1_HUNMP( LOC, STATUS )
> END IF
>
> The ARY1_CVT<T> routine uses VEC_xTOy to do the conversion. So I'm
> wondering why RFWS chose to use VEC_ routines rather than change
> HDS...
>
> David
>
>
>
>
>> I'll fix it on Friday unless Brian stops me.
>>
>> --
>> Tim Jenness
>> Joint Astronomy Centre
>>
>
|