Skip to content

Updating valid type elements #136

@mkavulich

Description

@mkavulich

Currently there are no explicit rules for what variable type elements are valid. In the XML schema file, the following are listed:

  • integer
  • real
  • logical
  • character
  • double precision
  • complex

With the current schema, 5 standard name entries fail to validate, all because they use some custom derived type:

standard_names.xml:643: Schemas validity error : Element 'type': [facet 'pattern'] The value 'physics_state' is not accepted by the pattern '[cC][oO][mM][pP][lL][eE][xX]'.
standard_names.xml:649: Schemas validity error : Element 'type': [facet 'pattern'] The value 'physics_tend' is not accepted by the pattern '[cC][oO][mM][pP][lL][eE][xX]'.
standard_names.xml:1512: Schemas validity error : Element 'type': [facet 'pattern'] The value 'ccpp_constituent_prop_ptr_t' is not accepted by the pattern '[cC][oO][mM][pP][lL][eE][xX]'.
standard_names.xml:4227: Schemas validity error : Element 'type': [facet 'pattern'] The value 'sfcflw_type' is not accepted by the pattern '[cC][oO][mM][pP][lL][eE][xX]'.
standard_names.xml:4240: Schemas validity error : Element 'type': [facet 'pattern'] The value 'sfcfsw_type' is not accepted by the pattern '[cC][oO][mM][pP][lL][eE][xX]'.

In order to have the schema properly validate, I propose the following modifications to the schema file:

diff --git a/standard_names_v1_0.xsd b/standard_names_v1_0.xsd
index 462fa96..a8fc18e 100644
--- a/standard_names_v1_0.xsd
+++ b/standard_names_v1_0.xsd
@@ -13,12 +13,12 @@
 
   <xs:simpleType name="type_type">
     <xs:restriction base="xs:string">
-      <xs:pattern value="[iI][nN][tT][eE][gG][eE][rR]"/>
-      <xs:pattern value="[rR][eE][aA][lL]"/>
-      <xs:pattern value="[lL][oO][gG][iI][cC][aA][lL]"/>
-      <xs:pattern value="[cC][hH][aA][rR][aA][cC][tT][eE][rR]"/>
-      <xs:pattern value="[dD][oO][uU][bB][lL][eE][ ]*[pP][rR][eE][cC][iI][sS][iI][oO][nN]"/>
-      <xs:pattern value="[cC][oO][mM][pP][lL][eE][xX]"/>
+      <xs:pattern value="integer"/>
+      <xs:pattern value="real"/>
+      <xs:pattern value="logical"/>
+      <xs:pattern value="character"/>
+      <xs:pattern value="complex"/>
+      <xs:pattern value="ddt"/>
     </xs:restriction>
   </xs:simpleType>

This change converts all the rules checks to lowercase (no reason to allow mixed-case, in my opinion), removes the double precision entry (which is redundant to real; similar to our discussion on the removal of the kind attribute, this should be application-specific and not specified by the standard names) and adds a new ddt entry to cover the derived data types that we already include.

I will also update the Rules document to explicitly state these allowed types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions