core.write does not preserve starttime precision

hello,

is that OK?

In [1]: from obspy.core import read

In [2]: A = read('test_A.mseed')

In [3]: A[0].stats.starttime.precision
Out[3]: 6

In [4]: A[0].stats.starttime.precision = 5

In [5]: A[0].stats.starttime.precision
Out[5]: 5

In [6]: A.write('test_B.mseed', format='MSEED')

In [7]: B = read('test_B.mseed')

In [8]: B[0].stats.starttime.precision = 5

In [9]: B = read('test_B.mseed')

In [10]: B[0].stats.starttime.precision
Out[10]: 6

Dear Emiliano,

there are multiple issues with the script you attached

1. the used precision will not be stored into the MiniSEED file itself -
AFAIK there is not even a way to to that

2. line 9 completely overwrites variable B, ignoring line 8 and
therefore using the default precision of 6

3. setting a precision on a certain UTCDateTime object will not set the
precision globally

Take a look at
http://docs.obspy.org/packages/autogen/obspy.core.utcdatetime.UTCDateTime.html#precision
(second option) on how to set/unset this for your application on a
global scope (needs trunk as its not released yet).

Precision support is not trivial and has been recently added - I expect
some bugs :wink:

Hope it helps,
Robert

hello,

is that OK?

In [1]: from obspy.core import read

In [2]: A = read('test_A.mseed')

In [3]: A[0].stats.starttime.precision
Out[3]: 6

In [4]: A[0].stats.starttime.precision = 5

In [5]: A[0].stats.starttime.precision
Out[5]: 5

In [6]: A.write('test_B.mseed', format='MSEED')

In [7]: B = read('test_B.mseed')

In [8]: B[0].stats.starttime.precision = 5

In [9]: B = read('test_B.mseed')

In [10]: B[0].stats.starttime.precision
Out[10]: 6

_______________________________________________
obspy-users mailing list
obspy-users@lists.sevor.de
http://lists.obspy.org/cgi-bin/mailman/listinfo/obspy-users

- --
Dr. Robert Barsch

EGU Office Munich
Luisenstr. 37
80333 Munich
Germany

Phone: +49-89-21806549
Fax: +49-89-218017855
eMail: barsch@egu.eu