Closed timronan closed 3 years ago
@timronan I think the correct date string format should be:
'%Y-%m-%dT%H:%M:%S.%f'
Note the .%f
at the end of the date string.
>>> from datetime import datetime
>>> created = datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%f')
>>> print (created)
2020-10-09T11:47:25.525567
@nick-falco thanks for the catch.
Actually it may be better to use the Obspy UTCDateTime class instead and also put a "Z" at the end of the format string. I think the times should be in UTC.
@timronan Are you planning to work on this issue?
@ascire-pic I can fix this issue but I need to finish all of my outstanding projects before I start on this one. There may be a delay before I can work on this patch.
Sounds good! Was looking through the open issues and just wanted to check.
@timronan I can start on a pull request to fix this if you haven't started working on it yet.
@gbbofh please start this PR if you have time. I will likely be able to get to it next week if it is not done before. The fix seems to be outlined in this issue.
@timronan I should have a PR fixing this issue up later today.
@gbbofh sounds good. I will review the PR when it is posted.
Describe the bug Ph5tostationxml outputs stationxml that is does not comply with the stationxml xsd schema.
Specifically the field :
Is formatted incorrectly.
It should at least have a T inbetween the day and hour, similar to:
This bug can be quickly addressed by changing the format created=datetime.now() on line 955 clients.ph5tostationxml to created=datetime.now().isoformat(sep='T') or created=datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
Environment (please complete the following information):
To Reproduce Steps to reproduce the behavior: run ph5tostationxml run the output stationxml document through the validator. Expected behavior Output stationxml doucment should pass validation.
Additional context Issue started to occur after updating obspy. We should be explicit with our date times so we don't run into this issue.