[Nexus] Fwd: Re: [NeXus-tech] XML and new attribute
Eugen Wintersberger
eugen.wintersberger at desy.de
Mon Feb 16 08:09:34 GMT 2015
Hi Pete
> The validation error reported:
> The value 'degrees' of attribute 'units' on element 'field' is not valid
> with respect to its type, 'anyUnitsAttr'.
>
> In this example "degrees" is not an allowed value for the "units"
> attribute of a field in an NXDL file. The allowed values for the units
> attribute come from the list "anyUnitsAttr" in the nxdlTypes.xsd file.
> The most appropriate value here is "NX_ANGLE" (documentation says:
> example: degrees or radians or arcminutes or). The point of this
> indirection is that NeXus allows the specific units of any field to be
> specified in compatible terms. This *feature* is not validated by NeXus.
Oh - this is very enlightening - thanks a lot. However, in this case the
name "units" might be missleading from the point of "dimension analysis"
as what the "units" attribute stores is really a "dimension".
In the example you mentioned, what "units" says is that the data in the
corresponding field stores a value which represents an angle. It does
not say anything about the units (they can be radians or degress or
something completely different).
In this case it should have been called "dimension" rather than "units"
which, by itself, the user might confuse with the number of dimensions
in the case of a multidimensional attribute - dam it ;)
>
> To allow this one particular NXDL to require units="degrees" in this
> instance while allowing NeXus to retain the planned flexibility for to
> specify the units, it is necessary for this instance to use an
> "enumeration" field to impose the intended requirement, such as:
>
> <field name="phi" type="NX_FLOAT">
> <attribute name="units">
> <enumeration>
> <item value="degrees"/>
> </enumeration>
> </attribute>
> </field>
Ok - now I got it. At least from my experience with the boost::units
library this entire units stuff is rather hard to standardize.
Anyhow - thanks for your elaborate reply to my questions.
I guess we will simply use the NXDL definitions as far as it serves our
purpose and deviate from it whenever feasible to satisfy our
requirements. In fact I may even remove the entire XML stuff from my
core library and move it to a different library which should make
maintenance easier.
regards
Eugen
>
> Pete
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part
URL: <http://lists.nexusformat.org/pipermail/nexus/attachments/20150216/40289801/attachment.sig>
More information about the NeXus
mailing list