[segyio] 134/376: __str__ for SegyFile

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit a21f27900df7111f2b6e08e43fd0054d6465f0e6
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Mon Nov 21 17:17:04 2016 +0100

    __str__ for SegyFile
---
 python/segyio/segy.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/python/segyio/segy.py b/python/segyio/segy.py
index b630cb5..0f1d3db 100644
--- a/python/segyio/segy.py
+++ b/python/segyio/segy.py
@@ -60,6 +60,24 @@ class SegyFile(object):
 
         super(SegyFile, self).__init__()
 
+    def __str__(self):
+        f = "SegyFile {}:".format(self._filename)
+        il =  "  inlines: {} [{}, {}]".format(len(self.ilines), self.ilines[0], self.ilines[-1])
+        xl =  "  crosslines: {} [{}, {}]".format(len(self.xlines), self.xlines[0], self.xlines[-1])
+        tr =  "  traces: {}".format(self.tracecount)
+        sm =  "  samples: {}".format(self.samples)
+        of =  "  offsets: {} [{}, {}]".format(len(self.offsets), self.offsets[0], self.offsets[-1])
+        fmt = "  float representation: {}".format(self.format)
+
+        props = [f, il, xl, tr, sm]
+
+        if len(self.offsets) > 1:
+            props.append(of)
+
+        props.append(fmt)
+        return '\n'.join(props)
+
+
     def __repr__(self):
         return "SegyFile('{}', '{}', iline = {}, xline = {})".format(
                         self._filename, self._mode, self._il, self._xl)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list