# weird behaviour StationXML start and end dates

**URL:** <https://discourse.obspy.org/t/weird-behaviour-stationxml-start-and-end-dates/770>\
**Category:** Users Mailing List Archive\
**Tags:** archive\
**Created:** [April 17, 2018, 2:30pm UTC](https://discourse.obspy.org/t/weird-behaviour-stationxml-start-and-end-dates/770 "2018-04-17T14:30:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florian\_Fuchs](https://discourse.obspy.org/letter_avatar_proxy/v4/letter/f/858c86/32.png) [@Florian\_Fuchs](https://discourse.obspy.org/u/Florian_Fuchs)\
**Post date:** [April 17, 2018, 2:30pm UTC](https://discourse.obspy.org/t/weird-behaviour-stationxml-start-and-end-dates/770/1 "2018-04-17T14:30:21Z")

</div>

Dear all,

I just came accross some strange behaviour of the creation\_date and termination\_date within inventory objects read from StationXML.

For some StationXML files (I cannot yet say which ones), the printed creation\_date and termination\_date are not identical to the returned ones. For example, there is one StationXML file which I created in the following way

inv = read\_inventroy(‘dataless SEED’) # read a dataless SEED into inventory object  
inv.write(stationxml, format=‘STATIONXML’) # write inventory object into StationXML file

For this particular file the creation\_date printed on the screen and the creation\_date returned with the .creation\_date function are not identical:

inv.select(station=‘station’)[0][0]  
will print me the station summary read from the StationXML including the correct installation date of the station.

However,  
inv.select(station=‘station’)[0][0].creation\_date  
will return the date at which the original dataless SEED file was created and not the corretly printed installation date of the station. This is a reproducible error.

Most of the StationXML that were created using inv.write() after downloading via ObsPy webservices implementation do behave correctly, though. Yet not all of them. For some stations I run into troubles also with the termination\_date. E.g. sometimes

inv.select(station=‘station’)[0][0]  
prints the correct installation and removal date on screen but

inv.select(station=‘station’)[0][0].termination\_date  
will return only “None”

I cannot tell though if there is some kind of systematics behind it, since only few stations are affected and all of the metadata was downloaded via obspy webservices implementation and directly written into StationXML. For what I can tell all stations affected by the termination\_date bug above have more than one entry within the StationXML, each of them representing a separate instrumentation epoch.

What I can reproduce safely is the wrong returned creation\_date (although the printed one is correct) for StationXMLs that were created with ObsPy via reading from a dataless SEED.

Best,  
Florian

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ Dr. Florian Fuchs Department of Meteorology and Geophysics University of Vienna UZA II, 2D508 Althanstraße 14 1090 Vienna Austria Phone: +43 1 4277 53726 Mobile: +43 664 60277 53726 www: [http://imgw.univie.ac.at](http://imgw.univie.ac.at) \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

---

<div class="post-metadata">

**Author:** ![LionKrischer](https://discourse.obspy.org/user_avatar/discourse.obspy.org/lionkrischer/32/219_2.png) [@LionKrischer](https://discourse.obspy.org/u/LionKrischer)\
**Post date:** [April 18, 2018, 9:39am UTC](https://discourse.obspy.org/t/weird-behaviour-stationxml-start-and-end-dates/770/2 "2018-04-18T09:39:45Z")

</div>

Hi Florian,

I think you are mixing up some of the times.

The string representation of Station objects within ObsPy contains the `start_date` and `end_date` fields (or `StartDate` and `EndDate` in the StationXML). These correspond to the “Start effective date”, “Start date”, … and so on fields in the SEED blockettes and denote the start and end of epochs. The end dates might be None if an epoch is still active. They also exist at each level, e.g. network, station, and channel.

Stations in StationXML files also have `CreationDate` and `TerminationDate` (`creation_date` and `termination_date` in ObsPy’s mapping) attributes which are independent of epochs and should denote the full life time of stations. These are not available in SEED files and so ObsPy should not set them when reading SEED files.

I just realized that ObsPy, when reading SEED files, sets the creation date to either the SEED volume time if available or the the current time. This is wrong and we’ll fix it.

When reading StationXML files, for example from web services, all the dates should be set correctly.

I hope this clears up the confusion.

Best,

Lion

---

<div class="post-metadata">

**Author:** ![Florian\_Fuchs](https://discourse.obspy.org/letter_avatar_proxy/v4/letter/f/858c86/32.png) [@Florian\_Fuchs](https://discourse.obspy.org/u/Florian_Fuchs)\
**Post date:** [April 19, 2018, 11:27am UTC](https://discourse.obspy.org/t/weird-behaviour-stationxml-start-and-end-dates/770/3 "2018-04-19T11:27:31Z")

</div>

Hi Lion,

thanks for the quick reply and the clarification. I indeed misinterpreted creation\_date and termination\_date … these were the only two times listed in the documentation:

[https://docs.obspy.org/packages/autogen/obspy.core.inventory.station.Station.html#obspy.core.inventory.station.Station](https://docs.obspy.org/packages/autogen/obspy.core.inventory.station.Station.html#obspy.core.inventory.station.Station)

Best,  
Florian
