iris-edu / stationxml-validator

GNU General Public License v3.0
16 stars 8 forks source link

Missing Sample Rate (optional element) raises error #143

Open anss-sis opened 2 years ago

anss-sis commented 2 years ago

SampleRate element (under Channel) is optional. For pre-digital channels there is no sample rate so the SIS writer did not write out the SampleRate element. The IRIS validator failed with this error:

[2021-11-18 17:02:29] [SEVERE] edu.iris.dmc.Application exitWithError: edu.iris.dmc.station.conditions.SampleRateCondition.evaluate(SampleRateCondition.java:41) edu.iris.dmc.station.rules.Rule.execute(Rule.java:44) edu.iris.dmc.station.RuleEngineService.executeAllRules(RuleEngineService.java:160) edu.iris.dmc.station.RuleEngineService.executeAllRules(RuleEngineService.java:142) edu.iris.dmc.station.RuleEngineService.executeAllRules(RuleEngineService.java:108) edu.iris.dmc.station.RuleEngineService.executeAllRules(RuleEngineService.java:47) edu.iris.dmc.Application.run(Application.java:183) edu.iris.dmc.Application.run(Application.java:168) edu.iris.dmc.Application.run(Application.java:147) edu.iris.dmc.Application.main(Application.java:118)

Putting an empty value or None value are invalid as per the xml schema rules. So the following options are not possible:

None and That means the only way to write it out is not have the element in the xml. Please update the code to accept this case. Thanks, Prabha
jcrummey commented 2 years ago

I created a new issue (#144) to address Rule 305 and using a value of 0 for Channel:SampleRate to characterize pre-digital channels. Using 0 seems preferred to omitting the Channel:SampleRate element. However, the validator should allow the omission (maybe with just a warning) since it is an optional element.