wmo-im / iwxxm

XML schema and Schematron for aviation weather data exchange
https://old.wmo.int/wiswiki/tiki-index.php%3Fpage=TT-AvXML
48 stars 22 forks source link

iwxxm.sch bugs involving SIGMET.SIGMETPosition-2 and SIGMET.SIGMETEvolvingCondition-5 #293

Closed blchoy closed 1 year ago

blchoy commented 1 year ago

Describe the bug SIGMET.SIGMETPosition-2 and SIGMET.SIGMETEvolvingCondition-5 in iwxxm.sch of IWXXM Version 2012-2 triggered incorrectly when a TC SIGMET report is being encapsulated in a COLLECT construct.

To Reproduce The example (https://gist.github.com/blchoy/0d28a25aaf91ef41cb1e3b8c593a48db) created by encapsulating sigmet-A6-2-TC.xml in a COLLECT construct cannot pass the schematron check of iwxxm.sch.

Expected behavior The example should pass the checks of the two schematron rules.

Screenshots Not applicable.

Desktop (please complete the following information): Not applicable.

Additional context Not applicable.

blchoy commented 1 year ago

The following are proposed changes to the two schematron rules:

   <sch:pattern id="SIGMET.SIGMETPosition-2">
      <sch:rule context="//iwxxm:SIGMETPosition">
              <sch:assert test="( ( ( exists(//iwxxm:TropicalCycloneSIGMET) and (count(//iwxxm:TropicalCycloneSIGMET//iwxxm:analysisCollection) = count(//iwxxm:TropicalCycloneSIGMET//iwxxm:analysisCollection//iwxxm:forecastPositionAnalysis//iwxxm:tropicalCyclonePosition) ) ) and ( exists(//iwxxm:TropicalCycloneSIGMET) and not(exists(//iwxxm:TropicalCycloneSIGMET//iwxxm:supplementaryAnalysisCollection//iwxxm:forecastPositionAnalysis//iwxxm:tropicalCyclonePosition) ) ) ) or ( not(exists(//iwxxm:TropicalCycloneSIGMET)) and (count(//iwxxm:TropicalCycloneSIGMET//iwxxm:tropicalCyclonePosition) = 0) ) )">SIGMET.SIGMETPosition-2: iwxxm:tropicalCyclonePosition shall only be present in iwxxm:analysisCollection of iwxxm:TropicalCycloneSIGMET</sch:assert>
      </sch:rule>
   </sch:pattern>
   <sch:pattern id="SIGMET.SIGMETEvolvingCondition-5">
      <sch:rule context="//iwxxm:SIGMETEvolvingCondition">
              <sch:assert test="( ( ( exists(//iwxxm:TropicalCycloneSIGMET) and (count(//iwxxm:TropicalCycloneSIGMET//iwxxm:analysisCollection) = c
ount(//iwxxm:TropicalCycloneSIGMET//iwxxm:analysisCollection//iwxxm:analysis//iwxxm:tropicalCyclonePosition) ) ) and ( exists(//iwxxm:TropicalCycloneSIGMET) and not(exists(//iwxxm:TropicalCycloneSIGMET//iwxxm:supplementaryAnalysisCollection//iwxxm:analysis//iwxxm:tropicalCyclonePosition) ) ) ) or ( not(exists(//iwxxm:TropicalCycloneSIGMET)) and (count(//iwxxm:TropicalCycloneSIGMET//iwxxm:tropicalCyclonePosition) = 0) ) )">SIGMET.SIGMETEvolvingCondition-5: iwxxm:tropicalCyclonePosition shall only be present in iwxxm:analysisCollection of iwxxm:TropicalCycloneSIGMET</sch:assert>
      </sch:rule>
   </sch:pattern> 
blchoy commented 1 year ago

It was noticed that some States were not coding the example in the APAC SIGMET Guide mentioned in #250 correctly: While iwxxm:TropicalCycloneSIGMET/iwxxm:analysisCollection has a multiplicity of [0..*], in this case there shall only be one iwxxm:analysisCollection describing the TC positions and their associated CB clouds. The remaining descriptions after "AND" in the TAC message shall be coded under iwxxm:supplementaryAnalysisCollection.

It is therefore further proposed to include a new schematron rule to enforce the use of only one iwxxm:analysisCollection in a iwxxm:TropicalCycloneSIGMET:

   <sch:pattern id="SIGMET.TropicalCycloneSIGMET-1">
      <sch:rule context="//iwxxm:TropicalCycloneSIGMET">
          <sch:assert test="( if( exists(//iwxxm:TropicalCycloneSIGMET) ) then( count(//iwxxm:TropicalCycloneSIGMET//iwxxm:analysisCollection) = 1 ) else( true() ) )">SIGMET.TropicalCycloneSIGMET-1: There shall only be one iwxxm:analysisCollection in iwxxm:TropicalCycloneSIGMET</sch:assert>
      </sch:rule>
   </sch:pattern>
amilan17 commented 1 year ago

https://github.com/wmo-im/iwxxm/wiki/TT-AvData-Teleconference-2022-Dec-09 notes:

amilan17 commented 1 year ago

It was noticed that some States were not coding the example in the APAC SIGMET Guide mentioned in #250 correctly..... 

@blchoy - Can you open a new issue for this? It would be good to keep track of separately.