|
OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
|
Credentials and configuration for Seismic Store. More...
#include <iocontext.h>
Public Member Functions | |
| virtual std::string | toString () const override |
| SeismicStoreIOContext & | sdurl (const std::string &value) |
| SeismicStoreIOContext & | sdapikey (const std::string &value) |
| SeismicStoreIOContext & | sdtoken (const std::string &value, const std::string &type) |
| SeismicStoreIOContext & | sdtokencb (const tokencb_t &value, const std::string &type) |
| SeismicStoreIOContext & | maxsize (int value) |
| SeismicStoreIOContext & | maxhole (int value) |
| SeismicStoreIOContext & | aligned (int value) |
| SeismicStoreIOContext & | segsize (int value) |
| SeismicStoreIOContext & | threads (int value) |
| SeismicStoreIOContext & | legaltag (const std::string &value) |
| SeismicStoreIOContext & | writeid (const std::string &value) |
| SeismicStoreIOContext & | seismicmeta (const std::string &value) |
| SeismicStoreIOContext & | debug_trace (const debugtrace_t &value) |
Public Member Functions inherited from OpenZGY::IOContext | |
| virtual | ~IOContext () |
Credentials and configuration for Seismic Store.
Define an iocontext for seismic store, doing consistency checks and applying fallbacks from environment variables and hard coded defaults.
TODO-Low: Still undecided whether I should allow SeismicStoreFile to use this class directly or whether I should map the contents to an internal SDConfig class.
TODO-Low: Move this class to a separate extensions/seismic_store.h to be included by applications if and only if they need that access.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::aligned | ( | int | value | ) |
File alignment, in MB. Must be between 0 and 1024.
This is similar to the maxhole parameter. If set, starting and ending offsets are extended so they both align to the specified value. Set this parameter if the lower levels implement a cache with a fixed blocksize and when there is an assumpton that most reads will be aligned anyway. TODO-Worry: Handling reads past EOF may become a challenge for the implementation. Defaults to $OPENZGY_ALIGNED_MB if not specified, or zero.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::debug_trace | ( | const debugtrace_t & | value | ) |
For debugging and unit tests only. Callback to be invoked immediately before a read or write is passed on to seismic store. Typically used to verify that consolidating bricks works as expected. Can only be set programmatically. Not by an environment variable.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::legaltag | ( | const std::string & | value | ) |
The legaltag stored in the file. Used only on create.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::maxhole | ( | int | value | ) |
Maximum size to waste, in MB. Must be between 0 and 1024.
This applies when consolidate neighboring bricks when reading from seismic store. Setting maxhole > 0 tells the reader that it is ok to also consolidate requests that are almost neighbors, with a gap up to and including maxhole. The data read from the gap will be discarded unless picked up by some (not yet implemented) cache.
For cloud access with high bandwidth (cloud-to-cloud) this should be at least 2 MB because smaller blocks will take just as long to read. For low bandwidth cloud access (cloud-to-on-prem) it should be less. If a fancy cache is implemented it should be more. For accessing on-prem ZGY files it probably makes no difference. Defaults to $OPENZGY_MAXHOLE_MB if not specified, or 2 MB.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::maxsize | ( | int | value | ) |
Maximum size of consolidated requests, in MB. Must be between 0 and 1024. Zero is taken to mean do not consolidate.
Tell the reader to try to consolidate neighboring bricks when reading from seismic store. This is usually possible when the application requests full traces or at least traces traces longer then 64 samples. Setting maxsize limits this consolidation to the specified size. The assumption is that for really large blocks the per-block overhead becomes insignificant compared to the transfer time.
Consolidating requests has higher priority than using multiple threads. So, capping maxsize might allow more data to be read in parallel.
Note that currently the spitting isn't really smart. With a 64 MB limit and 65 contiguous 1 MB buffers it might end up reading 64+1 MB instead of e.g. 32+33 MB.
Note that the low level reader should not assume that requests are capped at this size. They might be larger e.g. when reading the header information.
Defaults to $OPENZGY_MAXSIZE_MB if not specified, or 2 MB.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::sdapikey | ( | const std::string & | value | ) |
Authorization for application to access the seismic store API. Defaults to $OPENZGY_SDAPIKEY. There is no hard coded fallback in case that variable isn't found either. This is to mitigate the risk of code stopping to work in the PROD environment.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::sdtoken | ( | const std::string & | value, |
| const std::string & | type | ||
| ) |
Provide the SAuth token used to validate requests to seismic store. The token is associated with the open file and cannot be changed. tokentype is currently ignored, but may in the future be specified as e.g. "stoken" (normal), "imptoken" (impersonation), etc. Currently the token will (usually) not be automatically refreshed. If you need this or need more detailed control then you should use sdtokenCb() intead of sdtoken().
If neither sdtoken() nor sdtokenCb() are called then the environment variable "OPENZGY_TOKEN" is tried. Older versions of the accessor had a final fallback that would try to pick up sdutil's saved credentials but that is now considered too insecure. You can set OPENZGY_TOKEN=FILE:carbon.slbapp.com if you want that behavior.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::sdtokencb | ( | const tokencb_t & | value, |
| const std::string & | type | ||
| ) |
Register a callback that will be invoked each time an access token is needed for seismic store. This is an alternative to sdtoken(). You don't need both. The callback might be called very frequently so it should cache the token. The callback should ensure that the token is not about to expire, and refresh it if needed. The optional tokentype is currently unused. It has the same meaning as in sdtoken(). Note that the callback itself does not provide the token type. You need to specify the type in this call. Promising that whenever the callback returns a token it will be of this type.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::sdurl | ( | const std::string & | value | ) |
Where to contact the seismic store service. Defaults to $OPENZGY_SDURL. There is no hard coded fallback in case that variable isn't found either. This is to mitigate the risk of code stopping to work in the PROD environment.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::segsize | ( | int | value | ) |
Segment size used when writing, in MB. Must be between 1 and 16*1024 (i.e. 16 GB). Defaults to $OPENZGY_SEGSIZE_MB if not specified, or 1024 (i.e. 1 GB). The default should work fine in almost all cases.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::seismicmeta | ( | const std::string & | value | ) |
a dictionary of additional information to be associated with this dataset in the data ecosystem. Currently used only on create, although SDAPI allows this to be set on an existing file by calling {get,set}SeismicMeta(). This setting cannot be set from the environment.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::threads | ( | int | value | ) |
Use up to this many parallel requests to seismic store in order to speed up processing. Set between 1 and 1024, This applies to individual reads in the main API. So the reads must be for a large area (i.e. covering many bricks) for the setting to be of any use. Set to $OPENZGY_NUMTHREADS if not found, and 1 (i.e. no threading) if the environment setting is also missing.
Whether it is useful to set the variable depends on the application. Apps such as Petrel/BASE generally do their own multi threading, issuing multiple read requests to the high level API in parallel. In that case it might not be useful to also parallelize individual requests.
|
overridevirtual |
Display the context in a human readable format for debugging.
Implements OpenZGY::IOContext.
| SeismicStoreIOContext& OpenZGY::SeismicStoreIOContext::writeid | ( | const std::string & | value | ) |
If set, re-use this lock instead of creating a new one. Works both for read and write locks; the name reflects what SDAPI calls it.
1.8.17