From: Pierre Choffet Date: Wed, 23 Oct 2019 23:52:16 +0000 (-0400) Subject: Add transformation to fix ECCC XML files X-Git-Url: https://git.wikimedia.ca/?a=commitdiff_plain;h=d5920c8c99f839f2081236b0174717f0fb40d885;p=eccc_to_commons.git Add transformation to fix ECCC XML files The monthly files are provided with an error on the root element. The eccc_fixer.xslt fixes it so it can be validated before processing. --- d5920c8c99f839f2081236b0174717f0fb40d885 diff --git a/commons_rules.xsd b/commons_rules.xsd new file mode 100644 index 0000000..1bfd00d --- /dev/null +++ b/commons_rules.xsd @@ -0,0 +1,962 @@ + + + + + + + + + + + + + + + + + + + + For consistency reasons in names and numeric formats, we enforce import of English files in Commons. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WARNING: latitude can be zero + + + + + + + + + + + WARNING: en_climate_monthly_NB_8104200_1872-1952_P1M.xml is in Russia + + + + + + + + + + + + + + + WARNING: longitude can be zero + + + + + + + + + + + WARNING: en_climate_monthly_NB_8104200_1872-1952_P1M.xml is in Russia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [empty] is an allowed value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + flag attribute has only one value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + meanmaxtemp must be provided in °C. + + + + + + + + + + + + meanmaxtemp flag can be E I or M only. + + + + + + + + + + + + + + + + meanmintemp must be provided in °C. + + + + + + + + + + + + meanmintemp flag can be E I or M only. + + + + + + + + + + + + + + + + meanmonthtemp must be provided in °C. + + + + + + + + + + + + meanmonthtemp flag can be E I or M only. + + + + + + + + + + + + + + + + extrmaxtemp must be provided in °C. + + + + + + + + + + + + extrmaxtemp flag can be B E I M or S only. + + + + + + + + + + + + + + + + + + extrmintemp must be provided in °C. + + + + + + + + + + + + extrmintemp flag can be B E I M or S only. + + + + + + + + + + + + + + + + + + totrain unit must be provided in mm. + + + + + + + + + + + + totrain flag can be E I M or T only. + + + + + + + + + + + + + + + + + totsnow unit must be provided in cm. + + + + + + + + + + + + totrain flag can be E I M or T only. + + + + + + + + + + + + + + + + + totprecip unit must be provided in mm. + + + + + + + + + + + + totprecip flag can be E I M or T only. + + + + + + + + + + + + + + + + + grndsnowlastday unit must be provided in cm. + + + + + + + + + + + + grndsnowlastday flag can be E M or T only. + + + + + + + + + + + + + + + + dirmaxgust unit must be provided in 10's Deg. + + + + + + + + + + + + dirmaxgust flag can be B E I M or S only. + + + + + + + + + + + + + + + + + + speedmaxgust unit must be provided in km/h. + + + + + + + + + + + + speedmaxgust flag can be B E I M or S only. + + + + + + + + + + + + + + + + + + + + + Max value is currently 19.3. + + + + + + + + + + + + + + + + Max value is currently 22.3. + + + + + + + + + + + + + + + + Max value is currently 27.2. + + + + + + + + + + + + + + + + Max value is currently 45.0. + + + + + + + + + + + + + + + + Max value is currently 37.3. + + + + + + + + + + + + WARNING: + 17/monthly/en_climate_monthly_BC_1010720_1910-1971_P1M.xml:32:616122 + Contains only sharps instead of a float or empty content + + + + + + + + TBD: Max value is currently 999.2. + Is it expected? Looks high and arbitrary cut at 1000. + + + + + + + + + + + + No value is allowed + + + + + + + WARNING: + monthly/3953/en_climate_monthly_ON_6032119_1970-2004_P1M.xml:32:261659 + Has negative totsnow value (-15.1) + + + + + + Max value is currently 725.9. + + + + + + + + + + + + WARNING: + 17/monthly/en_climate_monthly_BC_1010720_1910-1971_P1M.xml:32:73731 + Contains only sharps instead of a float or empty content + + + + + + + No negative precipitation value allowed. + + + + + + Max value is currently 999.2. + Is it expected? Looks high and arbitrary cut at 1000. + + + + + + + + + + + + No value is allowed + + + + + + + No negative precipitation value allowed. + + + + + + Max value is currently 955. + Is it expected? Looks high and arbitrary cut at 1000. + + + + + + + + + + + + No value is allowed + + + + + + + No negative orientation value allowed. Value of 0 is allowed + + + + + + WARNING: Value of 36 is allowed. + + + + + + + + + + + + No value is allowed + + + + + + + No negative speed allowed. + + + + + + WARNING: Max value is currently 467. + Probably an error + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eccc_fixer.xslt b/eccc_fixer.xslt new file mode 100644 index 0000000..b62098a --- /dev/null +++ b/eccc_fixer.xslt @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + http://climate.weather.gc.ca/climate_data/bulkxml/bulkschema.xsd + + + +