Re: [netcdfgroup] NcML and Enumerated Types - Problem with the syntax

After downloading Tools UI and playing around a bit, I think I can provide part 
of the answer to my own question.


The element in the example NcML text:

  <variable name="primary_cloud" shape="station" type="enum1">

seems to be need an attribute called "typedef" and should be written:

  <variable name="primary_cloud" shape="station" typedef = "cloud_class_t" 
type="enum1">

The need for the type attribute seems redundant with typedef but leaving out 
the type attribute causes Tool UI to complain.

However, including it but setting it incorrectly, e.g.

  <variable name="primary_cloud" shape="station" typedef = "cloud_class_t" 
type="enum2">

doesn't raise an error.

Regards,

Tim



-----Original Message-----
From: netcdfgroup-bounces@xxxxxxxxxxxxxxxx 
[mailto:netcdfgroup-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Timothy Patterson
Sent: Wednesday, December 09, 2015 7:26 PM
To: 'netcdfgroup@xxxxxxxxxxxxxxxx'
Subject: [netcdfgroup] NcML and Enumerated Types - Problem with the syntax

The Unidata website has some pages on the Annotated Schema for NcML at 
http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/ncml/AnnotatedSchema4.html
 

It give some example NcML code for an enumerated type:

<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"; 
location="Q:/cdmUnitTest/formats/netcdf4/tst/test_enum_type.nc">
  <enumTypedef name="cloud_class_t" type="enum1">
    <enum key="0">Clear</enum>
    <enum key="1">Cumulonimbus</enum>
    <enum key="2">Stratus</enum>
    <enum key="3">Stratocumulus</enum>
    <enum key="4">Cumulus</enum>
    <enum key="5">Altostratus</enum>
    <enum key="6">Nimbostratus</enum>
    <enum key="7">Altocumulus</enum>
    <enum key="8">Cirrostratus</enum>
    <enum key="9">Cirrocumulus</enum>
    <enum key="10">Cirrus</enum>
    <enum key="255">Missing</enum>
  </enumTypedef>
  <dimension name="station" length="5" />
  <variable name="primary_cloud" shape="station" type="enum1">
    <attribute name="_FillValue" value="Missing" />
  </variable>
</netcdf>


There seems to me to be a problem, in that the variable definition is set to be 
a type of enum1 and never refers back to the defined type "cloud_class_t".

Indeed, if you read the example into tools UI, it produces this CDL:

netcdf test_enum_type.ncml {
  types:
    byte enum cloud_class_t { 'Clear' = 0, 'Cumulonimbus' = 1, 'Stratus' = 2, 
'Stratocumulus' = 3, 'Cumulus' = 4, 'Altostratus' = 5, 'Nimbostratus' = 6, 
'Altocumulus' = 7, 'Cirrostratus' = 8, 'Cirrocumulus' = 9, 'Cirrus' = 10, 
'Missing' = 255};

  dimensions:
    station = 5;
  variables:
    enum UNKNOWN primary_cloud(station=5);
      :_FillValue = "Missing";

}

I want to be able to create NcML code so that the last lines read:

cloud_class_t primary_cloud(station=5) ;
  :_FillValue = Missing ;

However, changing the definition in the NcML declaration to 

  <variable name="primary_cloud" shape="station" type="cloud_class_t">

causes NcDump to throw an exception instead.

Any insight or help is appreciated as I'd like to be able to use enums in my 
own NcML descriptions.

Thanks!

Tim

_________________________________________________________________________________________
Dr. Tim Patterson
Product Format and Test Data Coordinator Instrument Data Simulation Expert MTG 
Programme GEO  Division

EUMETSAT
Eumetsat-Allee 1
64295 Darmstadt
Germany

Tel: +49 6151 807 487
Fax: +49 6151 807 7
E-mail: timothy.patterson@xxxxxxxxxxxx
Web: www.eumetsat.int




Any email message from EUMETSAT is sent in good faith but shall neither be 
binding nor construed as constituting a commitment by EUMETSAT, except where 
provided for in a written agreement or contract or if explicitly stated in the 
email. Please note that any views or opinions presented in this email are 
solely those of the sender and do not necessarily represent those of EUMETSAT. 
This message and any attachments are intended for the sole use of the 
addressee(s) and may contain confidential and privileged information. Any 
unauthorised use, disclosure, dissemination or distribution (in whole or in 
part) of its contents is not permitted. If you received this message in error, 
please notify the sender and delete it from your system.
_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/ 

Any email message from EUMETSAT is sent in good faith but shall neither be 
binding nor construed as constituting a commitment by EUMETSAT, except where 
provided for in a written agreement or contract or if explicitly stated in the 
email. Please note that any views or opinions presented in this email are 
solely those of the sender and do not necessarily represent those of EUMETSAT. 
This message and any attachments are intended for the sole use of the 
addressee(s) and may contain confidential and privileged information. Any 
unauthorised use, disclosure, dissemination or distribution (in whole or in 
part) of its contents is not permitted. If you received this message in error, 
please notify the sender and delete it from your system.



  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: