[Nexus] Fwd: Re: [NeXus-tech] XML and new attribute

Eugen Wintersberger eugen.wintersberger at desy.de
Fri Feb 13 15:07:40 GMT 2015


Hi Pete 
> On 2/13/2015 3:08 AM, Eugen Wintersberger wrote:
>  > If I sum this up: mandatory attributes go into the field tag itself
>  > (like type, name, units, long_name, etc.) and are thus part of the NXDL
>  > language. Optional attributes are stored as children of the field tag
>  > and hence cannot be part of the NXDL language.
> 
> No.  All the attributes you describe will be declared using the 
> "attribute" element in an NXDL file.  This is true even for any 
> locally-defined files you might use to write specific data files.

Ok - that's what I meant. 

> 
> In the NXDL specification file, the only attributes allowed to the field 
> tag are those described in the nxdl.xsd file.  Attributes destined for 
> the HDF5 file (like type, name, units, long_name, etc.) with fixed 
> values must be specified with the "enumeration" element, which is a 
> child of the field element to which they apply.

Now I am a bit confused: I thought name, units, etc. are defined in the
nxdl.xds and thus go into the tag (as shown below)
  <field name="..." ...>

> 
> Here's an example to get this structure:
> 
>     phi: NX_FLOAT
>       @depends = chi
>       @transformation = rotation
>       @vector:NX_FLOAT = [0 1 0]
>       @offset:NX_FLOAT = [0 0 0]
> 
> Here is the NXDL declaration to get that structure:
> 
> <field name="phi" type="NX_FLOAT">
>    <attribute name="depends">
>      <enumeration>
>        <item value="chi" />
>      </enumeration>
>    </attribute>
>    <attribute name="transformation ">
>      <enumeration>
>        <item value="rotation" />
>      </enumeration>
>    </attribute>
>    <attribute name="vector" type="NX_FLOAT">
>      <enumeration>
>        <item value="[0 1 0]" />  <!-- may be a problem for nxdl.xsd -->
>      </enumeration>
>    </attribute>
>    <attribute name="offset" type="NX_FLOAT">
>      <enumeration>
>        <item value="[0 0 0]" />  <!-- may be a problem for nxdl.xsd -->
>      </enumeration>
>    </attribute>
> </field>

One thing that we may should do is treat attributes more like fields (in
particular since we want to support multidimensional attributes. In this
case an attribute would look like this (I guess)

<attribute name="vector" type="NX_FLOAT">
  <dimensions rank="1">
    <dim value="3" index="1"/>
  </dimensions>
  <enumeration>
    <item><value>0 1 0</value></item>
  </enumeration>
</attribute>

In this case we can restrict ourselves to a list of elements separated
by blanks. As the rank is provided by the dimensions tag we do not need
to embrace the value with [ and ]. 

> 
> The two different kinds of problems with this are:
> 
> * "offset" is used incorrectly as noted in other discussion thread 
> (needs a new name for this use)

On which list is this thread, do you maybe know the subject as I could
not find it (though I believe it is there). 

> 
> 
> Does these definitions help to reduce confusion?

It does a bit. In particular the "offset" and its correct application is
the next thing which causes me quite some headache. But I guess I will
deal with it next week after the weekend ;)

regards
  Eugen 

> 
> :nxdl.xsd:
>      XML Schema that defines the rules for writing NXDL files.
> 
> :NXDL files (*.nxdl.xml):
>      NXDL files declare the rules for storing data in HDF files
> 
> Pete
> 
> _______________________________________________
> NeXus mailing list
> NeXus at nexusformat.org
> http://lists.nexusformat.org/mailman/listinfo/nexus

-------------- 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/20150213/9b4ddaf1/attachment.sig>


More information about the NeXus mailing list