[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[THREDDS #NCT-216206]: TDS report incorrect attribute data type

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [THREDDS #NCT-216206]: TDS report incorrect attribute data type
  • Date: Tue, 06 Dec 2011 21:21:51 -0700

Ok, I have found the problem.
The code that converts cdm attributes
to opendap attributes has 
explicit code (Shown at end of message, taken from
NcDAS.java line 177).

The reason for this is that the DAP2 specification
byte type is explicitly defined as unsigned.
So, any server that serves up a signed byte
value is violating the DAP2 specification.
=Dennis Heimbigner
 Unidata 

> // cant send signed bytes
> if (att.getDataType() == DataType.BYTE) {
>   boolean signed = false;
>   for (int i = 0; i < att.getLength(); i++) {
>      if (att.getNumericValue(i).byteValue() < 0)
>        signed = true;
>      }
>      if (signed) // promote to signed short
>        dods_type = opendap.dap.Attribute.INT16;
>      }
>   }


=Dennis Heimbigner
  Unidata


Ticket Details
===================
Ticket ID: NCT-216206
Department: Support THREDDS
Priority: Urgent
Status: Closed