Api Overview¶
Create Seismic API client¶
Before we can do anything, we need to create a client that can interact with the Cognite Seismic API.
[1]:
from cognite.seismic import CogniteSeismicClient
[4]:
import os
import getpass
api_key = os.environ.get("COGNITE_API_KEY")
if api_key is None:
api_key = getpass.getpass("Enter your Cognite API key: ")
client = CogniteSeismicClient(
api_key=api_key,
base_url="https://api.cognitedata.com:443",
project="public"
)
Register a survey¶
Before registering a Segy file, we first need to register a survey to act as a container for the Segy file.
[10]:
survey_name = "my_new_survey"
[12]:
# Register our survey. If it already exists, an exception will be thrown.
from grpc import RpcError
try:
my_survey = client.survey.register(survey_name)
print(my_survey)
except RpcError as e:
print(e._state.details)
survey with name: my_new_survey already exists.
[13]:
# We can also attach metadata to a survey when registering it.
try:
my_survey_2 = client.survey.register(survey_name + "_meta", {"area": "B13", "processed": "False"})
print(my_survey_2)
except RpcError as e:
print(e._state.details)
survey with name: my_new_survey_meta already exists.
Retrieve a survey¶
There are multiple methods for finding an existing survey such as by id, by name, by listing the surveys, or by searching for surveys that intersect with a given coverage.
Retrieve a survey by name¶
[15]:
my_survey = client.survey.get(survey_name=survey_name)
print(my_survey)
survey {
id: "6ef538bb-ad42-4eef-af7e-99d2497e85ae"
name: "my_new_survey"
}
List all available surveys¶
[16]:
# list all surveys
surveys = client.survey.list()
print(surveys)
surveys {
id: "5b7bba87-41f1-42ac-b205-a3e64d83004c"
name: "TUN15M02"
}
surveys {
id: "d879de35-2999-4628-af72-b413ea4e5ee1"
name: "F3"
}
surveys {
id: "24f2a3df-1464-4a6c-b563-7a7061d24da2"
name: "third"
}
surveys {
id: "32335957-7d69-4214-a1b3-d12110241bec"
name: "Test Geospatial"
}
surveys {
id: "bab2b37d-90df-4198-8d62-d191e1425bd8"
name: "Test Geospatial1"
}
surveys {
id: "cfb9fc2a-bb0c-4e11-adea-53576307336c"
name: "test"
}
surveys {
id: "dda57888-6718-49c4-b65c-130fa0339d7a"
name: "test-survey-upload"
}
surveys {
id: "c833290c-eafd-4f08-9a8f-4ec114b0c4fd"
name: "Hellos"
}
surveys {
id: "83c0d4b1-37ec-4212-97ef-335e8138e9f3"
name: "my_survey_1"
}
surveys {
id: "67b37045-32ae-417a-a39d-66b991c53f54"
name: "my_survey_2"
}
surveys {
id: "6d487b6c-b90d-4c2f-aa69-40213b94d0b6"
name: "my_survey"
}
surveys {
id: "6ef538bb-ad42-4eef-af7e-99d2497e85ae"
name: "my_new_survey"
}
surveys {
id: "f9573bd0-61a5-4837-9308-61185b32b824"
name: "my_new_survey_meta"
}
Register a file¶
With a survey assigned, we can register a file to the survey. The file must already be uploaded to gcloud storage before this step.
[17]:
file_name = "straight-small.sgy"
bucket = "gs://cognite-seismic-eu/tests/"
crs = "EPSG:23031"
[19]:
# Now we can register the segy file that we will ingest.
# The file must be uploaded to gcloud storage before ingestion.
try:
file = client.file.register(survey_id=my_survey.survey.id, bucket=bucket, file_name=file_name, crs=crs)
print(file)
except RpcError as e:
print(e._state.details)
file with name: straight-small.sgy already exists.
Retrieve a file¶
Similar to surveys, we can find an existing file by its unique id, or its name.
[20]:
file = client.file.get(file_name=file_name)
print(file)
file {
id: "b4e46555-4af6-4570-aa3a-cc91022c3a87"
name: "straight-small.sgy"
}
crs: "EPSG:23031"
path: "gs://cognite-seismic-eu/tests/"
survey_name: "my_survey_1"
last_step: "Compute coverage"
We can also list all files that are visible in the project.
[21]:
for file_entry in client.file.list():
print(file_entry)
print("--------\n")
id: "4f40e205-1e16-431b-a0fe-63c5e1377675"
name: "ST14003ABPR17_KPSDM_FINAL_STACK_03-30_TIME.sgy"
metadata {
key: "author"
value: "tuan"
}
--------
id: "67ddf40d-248a-458c-8668-382b8e528923"
name: "writeback_test"
is_temporary: true
--------
id: "0cd3b924-7ccf-46f8-8f98-2c100209e92e"
name: "f3.sgy"
metadata {
key: "source"
value: "smoke_test"
}
--------
id: "4e1e6e62-54bf-4a5d-b187-3def4120b5c9"
name: "TUN15M02-FINAL-STACK.MIG_FIN.POST_STACK..JS-022102.segy"
metadata {
key: "opendata"
value: "N"
}
--------
id: "b4e46555-4af6-4570-aa3a-cc91022c3a87"
name: "straight-small.sgy"
--------
id: "4ce7d29b-b59b-41cc-9089-b7f4c403d7ec"
name: "normal-small.sgy"
--------
id: "9668ee9d-a867-4de4-a022-ad65990e8364"
name: "123.sgy"
--------
id: "8f05b284-5055-4f44-933f-461f2e76c57d"
name: "BPN0501R08_00_FU_T_PSDM_RT+25.sgy"
metadata {
key: "text"
value: "geospatial test"
}
--------
id: "8ffe76b8-52fd-4684-80a5-1a47c1429dbd"
name: "final-stack-03-30.sgy"
metadata {
key: "author"
value: "tuan"
}
--------
id: "d117eabc-ac1e-40e4-8dc0-85a0ae9366c3"
name: "f3-lsb.sgy"
--------
We can also list all the files that are registered to a specific survey:
[22]:
# get a specific survey and list files belonging to it
survey = client.survey.get(survey_name=survey_name, list_files=True)
print(survey)
#iterate over files in the survey
for file in survey.files:
print(file.name)
survey {
id: "6ef538bb-ad42-4eef-af7e-99d2497e85ae"
name: "my_new_survey"
}
Ingest a file¶
With the file registered to our survey, we can now trigger an ingestion job which will get queued in the background.
[23]:
ingestion_job = client.file.ingest(file_id=file.file.id)
print(ingestion_job)
job_id: "d9a73cd6-4168-4b1d-b340-9364ca6fabf7"
file_id: "b4e46555-4af6-4570-aa3a-cc91022c3a87"
Check ingest job status¶
We can check the status of the ingest job we triggered in the code snippets below.
[24]:
# Get current status
print(client.job.status(ingestion_job.job_id))
status: SUCCESS
message: "Job processed successfully"
started_at: "2020-10-14 13:43:08.281682"
updated_at: "2020-10-14 13:43:13.870687"
[25]:
# Periodically check status until complete
from cognite.seismic.protos.types_pb2 import JobStatus
import time
check = client.job.status(ingestion_job.job_id)
while (check.status != JobStatus.SUCCESS):
time.sleep(5)
check = client.job.status(ingestion_job.job_id)
print(check)
Analyse file information¶
Get metadata / header information about a file¶
[26]:
file_id = file.file.id
[28]:
# binary header without raw headers
binary_header = client.file.get_binary_header(file_id=file_id)
print(binary_header)
meta {
file_id: "b4e46555-4af6-4570-aa3a-cc91022c3a87"
traces: 25
trace_data_type: 5
interval: 4000
samples: 50
}
[30]:
# binary header with raw headers
binary_header = client.file.get_binary_header(file_id=file_id, include_raw_header=True)
print(binary_header)
meta {
file_id: "b4e46555-4af6-4570-aa3a-cc91022c3a87"
traces: 25
trace_data_type: 5
interval: 4000
samples: 50
raw_header: "\000\000\000\000\000\000\000\000\000\000\000\000\000\031\000\000\017\240\000\000\0002\000\000\000\005\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
}
[31]:
# text header without raw header
text_header = client.file.get_text_header(file_id=file_id)
print(text_header.meta.file_id)
print(text_header.meta.header)
b4e46555-4af6-4570-aa3a-cc91022c3a87
C 1 DATE: 2016-09-19
C 2 AN INCREASE IN AMPLITUDE EQUALS AN INCREASE IN ACOUSTIC IMPEDANCE
C 3 Written by libsegyio (python)
C 4
C 5
C 6
C 7
C 8
C 9
C10
C11 TRACE HEADER POSITION:
C12 INLINE BYTES 189-193 | OFFSET BYTES 037-041
C13 CROSSLINE BYTES 193-197 |
C14
C15 END EBCDIC HEADER
C16
C17
C18
C19
C20
C21
C22
C23
C24
C25
C26
C27
C28
C29
C30
C31
C32
C33
C34
C35
C36
C37
C38
C39
C40
[32]:
# file's coverage - in geojson
coverage_geojson = client.file.get_file_coverage(file_id=file_id)
print(coverage_geojson)
polygon {
crs {
crs: "EPSG:23031"
}
geo {
json {
fields {
key: "coordinates"
value {
list_value {
values {
list_value {
values {
list_value {
values {
number_value: 14.2857141494751
}
values {
number_value: 14.2857141494751
}
}
}
values {
list_value {
values {
number_value: 14.2857141494751
}
values {
number_value: 13.7142858505249
}
}
}
values {
list_value {
values {
number_value: 13.7142858505249
}
values {
number_value: 13.7142858505249
}
}
}
values {
list_value {
values {
number_value: 13.7142858505249
}
values {
number_value: 14.2857141494751
}
}
}
values {
list_value {
values {
number_value: 14.2857141494751
}
values {
number_value: 14.2857141494751
}
}
}
}
}
}
}
}
fields {
key: "type"
value {
string_value: "Polygon"
}
}
}
}
}
[33]:
# file's coverage - in wkt
coverage_wkt = client.file.get_file_coverage(file_id=file_id, in_wkt=True)
print(coverage_wkt)
polygon {
crs {
crs: "EPSG:23031"
}
wkt {
geometry: "POLYGON((14.2857141494751 14.2857141494751,14.2857141494751 13.7142858505249,13.7142858505249 13.7142858505249,13.7142858505249 14.2857141494751,14.2857141494751 14.2857141494751))"
}
}
[34]:
# file's coverage - in specific crs
coverage = client.file.get_file_coverage(file_id=file_id, in_wkt=True, crs = crs)
print(coverage)
polygon {
crs {
crs: "EPSG:23031"
}
wkt {
geometry: "POLYGON((14.2857141494751 14.2857141494751,14.2857141494751 13.7142858505249,13.7142858505249 13.7142858505249,13.7142858505249 14.2857141494751,14.2857141494751 14.2857141494751))"
}
}
Download Segy file¶
Downloads an existing SEGY file.
[35]:
file_generator = client.file.get_segy(file_name=file_name)
# write sgy file to disk
with open("test.sgy", "wb") as output:
for f in file_generator:
output.write(f.content)
Download Segy file by inline / crossline range¶
Downloads an existing SEGY file with only the data inside the range of inlines and crosslines.
[36]:
line_range = client.file.get_line_range(file_id=file.file.id) # See below
file_generator = client.file.get_segy_by_lines(file_name=file_name,
top_left_inline=line_range.inline.min.value,
top_left_xline=line_range.xline.min.value,
bottom_right_inline=line_range.inline.min.value + line_range.inline.step.value,
bottom_right_xline=line_range.xline.min.value + line_range.inline.step.value)
# write sgy file to disk
with open("test-partial.sgy", "wb") as output:
for f in file_generator:
output.write(f.content)
Download Segy file by Polygon coverage¶
Downloads an existing SEGY file with only the data inside the given 2D polygon.
[38]:
wkt_polygon_coverage = "POLYGON((14.2857141494751 14.2857141494751,14.2857141494751 13.7142858505249,13.7142858505249 13.7142858505249,13.7142858505249 14.2857141494751,14.2857141494751 14.2857141494751))"
file_generator = client.file.get_segy_by_geometry(file_name=file_name,
crs=crs,
wkt=wkt_polygon_coverage)
# write sgy file to disk
with open("test-geometry.sgy", "wb") as output:
for f in file_generator:
output.write(f.content)
Find minimum and maximum inline and crossline values for a file¶
[39]:
extents = client.file.get_line_range(file_id=file.file.id)
print(extents)
inline {
min {
value: 1
}
max {
value: 5
}
step {
value: 1
}
}
xline {
min {
value: 20
}
max {
value: 24
}
step {
value: 1
}
}
trace_value_range {
min_value: 1.1999998092651367
max_value: 5.240489959716797
}
trace_sample_count {
value: 50
}
Get all crosslines for an inline in a file¶
[40]:
xlines = client.file.get_xlines_by_inline(file_id=file_id, inline=extents.inline.min.value)
print(xlines.lines)
[20, 21, 22, 23, 24]
Get all inlines for a crossline in a file¶
[42]:
inlines = client.file.get_inlines_by_xline(file_id=file_id, xline=extents.xline.min.value)
print(inlines.lines)
[1, 2, 3, 4, 5]
Slices¶
Seismic slice by arbitrary line¶
Given a line from points x0, y0 to x1, y1, this function returns the series of traces that are along that line.
[46]:
line = client.slice.get_arbitrary_line(file_name=file_name, x0="0", y0="0", x1=50, y1=50, crs = crs)
print(line.to_array())
[[1.19999981 1.20000935 1.20001984 1.20002937 1.20003986 1.2000494
1.20005989 1.20006943 1.20007992 1.20008945 1.20009995 1.20010948
1.20011997 1.20012951 1.20014 1.20014954 1.20016003 1.20016956
1.20018005 1.20018959 1.20019913 1.20020962 1.20021915 1.20022964
1.20023918 1.20024967 1.20025921 1.2002697 1.20027924 1.20028973
1.20029926 1.20030975 1.20031929 1.20032978 1.20033932 1.20034981
1.20035934 1.20036983 1.20037937 1.20038986 1.2003994 1.20040989
1.20041943 1.20042992 1.20043945 1.20044994 1.20045948 1.20046997
1.20047951 1.20049 ]
[2.21000004 2.21000957 2.21002007 2.2100296 2.21004009 2.21004963
2.21006012 2.21006966 2.21007919 2.21008968 2.21009922 2.21010971
2.21011925 2.21012974 2.21013927 2.21014977 2.2101593 2.21016979
2.21017933 2.21018982 2.21019936 2.21020985 2.21021938 2.21022987
2.21023941 2.2102499 2.21025944 2.21026993 2.21027946 2.21028996
2.21029949 2.21030998 2.21031952 2.21033001 2.21033955 2.21035004
2.21035957 2.21037006 2.2103796 2.21039009 2.21039963 2.21041012
2.21041965 2.21042919 2.21043968 2.21044922 2.21045971 2.21046925
2.21047974 2.21048927]
[3.21999931 3.2200098 3.22001934 3.22002983 3.22003937 3.22004986
3.22005939 3.22006989 3.22007942 3.22008991 3.22009945 3.22010994
3.22011948 3.22012997 3.2201395 3.22014999 3.22015953 3.22017002
3.22017956 3.22019005 3.22019958 3.22021008 3.22021961 3.2202301
3.22023964 3.22024918 3.22025967 3.2202692 3.22027969 3.22028923
3.22029972 3.22030926 3.22031975 3.22032928 3.22033978 3.22034931
3.2203598 3.22036934 3.22037983 3.22038937 3.22039986 3.22040939
3.22041988 3.22042942 3.22043991 3.22044945 3.22045994 3.22046947
3.22047997 3.2204895 ]
[4.22999954 4.23001003 4.23001957 4.23003006 4.2300396 4.23005009
4.23005962 4.23007011 4.23007965 4.23009014 4.23009968 4.23011017
4.23011971 4.2301302 4.23013973 4.23015022 4.23015976 4.23017025
4.23017979 4.23018932 4.23019981 4.23020935 4.23021984 4.23022938
4.23023987 4.2302494 4.2302599 4.23026943 4.23027992 4.23028946
4.23029995 4.23030949 4.23031998 4.23032951 4.23034 4.23034954
4.23036003 4.23036957 4.23038006 4.2303896 4.23040009 4.23040962
4.23042011 4.23042965 4.23044014 4.23044968 4.23046017 4.2304697
4.23048019 4.23048973]
[5.23999977 5.24000931 5.2400198 5.24002934 5.24003983 5.24004936
5.24005985 5.24006939 5.24007988 5.24008942 5.24009991 5.24010944
5.24011993 5.24012947 5.24013996 5.2401495 5.24015999 5.24016953
5.24018002 5.24018955 5.24020004 5.24020958 5.24022007 5.24022961
5.2402401 5.24024963 5.24026012 5.24026966 5.24028015 5.24028969
5.24030018 5.24030972 5.24032021 5.24032974 5.24034023 5.24034977
5.24035931 5.2403698 5.24037933 5.24038982 5.24039936 5.24040985
5.24041939 5.24042988 5.24043941 5.24044991 5.24045944 5.24046993
5.24047947 5.24048996]]
Time / Depth Slice¶
Horizontal slice for given depth or time constrained by inline / crossline range¶
Returns a horizontal slice containing traces within the given inline / crossline range. The horizontal slice will refer to either the depth or the time depending on the original Segy file. The time/depth can be specified as either a constant (z) or as an array (horizon). If the given horizon is not the same length as the number of traces returned, a default constant of 0 will be used for the remaining traces.
[48]:
depth_time_index = 0
slice = client.time_slice.get_time_slice_by_lines(file_name=file_name,
top_left_inline=extents.inline.max.value,
top_left_xline=extents.xline.max.value,
bottom_right_inline=extents.inline.min.value,
bottom_right_xline=extents.xline.min.value,
z = depth_time_index)
print(slice.to_array())
[[1.19999981 1.21000004 1.21999931 1.22999954 1.23999977]
[2.19999981 2.21000004 2.21999931 2.22999954 2.23999977]
[3.19999981 3.21000004 3.21999931 3.22999954 3.23999977]
[4.19999981 4.21000004 4.21999931 4.22999954 4.23999977]
[5.19999981 5.21000004 5.21999931 5.22999954 5.23999977]]
[50]:
depth_time_horizon = [[0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]]
slice = client.time_slice.get_time_slice_by_lines(file_name=file_name,
top_left_inline=extents.inline.max.value,
top_left_xline=extents.xline.max.value,
bottom_right_inline=extents.inline.min.value,
bottom_right_xline=extents.xline.min.value,
horizon = depth_time_horizon)
print(slice.to_array())
[[1.19999981 1.21000957 1.22001934 1.23003006 1.24003983]
[2.2000494 2.21004009 2.22002983 2.23001957 2.24000931]
[3.19999981 3.21000004 3.21999931 3.22999954 3.23999977]
[4.19999981 4.21000004 4.21999931 4.22999954 4.23999977]
[5.19999981 5.21000004 5.21999931 5.22999954 5.23999977]]
Horizontal slice for given depth or time constrained by Polygon coverage¶
Returns a horizontal slice containing traces with only data inside the given 2D polygon. The horizontal slice will refer to either the depth or the time depending on the original Segy file.
[51]:
depth_time_index = 49
slice = client.time_slice.get_time_slice_by_geometry(file_name=file_name,
crs=crs,
wkt=wkt_polygon_coverage,
z=depth_time_index)
print(slice.to_array())
[[2.21048927 2.2204895 2.23048973]
[3.21048927 3.2204895 3.23048973]
[4.21049023 4.2204895 4.23048973]]
Traces¶
Get a trace from specific inline and crossline position¶
[54]:
trace = client.trace.get_trace_by_line(file_name=file_name, inline=inline, xline=xline)
print(trace)
iline {
value: 1
}
xline {
value: 24
}
Get a trace from specific coordinate position¶
[55]:
trace = client.trace.get_trace_by_coordinates(file_name=file_name, x=0.0, y=0.0, max_radius=100)
print(trace)
iline {
value: 5
}
xline {
value: 24
}
trace: 5.239999771118164
trace: 5.240009307861328
trace: 5.240019798278809
trace: 5.240029335021973
trace: 5.240039825439453
trace: 5.240049362182617
trace: 5.240059852600098
trace: 5.240069389343262
trace: 5.240079879760742
trace: 5.240089416503906
trace: 5.240099906921387
trace: 5.240109443664551
trace: 5.240119934082031
trace: 5.240129470825195
trace: 5.240139961242676
trace: 5.24014949798584
trace: 5.24015998840332
trace: 5.240169525146484
trace: 5.240180015563965
trace: 5.240189552307129
trace: 5.240200042724609
trace: 5.240209579467773
trace: 5.240220069885254
trace: 5.240229606628418
trace: 5.240240097045898
trace: 5.2402496337890625
trace: 5.240260124206543
trace: 5.240269660949707
trace: 5.2402801513671875
trace: 5.240289688110352
trace: 5.240300178527832
trace: 5.240309715270996
trace: 5.240320205688477
trace: 5.240329742431641
trace: 5.240340232849121
trace: 5.240349769592285
trace: 5.240359306335449
trace: 5.24036979675293
trace: 5.240379333496094
trace: 5.240389823913574
trace: 5.240399360656738
trace: 5.240409851074219
trace: 5.240419387817383
trace: 5.240429878234863
trace: 5.240439414978027
trace: 5.240449905395508
trace: 5.240459442138672
trace: 5.240469932556152
trace: 5.240479469299316
trace: 5.240489959716797
coordinate {
x: 96.0
y: 96.0
}
Volume¶
Get entire volume¶
[56]:
volume = client.volume.get(file_name=file_name);
print(volume.to_array());
[[[1.19999981 1.20000935 1.20001984 ... 1.20046997 1.20047951 1.20049 ]
[1.21000004 1.21000957 1.21001911 ... 1.21046925 1.21047974 1.21048927]
[1.21999931 1.2200098 1.22001934 ... 1.22046947 1.22047997 1.2204895 ]
[1.22999954 1.23001003 1.23001957 ... 1.2304697 1.23047924 1.23048973]
[1.23999977 1.24000931 1.2400198 ... 1.24046993 1.24047947 1.24048996]]
[[2.19999981 2.20000935 2.20001984 ... 2.20046997 2.20047951 2.20049 ]
[2.21000004 2.21000957 2.21002007 ... 2.21046925 2.21047974 2.21048927]
[2.21999931 2.2200098 2.22001934 ... 2.22046947 2.22047997 2.2204895 ]
[2.22999954 2.23001003 2.23001957 ... 2.2304697 2.23047924 2.23048973]
[2.23999977 2.24000931 2.2400198 ... 2.24046993 2.24047947 2.24048996]]
[[3.19999981 3.20000935 3.20001984 ... 3.20046997 3.20047951 3.20049 ]
[3.21000004 3.21000957 3.21002007 ... 3.21046925 3.21047974 3.21048927]
[3.21999931 3.2200098 3.22001934 ... 3.22046947 3.22047997 3.2204895 ]
[3.22999954 3.23001003 3.23001957 ... 3.2304697 3.23047924 3.23048973]
[3.23999977 3.24000931 3.2400198 ... 3.24046993 3.24047947 3.24048996]]
[[4.19999981 4.20000935 4.20001984 ... 4.20046997 4.20047951 4.20049 ]
[4.21000004 4.21000957 4.21002007 ... 4.2104702 4.21047974 4.21049023]
[4.21999931 4.2200098 4.22001934 ... 4.22046947 4.22047997 4.2204895 ]
[4.22999954 4.23001003 4.23001957 ... 4.2304697 4.23048019 4.23048973]
[4.23999977 4.24000931 4.2400198 ... 4.24046993 4.24047947 4.24048996]]
[[5.19999981 5.20000935 5.20001984 ... 5.20046997 5.20047951 5.20049 ]
[5.21000004 5.21000957 5.21002007 ... 5.2104702 5.21047974 5.21049023]
[5.21999931 5.2200098 5.22001934 ... 5.22046947 5.22047997 5.2204895 ]
[5.22999954 5.23001003 5.23001957 ... 5.2304697 5.23048019 5.23048973]
[5.23999977 5.24000931 5.2400198 ... 5.24046993 5.24047947 5.24048996]]]
Get volume slice by inline range¶
For a specific inline, use the same value for the start and end of the inline range.
[57]:
volume = client.volume.get(file_name=file_name,
inline_range=(extents.inline.min.value, extents.inline.max.value))
print(volume.to_array())
[[[1.19999981 1.20000935 1.20001984 ... 1.20046997 1.20047951 1.20049 ]
[1.21000004 1.21000957 1.21001911 ... 1.21046925 1.21047974 1.21048927]
[1.21999931 1.2200098 1.22001934 ... 1.22046947 1.22047997 1.2204895 ]
[1.22999954 1.23001003 1.23001957 ... 1.2304697 1.23047924 1.23048973]
[1.23999977 1.24000931 1.2400198 ... 1.24046993 1.24047947 1.24048996]]
[[2.19999981 2.20000935 2.20001984 ... 2.20046997 2.20047951 2.20049 ]
[2.21000004 2.21000957 2.21002007 ... 2.21046925 2.21047974 2.21048927]
[2.21999931 2.2200098 2.22001934 ... 2.22046947 2.22047997 2.2204895 ]
[2.22999954 2.23001003 2.23001957 ... 2.2304697 2.23047924 2.23048973]
[2.23999977 2.24000931 2.2400198 ... 2.24046993 2.24047947 2.24048996]]
[[3.19999981 3.20000935 3.20001984 ... 3.20046997 3.20047951 3.20049 ]
[3.21000004 3.21000957 3.21002007 ... 3.21046925 3.21047974 3.21048927]
[3.21999931 3.2200098 3.22001934 ... 3.22046947 3.22047997 3.2204895 ]
[3.22999954 3.23001003 3.23001957 ... 3.2304697 3.23047924 3.23048973]
[3.23999977 3.24000931 3.2400198 ... 3.24046993 3.24047947 3.24048996]]
[[4.19999981 4.20000935 4.20001984 ... 4.20046997 4.20047951 4.20049 ]
[4.21000004 4.21000957 4.21002007 ... 4.2104702 4.21047974 4.21049023]
[4.21999931 4.2200098 4.22001934 ... 4.22046947 4.22047997 4.2204895 ]
[4.22999954 4.23001003 4.23001957 ... 4.2304697 4.23048019 4.23048973]
[4.23999977 4.24000931 4.2400198 ... 4.24046993 4.24047947 4.24048996]]
[[5.19999981 5.20000935 5.20001984 ... 5.20046997 5.20047951 5.20049 ]
[5.21000004 5.21000957 5.21002007 ... 5.2104702 5.21047974 5.21049023]
[5.21999931 5.2200098 5.22001934 ... 5.22046947 5.22047997 5.2204895 ]
[5.22999954 5.23001003 5.23001957 ... 5.2304697 5.23048019 5.23048973]
[5.23999977 5.24000931 5.2400198 ... 5.24046993 5.24047947 5.24048996]]]
Get volume slice by crossline¶
For a specific crossline, use the same value for the start and end of the crossline range.
[58]:
volume = client.volume.get(file_name=file_name,
xline_range=(extents.xline.min.value, extents.xline.max.value))
print(volume.to_array())
[[[1.19999981 1.20000935 1.20001984 ... 1.20046997 1.20047951 1.20049 ]
[1.21000004 1.21000957 1.21001911 ... 1.21046925 1.21047974 1.21048927]
[1.21999931 1.2200098 1.22001934 ... 1.22046947 1.22047997 1.2204895 ]
[1.22999954 1.23001003 1.23001957 ... 1.2304697 1.23047924 1.23048973]
[1.23999977 1.24000931 1.2400198 ... 1.24046993 1.24047947 1.24048996]]
[[2.19999981 2.20000935 2.20001984 ... 2.20046997 2.20047951 2.20049 ]
[2.21000004 2.21000957 2.21002007 ... 2.21046925 2.21047974 2.21048927]
[2.21999931 2.2200098 2.22001934 ... 2.22046947 2.22047997 2.2204895 ]
[2.22999954 2.23001003 2.23001957 ... 2.2304697 2.23047924 2.23048973]
[2.23999977 2.24000931 2.2400198 ... 2.24046993 2.24047947 2.24048996]]
[[3.19999981 3.20000935 3.20001984 ... 3.20046997 3.20047951 3.20049 ]
[3.21000004 3.21000957 3.21002007 ... 3.21046925 3.21047974 3.21048927]
[3.21999931 3.2200098 3.22001934 ... 3.22046947 3.22047997 3.2204895 ]
[3.22999954 3.23001003 3.23001957 ... 3.2304697 3.23047924 3.23048973]
[3.23999977 3.24000931 3.2400198 ... 3.24046993 3.24047947 3.24048996]]
[[4.19999981 4.20000935 4.20001984 ... 4.20046997 4.20047951 4.20049 ]
[4.21000004 4.21000957 4.21002007 ... 4.2104702 4.21047974 4.21049023]
[4.21999931 4.2200098 4.22001934 ... 4.22046947 4.22047997 4.2204895 ]
[4.22999954 4.23001003 4.23001957 ... 4.2304697 4.23048019 4.23048973]
[4.23999977 4.24000931 4.2400198 ... 4.24046993 4.24047947 4.24048996]]
[[5.19999981 5.20000935 5.20001984 ... 5.20046997 5.20047951 5.20049 ]
[5.21000004 5.21000957 5.21002007 ... 5.2104702 5.21047974 5.21049023]
[5.21999931 5.2200098 5.22001934 ... 5.22046947 5.22047997 5.2204895 ]
[5.22999954 5.23001003 5.23001957 ... 5.2304697 5.23048019 5.23048973]
[5.23999977 5.24000931 5.2400198 ... 5.24046993 5.24047947 5.24048996]]]
Get time slice volume¶
For a specific time slice, use the same value for the start and end of the z_index range.
[59]:
volume = client.volume.get(file_name=file_name, z_index_range=(0,1))
print(volume.to_array())
[[[1.19999981 1.20000935]
[1.21000004 1.21000957]
[1.21999931 1.2200098 ]
[1.22999954 1.23001003]
[1.23999977 1.24000931]]
[[2.19999981 2.20000935]
[2.21000004 2.21000957]
[2.21999931 2.2200098 ]
[2.22999954 2.23001003]
[2.23999977 2.24000931]]
[[3.19999981 3.20000935]
[3.21000004 3.21000957]
[3.21999931 3.2200098 ]
[3.22999954 3.23001003]
[3.23999977 3.24000931]]
[[4.19999981 4.20000935]
[4.21000004 4.21000957]
[4.21999931 4.2200098 ]
[4.22999954 4.23001003]
[4.23999977 4.24000931]]
[[5.19999981 5.20000935]
[5.21000004 5.21000957]
[5.21999931 5.2200098 ]
[5.22999954 5.23001003]
[5.23999977 5.24000931]]]
Get subvolume¶
[60]:
subvolume = client.volume.get(file_name=file_name,
inline_range=(extents.inline.min.value, extents.inline.max.value),
xline_range=(extents.xline.min.value, extents.xline.max.value),
z_index_range=(1, 2))
print(subvolume.to_array())
[[[1.20000935 1.20001984]
[1.21000957 1.21001911]
[1.2200098 1.22001934]
[1.23001003 1.23001957]
[1.24000931 1.2400198 ]]
[[2.20000935 2.20001984]
[2.21000957 2.21002007]
[2.2200098 2.22001934]
[2.23001003 2.23001957]
[2.24000931 2.2400198 ]]
[[3.20000935 3.20001984]
[3.21000957 3.21002007]
[3.2200098 3.22001934]
[3.23001003 3.23001957]
[3.24000931 3.2400198 ]]
[[4.20000935 4.20001984]
[4.21000957 4.21002007]
[4.2200098 4.22001934]
[4.23001003 4.23001957]
[4.24000931 4.2400198 ]]
[[5.20000935 5.20001984]
[5.21000957 5.21002007]
[5.2200098 5.22001934]
[5.23001003 5.23001957]
[5.24000931 5.2400198 ]]]
Cube of trace data from a specified geometry¶
Another method for retrieving traces as a cube volume. This method allows the use of wkt or geo_json defined geometry as the area to fetch traces from.
[61]:
cube = client.volume.get_cube_by_geometry(file_name=file_name,
crs=crs,
wkt=coverage_wkt.polygon.wkt.geometry)
print(cube.to_array())
[[[2.21000004 2.21000957 2.21002007 2.2100296 2.21004009 2.21004963
2.21006012 2.21006966 2.21007919 2.21008968 2.21009922 2.21010971
2.21011925 2.21012974 2.21013927 2.21014977 2.2101593 2.21016979
2.21017933 2.21018982 2.21019936 2.21020985 2.21021938 2.21022987
2.21023941 2.2102499 2.21025944 2.21026993 2.21027946 2.21028996
2.21029949 2.21030998 2.21031952 2.21033001 2.21033955 2.21035004
2.21035957 2.21037006 2.2103796 2.21039009 2.21039963 2.21041012
2.21041965 2.21042919 2.21043968 2.21044922 2.21045971 2.21046925
2.21047974 2.21048927]
[2.21999931 2.2200098 2.22001934 2.22002983 2.22003937 2.22004986
2.22005939 2.22006989 2.22007942 2.22008991 2.22009945 2.22010994
2.22011948 2.22012997 2.2201395 2.22014999 2.22015953 2.22017002
2.22017956 2.22019005 2.22019958 2.22021008 2.22021961 2.2202301
2.22023964 2.22024918 2.22025967 2.2202692 2.22027969 2.22028923
2.22029972 2.22030926 2.22031975 2.22032928 2.22033978 2.22034931
2.2203598 2.22036934 2.22037983 2.22038937 2.22039986 2.22040939
2.22041988 2.22042942 2.22043991 2.22044945 2.22045994 2.22046947
2.22047997 2.2204895 ]
[2.22999954 2.23001003 2.23001957 2.23003006 2.2300396 2.23005009
2.23005962 2.23007011 2.23007965 2.23008919 2.23009968 2.23010921
2.23011971 2.23012924 2.23013973 2.23014927 2.23015976 2.2301693
2.23017979 2.23018932 2.23019981 2.23020935 2.23021984 2.23022938
2.23023987 2.2302494 2.2302599 2.23026943 2.23027992 2.23028946
2.23029995 2.23030949 2.23031998 2.23032951 2.23034 2.23034954
2.23036003 2.23036957 2.23038006 2.2303896 2.23040009 2.23040962
2.23042011 2.23042965 2.23043919 2.23044968 2.23045921 2.2304697
2.23047924 2.23048973]]
[[3.21000004 3.21000957 3.21002007 3.2100296 3.21004009 3.21004963
3.21006012 3.21006966 3.21007919 3.21008968 3.21009922 3.21010971
3.21011925 3.21012974 3.21013927 3.21014977 3.2101593 3.21016979
3.21017933 3.21018982 3.21019936 3.21020985 3.21021938 3.21022987
3.21023941 3.2102499 3.21025944 3.21026993 3.21027946 3.21028996
3.21029949 3.21030998 3.21031952 3.21033001 3.21033955 3.21035004
3.21035957 3.21037006 3.2103796 3.21039009 3.21039963 3.21041012
3.21041965 3.21042919 3.21043968 3.21044922 3.21045971 3.21046925
3.21047974 3.21048927]
[3.21999931 3.2200098 3.22001934 3.22002983 3.22003937 3.22004986
3.22005939 3.22006989 3.22007942 3.22008991 3.22009945 3.22010994
3.22011948 3.22012997 3.2201395 3.22014999 3.22015953 3.22017002
3.22017956 3.22019005 3.22019958 3.22021008 3.22021961 3.2202301
3.22023964 3.22024918 3.22025967 3.2202692 3.22027969 3.22028923
3.22029972 3.22030926 3.22031975 3.22032928 3.22033978 3.22034931
3.2203598 3.22036934 3.22037983 3.22038937 3.22039986 3.22040939
3.22041988 3.22042942 3.22043991 3.22044945 3.22045994 3.22046947
3.22047997 3.2204895 ]
[3.22999954 3.23001003 3.23001957 3.23003006 3.2300396 3.23005009
3.23005962 3.23007011 3.23007965 3.23008919 3.23009968 3.23010921
3.23011971 3.23012924 3.23013973 3.23014927 3.23015976 3.2301693
3.23017979 3.23018932 3.23019981 3.23020935 3.23021984 3.23022938
3.23023987 3.2302494 3.2302599 3.23026943 3.23027992 3.23028946
3.23029995 3.23030949 3.23031998 3.23032951 3.23034 3.23034954
3.23036003 3.23036957 3.23038006 3.2303896 3.23040009 3.23040962
3.23042011 3.23042965 3.23043919 3.23044968 3.23045921 3.2304697
3.23047924 3.23048973]]
[[4.21000004 4.21000957 4.21002007 4.2100296 4.21004009 4.21004963
4.21006012 4.21006966 4.21008015 4.21008968 4.21010017 4.21010971
4.2101202 4.21012974 4.21014023 4.21014977 4.2101593 4.21016979
4.21017933 4.21018982 4.21019936 4.21020985 4.21021938 4.21022987
4.21023941 4.2102499 4.21025944 4.21026993 4.21027946 4.21028996
4.21029949 4.21030998 4.21031952 4.21033001 4.21033955 4.21035004
4.21035957 4.21037006 4.2103796 4.21039009 4.21039963 4.21041012
4.21041965 4.21043015 4.21043968 4.21045017 4.21045971 4.2104702
4.21047974 4.21049023]
[4.21999931 4.2200098 4.22001934 4.22002983 4.22003937 4.22004986
4.22005939 4.22006989 4.22007942 4.22008991 4.22009945 4.22010994
4.22011948 4.22012997 4.2201395 4.22014999 4.22015953 4.22017002
4.22017956 4.22019005 4.22019958 4.22021008 4.22021961 4.2202301
4.22023964 4.22025013 4.22025967 4.22027016 4.22027969 4.22029018
4.22029972 4.22031021 4.22031975 4.22033024 4.22033978 4.22034931
4.2203598 4.22036934 4.22037983 4.22038937 4.22039986 4.22040939
4.22041988 4.22042942 4.22043991 4.22044945 4.22045994 4.22046947
4.22047997 4.2204895 ]
[4.22999954 4.23001003 4.23001957 4.23003006 4.2300396 4.23005009
4.23005962 4.23007011 4.23007965 4.23009014 4.23009968 4.23011017
4.23011971 4.2301302 4.23013973 4.23015022 4.23015976 4.23017025
4.23017979 4.23018932 4.23019981 4.23020935 4.23021984 4.23022938
4.23023987 4.2302494 4.2302599 4.23026943 4.23027992 4.23028946
4.23029995 4.23030949 4.23031998 4.23032951 4.23034 4.23034954
4.23036003 4.23036957 4.23038006 4.2303896 4.23040009 4.23040962
4.23042011 4.23042965 4.23044014 4.23044968 4.23046017 4.2304697
4.23048019 4.23048973]]]