Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renaming obspy.io.datamark to obspy.io.win #1717

Merged
merged 5 commits into from Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 12 additions & 7 deletions CHANGELOG.txt
Expand Up @@ -59,20 +59,23 @@ master: (doi: 10.5281/zenodo.165135)
goes to white instead of yellow but remains perceptually uniform. It
is especially useful for printing when an image should merge with the
white background.
- obspy.imaging.waveform
- obspy.imaging.waveform:
* Support for filling the wiggles when plotting sections (horizontal and
vertical, see #1445).
- obspy.io.gse2
- obspy.io.datamark:
* Renamed without deprectation to obspy.io.win to match its original name.
Datamark is a datalogger, saving the WIN format.
- obspy.io.gse2:
* Read support for GSE2.0 bulletin (see #1528)
- obspy.io.nlloc
- obspy.io.nlloc:
* Also parse author information and COMMENT line (see #1484)
- obspy.io.quakeml
- obspy.io.quakeml:
* Read and write support for nested custom tags (see #1463)
- obspy.io.seiscomp
- obspy.io.seiscomp:
* Write support for SC3ML event (see #1638)
- obspy.io.stationtxt
- obspy.io.stationtxt:
* Write support for stationtxt format (see #1466)
- obspy.io.stationxml
- obspy.io.stationxml:
* Read and write support for custom tags (see #1024)
* No longer add the (unused) time zone field to StationXML datetimes to
follow the example of big data centers. (see #1572)
Expand All @@ -94,6 +97,8 @@ master: (doi: 10.5281/zenodo.165135)
* Set preferred origin of event (see #1570)
- obspy.io.nordic:
* Add Nordic format (s-file) read/write (see #1517)
- obspy.io.win:
* see obspy.io.datamark.
- obspy.io.xseed:
* Added azimuth and dip to the get_coordinates() function. (see #1315)
- obspy.scripts:
Expand Down
2 changes: 1 addition & 1 deletion obspy/core/util/base.py
Expand Up @@ -32,7 +32,7 @@
# defining ObsPy modules currently used by runtests and the path function
DEFAULT_MODULES = ['clients.filesystem', 'core', 'db', 'geodetics', 'imaging',
'io.ah', 'io.ascii', 'io.cmtsolution', 'io.cnv', 'io.css',
'io.datamark', 'io.gcf', 'io.gse2', 'io.json',
'io.win', 'io.gcf', 'io.gse2', 'io.json',
'io.kinemetrics', 'io.kml', 'io.mseed', 'io.ndk',
'io.nied', 'io.nlloc', 'io.nordic', 'io.pdas', 'io.pde',
'io.quakeml', 'io.reftek', 'io.sac', 'io.seg2', 'io.segy',
Expand Down
14 changes: 9 additions & 5 deletions obspy/io/datamark/README.txt → obspy/io/win/README.txt
@@ -1,24 +1,28 @@
package obspy.io.datamark
package obspy.io.win
=========================
Copy link
Member

@megies megies Mar 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header underline needs adjustment


Copyright
---------
GNU Lesser General Public License, Version 3 (LGPLv3)

Copyright (c) 2012-2013 by:
Copyright (c) 2012-2017 by:
* Thomas Lecocq
* Adolfo Inza
* Philippe Lesage


Overview
--------
DataMark read support for ObsPy.
WIN read support for ObsPy.

This module provides read support for DataMark data format. This module is
This module provides read support for WIN data format. This module is
based on the code of Adolfo Inza and Philippe Lesage of the "Géophysique des
volcans" team of the "Institut des Sciences de la Terre de l'Université de
Savoie", France.
Savoie", France. This format is written by different dataloggers, including
Hakusan LS-7000XT Datamark dataloggers. There are two subformats, A0 and A1.
To our knowledge, A0 is the only one supported with the current code. A0
conforms to the data format of the WIN system developed by Earthquake Research
Institute (ERI), the University of Tokyo.

ObsPy is an open-source project dedicated to provide a Python framework for
processing seismological data. It provides parsers for common file formats and
Expand Down
11 changes: 8 additions & 3 deletions obspy/io/datamark/__init__.py → obspy/io/win/__init__.py
@@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
"""
obspy.io.datamark - DataMark read support for ObsPy
===================================================
This module provides read support for DataMark waveform data.
obspy.io.win - WIN read support for ObsPy
=========================================
This module provides read support for WIN waveform data. This format is
written by different dataloggers, including Hakusan LS-7000XT Datamark
dataloggers. There are two subformats, A0 and A1. To our knowledge, A0 is the
only one supported with the current code. A0 conforms to the
data format of the WIN system developed by Earthquake Research Institute
(ERI), the University of Tokyo.

:copyright:
The ObsPy Development Team (devs@obspy.org), Thomas Lecocq, Adolfo Inza &
Expand Down
18 changes: 9 additions & 9 deletions obspy/io/datamark/core.py → obspy/io/win/core.py
Expand Up @@ -14,14 +14,14 @@
from obspy import Stream, Trace, UTCDateTime


def _is_datamark(filename, century="20"): # @UnusedVariable
def _is_win(filename, century="20"): # @UnusedVariable
"""
Checks whether a file is DATAMARK or not.
Checks whether a file is WIN or not.

:type filename: str
:param filename: DATAMARK file to be checked.
:param filename: WIN file to be checked.
:rtype: bool
:return: ``True`` if a DATAMARK file.
:return: ``True`` if a WIN file.
"""
# as long we don't have full format description we just try to read the
# file like _read_datamark and check for errors
Expand Down Expand Up @@ -52,25 +52,25 @@ def _is_datamark(filename, century="20"): # @UnusedVariable
return True


def _read_datamark(filename, century="20", **kwargs): # @UnusedVariable
def _read_win(filename, century="20", **kwargs): # @UnusedVariable
"""
Reads a DATAMARK file and returns a Stream object.
Reads a WIN file and returns a Stream object.

.. warning::
This function should NOT be called directly, it registers via the
ObsPy :func:`~obspy.core.stream.read` function, call this instead.

:type filename: str
:param filename: DATAMARK file to be read.
:param century: DATAMARK stores year as 2 numbers, need century to
:param filename: WIN file to be read.
:param century: WIN stores year as 2 numbers, need century to
construct proper datetime.
:rtype: :class:`~obspy.core.stream.Stream`
:returns: Stream object containing header and data.
"""
output = {}
srates = {}

# read datamark file
# read win file
with open(filename, "rb") as fpin:
fpin.seek(0, 2)
sz = fpin.tell()
Expand Down
@@ -1,30 +1,30 @@
Delivery-Date: Mon, 25 Jun 2012 09:45:50 +0200
To: barsch@egu.eu
Cc: support@hakusan.co.jp
Subject: Re: DataMark format description
From: Akiko Hakamada <hakamada@hakusan.co.jp>
Dear Sir
Thank you for your inquiry.
We send a part of DATAMARK LS-7000XT user's manual as a format
description document.
Attached file name: E-MAN_LS-7000XT_7_format.pdf
Some of our products uses two kind of data format, type A0 and A1.
Type A0 is also called "win format", and A1 is extended version of it.
We recommend you to support type A0, because type A0 conforms to the
data format of the WIN system developed by Earthquake Research Institute
(ERI), the University of Tokyo, but type A1 is not recently used in most
our product.
Please see the web page of ERI.
 http://eoc.eri.u-tokyo.ac.jp/cgi-bin/show_man_en?winformat
Best Regards,
-------------------
Akiko Hakamada
Hakusan Corporation
Delivery-Date: Mon, 25 Jun 2012 09:45:50 +0200
To: barsch@egu.eu
Cc: support@hakusan.co.jp
Subject: Re: DataMark format description
From: Akiko Hakamada <hakamada@hakusan.co.jp>



Dear Sir

Thank you for your inquiry.

We send a part of DATAMARK LS-7000XT user's manual as a format
description document.
Attached file name: E-MAN_LS-7000XT_7_format.pdf

Some of our products uses two kind of data format, type A0 and A1.
Type A0 is also called "win format", and A1 is extended version of it.
We recommend you to support type A0, because type A0 conforms to the
data format of the WIN system developed by Earthquake Research Institute
(ERI), the University of Tokyo, but type A1 is not recently used in most
our product.

Please see the web page of ERI.
 http://eoc.eri.u-tokyo.ac.jp/cgi-bin/show_man_en?winformat

Best Regards,
-------------------
Akiko Hakamada
Hakusan Corporation
Expand Up @@ -8,7 +8,7 @@
from obspy.core.util import add_doctests, add_unittests


MODULE_NAME = "obspy.io.datamark"
MODULE_NAME = "obspy.io.win"


def suite():
Expand Down
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The obspy.io.datamark.core test suite.
The obspy.io.win.core test suite.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
Expand All @@ -12,12 +12,12 @@

from obspy import read
from obspy.core.utcdatetime import UTCDateTime
from obspy.io.datamark.core import _read_datamark
from obspy.io.win.core import _read_win


class CoreTestCase(unittest.TestCase):
"""
Test cases for datamark core interface
Test cases for win core interface
"""
def setUp(self):
# directory where the test files are located
Expand Down Expand Up @@ -45,11 +45,11 @@ def test_read_via_obspy(self):

def test_read_via_module(self):
"""
Read files via obspy.io.datamark.core._read_datamark function.
Read files via obspy.io.win.core._read_datamark function.
"""
filename = os.path.join(self.path, '10030302.00')
# 1
st = _read_datamark(filename)
st = _read_win(filename)
st.verify()
st.sort(keys=['channel'])
self.assertEqual(len(st), 2)
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Expand Up @@ -85,7 +85,7 @@
KEYWORDS = [
'ArcLink', 'array', 'array analysis', 'ASC', 'beachball',
'beamforming', 'cross correlation', 'database', 'dataless',
'Dataless SEED', 'datamark', 'earthquakes', 'Earthworm', 'EIDA',
'Dataless SEED', 'win', 'earthquakes', 'Earthworm', 'EIDA',
'envelope', 'ESRI', 'events', 'FDSN', 'features', 'filter',
'focal mechanism', 'GCF', 'GSE1', 'GSE2', 'hob', 'Tau-P', 'imaging',
'instrument correction', 'instrument simulation', 'IRIS', 'kinemetrics',
Expand Down Expand Up @@ -142,7 +142,7 @@
'SLIST = obspy.io.ascii.core',
'PICKLE = obspy.core.stream',
'CSS = obspy.io.css.core',
'DATAMARK = obspy.io.datamark.core',
'WIN = obspy.io.win.core',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. In general I agree that we can make an exception here and allow the module move/renaming without deprecation reroute, as people have no reason to use the low level routines.

But.. we could still break peoples' codes if they circumvent the filetype detection, i.e. if they do read(..., format='DATAMARK').

Maybe we should leave the DATAMARK plugin in there (pointing to new io.win)?

Also, maybe we should wait with merging until it's clear how this one and #1692 will play together?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it work to state:

'DATAMARK = obspy.io.win.core',
'WIN = obspy.io.win.core',

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also the other plugin lines.. yeah.. not sure about any negative side effects, but probably it should be OK like this..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just a dummy obspy.io.datamark.core that answers it not longer exists and returns /dies. not a clean deprecation... but yah...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that answers it not longer exists and returns /dies

If you do a deprecation, than it shouldn't raise but rather show a warning and use the new location at obspy.io.win

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and stay until 1.2 ? pfff not sure...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do a deprecation, it will be in there for 1.1.* and removed again for 1.2.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThomasLecocq do you want to add a deprecation or leave as is? We plan to freeze 1.1.0 on Sunday so if this PR should be in there it should be ready by then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to keep this as-is... I don't know many users of this routine anyway, and I've modified the docstring so that a simple googling should show DATAMARK in the io.win explanation

'KINEMETRICS_EVT = obspy.io.kinemetrics.core',
'GSE1 = obspy.io.gse2.core',
'GSE2 = obspy.io.gse2.core',
Expand Down Expand Up @@ -187,9 +187,9 @@
'isFormat = obspy.io.css.core:_is_nnsa_kb_core',
'readFormat = obspy.io.css.core:_read_nnsa_kb_core',
],
'obspy.plugin.waveform.DATAMARK': [
'isFormat = obspy.io.datamark.core:_is_datamark',
'readFormat = obspy.io.datamark.core:_read_datamark',
'obspy.plugin.waveform.WIN': [
'isFormat = obspy.io.win.core:_is_win',
'readFormat = obspy.io.win.core:_read_win',
],
'obspy.plugin.waveform.KINEMETRICS_EVT': [
'isFormat = obspy.io.kinemetrics.core:is_evt',
Expand Down