Repository: obspy/obspy

Issue:
StationXML schema update to 1.2
Looks like there are preparations on the way for an updated StationXML schema version 1.2 (see e.g. https://github.com/FDSN/StationXML/pull/148). If I understand correctly it will only be changes in documentation, so we will probably just have to copy in the new schema and change `SCHEMA_VERSION` in `io/stationxml/core.py`. Not sure when it will be released though. 

CC @crotwell


Discussion:

Resolving patch:
diff --git a/obspy/io/stationxml/core.py b/obspy/io/stationxml/core.py
--- a/obspy/io/stationxml/core.py
+++ b/obspy/io/stationxml/core.py
@@ -37,8 +37,8 @@
 # Define some constants for writing StationXML files.
 SOFTWARE_MODULE = "ObsPy %s" % obspy.__version__
 SOFTWARE_URI = "https://www.obspy.org"
-SCHEMA_VERSION = "1.1"
-READABLE_VERSIONS = ("1.0", "1.1")
+SCHEMA_VERSION = "1.2"
+READABLE_VERSIONS = ("1.0", "1.1", "1.2")
 
 
 def _get_version_from_xmldoc(xmldoc):
@@ -63,7 +63,7 @@ def _get_version_from_xmldoc(xmldoc):
 def _is_stationxml(path_or_file_object):
     """
     Simple function checking if the passed object contains a valid StationXML
-    1.0 or StationXML 1.1 file. Returns True of False.
+    1.x file. Returns True of False.
 
     The test is not exhaustive - it only checks the root tag but that should
     be good enough for most real world use cases. If the schema is used to


Test patch:
diff --git a/obspy/io/stationxml/tests/data/full_network_field_station.xml b/obspy/io/stationxml/tests/data/full_network_field_station.xml
--- a/obspy/io/stationxml/tests/data/full_network_field_station.xml
+++ b/obspy/io/stationxml/tests/data/full_network_field_station.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<FDSNStationXML schemaVersion="1.1" xmlns="http://www.fdsn.org/xml/station/1">
+<FDSNStationXML schemaVersion="1.2" xmlns="http://www.fdsn.org/xml/station/1">
   <Source>OBS</Source>
   <Sender>The ObsPy Team</Sender>
   <Module>Some Random Module</Module>
diff --git a/obspy/io/stationxml/tests/data/full_random_stationxml.xml b/obspy/io/stationxml/tests/data/full_random_stationxml.xml
--- a/obspy/io/stationxml/tests/data/full_random_stationxml.xml
+++ b/obspy/io/stationxml/tests/data/full_random_stationxml.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<FDSNStationXML xmlns="http://www.fdsn.org/xml/station/1" schemaVersion="1.1">
+<FDSNStationXML xmlns="http://www.fdsn.org/xml/station/1" schemaVersion="1.2">
     <Source>vT.HEbXDVzmI9Jak5SHOC30dI</Source>
     <Sender>Ia3zIdiZj</Sender>
     <Module>pZr</Module>
diff --git a/obspy/io/stationxml/tests/data/full_station_field_station.xml b/obspy/io/stationxml/tests/data/full_station_field_station.xml
--- a/obspy/io/stationxml/tests/data/full_station_field_station.xml
+++ b/obspy/io/stationxml/tests/data/full_station_field_station.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<FDSNStationXML schemaVersion="1.1" xmlns="http://www.fdsn.org/xml/station/1">
+<FDSNStationXML schemaVersion="1.2" xmlns="http://www.fdsn.org/xml/station/1">
   <Source>OBS</Source>
   <Sender>The ObsPy Team</Sender>
   <Module>Some Random Module</Module>
diff --git a/obspy/io/stationxml/tests/data/minimal_station.xml b/obspy/io/stationxml/tests/data/minimal_station.xml
--- a/obspy/io/stationxml/tests/data/minimal_station.xml
+++ b/obspy/io/stationxml/tests/data/minimal_station.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<FDSNStationXML schemaVersion="1.1" xmlns="http://www.fdsn.org/xml/station/1">
+<FDSNStationXML schemaVersion="1.2" xmlns="http://www.fdsn.org/xml/station/1">
   <Source>OBS</Source>
   <Created>2013-01-01T00:00:00.000000Z</Created>
   <Network code="PY"/>
diff --git a/obspy/io/stationxml/tests/data/minimal_station_with_microseconds.xml b/obspy/io/stationxml/tests/data/minimal_station_with_microseconds.xml
--- a/obspy/io/stationxml/tests/data/minimal_station_with_microseconds.xml
+++ b/obspy/io/stationxml/tests/data/minimal_station_with_microseconds.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<FDSNStationXML schemaVersion="1.1" xmlns="http://www.fdsn.org/xml/station/1">
+<FDSNStationXML schemaVersion="1.2" xmlns="http://www.fdsn.org/xml/station/1">
   <Source>OBS</Source>
   <Module/>
   <ModuleURI/>
diff --git a/obspy/io/stationxml/tests/data/minimal_with_non_obspy_module_and_sender_tags_station.xml b/obspy/io/stationxml/tests/data/minimal_with_non_obspy_module_and_sender_tags_station.xml
--- a/obspy/io/stationxml/tests/data/minimal_with_non_obspy_module_and_sender_tags_station.xml
+++ b/obspy/io/stationxml/tests/data/minimal_with_non_obspy_module_and_sender_tags_station.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<FDSNStationXML schemaVersion="1.1" xmlns="http://www.fdsn.org/xml/station/1">
+<FDSNStationXML schemaVersion="1.2" xmlns="http://www.fdsn.org/xml/station/1">
   <Source>OBS</Source>
   <Sender>The ObsPy Team</Sender>
   <Module>Some Random Module</Module>
diff --git a/obspy/io/stationxml/tests/data/stationxml_with_availability.xml b/obspy/io/stationxml/tests/data/stationxml_with_availability.xml
--- a/obspy/io/stationxml/tests/data/stationxml_with_availability.xml
+++ b/obspy/io/stationxml/tests/data/stationxml_with_availability.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<FDSNStationXML xmlns="http://www.fdsn.org/xml/station/1" schemaVersion="1.1">
+<FDSNStationXML xmlns="http://www.fdsn.org/xml/station/1" schemaVersion="1.2">
  <Source>IRIS-DMC</Source>
  <Sender>IRIS-DMC</Sender>
  <Module>IRIS WEB SERVICE: fdsnws-station | version: 1.1.4</Module>