[segyio] 04/376: Scan for min max sample
Jørgen Kvalsvik
jokva-guest at moszumanska.debian.org
Wed Sep 20 08:03:57 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 7f0723511fc9a0251dfd7d65b5413ec2583fa0da
Author: Kjell W. Kongsvik <kwko at statoil.com>
Date: Mon Oct 3 13:00:55 2016 +0200
Scan for min max sample
Example program
---
examples/CMakeLists.txt | 2 +-
examples/scan_min_max.py | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 2c1f261..9eca648 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -5,4 +5,4 @@ add_python_example(python.examples.about about.py test-data/small.sgy INLINE_3D
add_python_example(python.examples.write write.py test-data/small.sgy)
add_python_example(python.examples.makefile make-file.py test-data/large-file.sgy 20 1 20 1 20)
add_python_example(python.examples.subcube copy-sub-cube.py test-data/small.sgy test-data/copy.sgy)
-
+add_python_example(python.examples.scan_min_max scan_min_max.py test-data/small.sgy)
diff --git a/examples/scan_min_max.py b/examples/scan_min_max.py
new file mode 100644
index 0000000..678f2a4
--- /dev/null
+++ b/examples/scan_min_max.py
@@ -0,0 +1,24 @@
+import sys
+import segyio
+import numpy as np
+
+
+def main():
+ if len(sys.argv) < 2:
+ sys.exit("Usage: {} [segyfile] ".format(sys.argv[0]))
+
+ segyfile = sys.argv[1]
+
+ min_value = sys.float_info.max
+ max_value = sys.float_info.min
+
+ with segyio.open(segyfile) as f:
+ for trace in f.trace:
+ min_value = min(np.amin(trace), min_value)
+ max_value = max(np.amin(trace), max_value)
+
+ print "min: {}".format(min_value)
+ print "max: {}".format(max_value)
+
+if __name__ == '__main__':
+ main()
--
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