custom units

James W Brunt jbrunt at lternet.edu
Fri Mar 18 15:14:05 PST 2005


Xiaoping -

Here's a response we generated for Barbara Benson at NTL - I think this 
will help you.

James
---------------------------------------------------------------

To use the <customUnit></customUnit> element in EML **AND** to
have it validate through the EML parser, the STMML definition
must be included somewhere in the document.  A likely location is
in the <additionalMetadata></additionalMetadata> element
(unfortunately, XMLSpy does not complain if the STMML
definition is not present when validating against the schema).
The upside is that defining the STMML definition for any customUnit
is really straight forward.  See the example below where a
customUnit is defined for "g/0.04m2".

<attribute>
  <attributeName>Some Attribute</attributeName>
  <attributeDefinition>Some Attribute for something</attributeDefinition>
   <measurementScale>
    <ratio>
     <unit>
      <customUnit>g/0.04m2</customUnit>
     </unit>
     <precision>0.001</precision>
     <numericDomain>
      <numberType>real</numberType>
      <bounds>
       <minimum exclusive="false">0</minimum>
      </bounds>
     </numericDomain>
   </ratio>
  </measurementScale>
</attribute>
.
.
.
<additionalMetadata>
  <stmml:unitList>
     <stmml:unit  id="g/0.04m2" name="g/0.04m2 
unitType="arealMassDensity" parentSI="kilogramsPerSquareMeter" 
multiplierToSI="0.025"/>
  </stmml:unitList>
</additionalMetadata>

In this example, the key value is simply the text "g/0.04m2", which is
then used as the keyRef in the stmml:unit element.  Using the STMML
definition in this manner, you can have one or more unique customUnits
defined within the same instance document.  I believe the purpose of the
customUnit is for providing liberty in defining measurements, but ultimately
tying it back to SI units with the STMML definition.  **In the case of the
EML parser** that is used during EML validation (as in prior to inserting
EML into Metacat - see the online validation tool at
http://knb.ecoinformatics.org/emlparser/index.html), STMML definitions
only require the "id" attribute to be set for validation to occur (see 
below).

**Also** note how the <bounds></bounds> element is used within the
numericDomain element.

<additionalMetadata>
  <stmml:unitList>
     <stmml:unit  id="g/0.04m2"/>
  </stmml:unitList>
</additionalMetadata>

The above definition is all that is needed to keep the EML parser happy, 
(albeit,
not the intent of the STMML definition).

Now, with all that being said, your real issue was defining an attribute 
that
captured a country's currency (correct?), as in the following table:

Attribute:  WaterTemp WaterQuality WaterValue
              (degC)     (1..10)      (US$)
               23.1         4         29.10
               21.4         6         17.44
               19.6         3         32.00

In our discussion, James and I believe that the standardUnit type of
"number" would be the correct definition for currency (as defined in
the unitDictionary).  In this case, number does not imply an SI unit,
but simply a "count" of some item (as in currency).  The example below
illustrates how I would define a currency attribute in EML.

<attribute>
  <attributeName>WaterValue</attributeName>
  <attributeDefinition>Value of Water in US$</attributeDefinition>
   <measurementScale>
    <ratio>
     <unit>
      <standardUnit>number</standardUnit>
     </unit>
     <precision>0.01</precision>
     <numericDomain>
      <numberType>real</numberType>
      <bounds>
       <minimum exclusive="false">0</minimum>
      </bounds>
     </numericDomain>
   </ratio>
  </measurementScale>
</attribute>

Xiaoping Wang wrote:
> We have several units that are not in the list of  EML standard units.  
> So I need to describe these units as custom units.  However, we don't 
> have the document where the definitions for these units are provided 
> using the STMML syntax..  How should I use the additionalMetadata 
> section to define these customUnits?   Please help!
> 
> Thank you very much!
> 
> Xiaoping Wang
> 
> PMEL /  NOAA
> _______________________________________________
> eml-dev mailing list
> eml-dev at ecoinformatics.org
> http://www.ecoinformatics.org/mailman/listinfo/eml-dev



More information about the Eml-dev mailing list