OpenZGY/C++ Public API (ALPHA)
Access seismic data stored in ZGY format.
Public Member Functions | List of all members
OpenZGY::Impl::ZgyReader Class Reference

Concrete implementation of IZgyReader. More...

Inheritance diagram for OpenZGY::Impl::ZgyReader:
OpenZGY::Impl::ZgyMetaAndTools OpenZGY::IZgyReader OpenZGY::Impl::ZgyMeta OpenZGY::IZgyTools OpenZGY::IZgyTools OpenZGY::IZgyMeta OpenZGY::IZgyMeta OpenZGY::IZgyMeta

Public Member Functions

 ZgyReader (const std::string &filename, const IOContext *iocontext, bool update)
 Open a ZGY file for reading. More...
 
virtual void read (const size3i_t &start, const size3i_t &size, float *data, int lod) const override
 Read an arbitrary region. More...
 
virtual void read (const size3i_t &start, const size3i_t &size, std::int16_t *data, int lod) const override
 Read an arbitrary region with no conversion. More...
 
virtual void read (const size3i_t &start, const size3i_t &size, std::int8_t *data, int lod) const override
 Read an arbitrary region with no conversion. More...
 
virtual std::pair< bool, double > readconst (const size3i_t &start, const size3i_t &size, int lod, bool as_float) const override
 Get hint about all constant region. More...
 
void close ()
 Close the file and release resources. More...
 
- Public Member Functions inherited from OpenZGY::Impl::ZgyMetaAndTools
virtual void transform (const corners_t &A, const corners_t &B, std::vector< std::array< float64_t, 2 >> &data) const override
 General coordinate conversion of an array of points. (NOT IMPLEMENTED YET) More...
 
virtual std::array< float64_t, 2 > transform1 (const corners_t &A, const corners_t &B, const std::array< float64_t, 2 > &point) const override
 General coordinate conversion of a single coordinate pair. More...
 
virtual std::array< float64_t, 2 > annotToIndex (const std::array< float64_t, 2 > &point) const override
 Convert a single coordinate pair.
 
virtual std::array< float64_t, 2 > annotToWorld (const std::array< float64_t, 2 > &point) const override
 Convert a single coordinate pair.
 
virtual std::array< float64_t, 2 > indexToAnnot (const std::array< float64_t, 2 > &point) const override
 Convert a single coordinate pair.
 
virtual std::array< float64_t, 2 > indexToWorld (const std::array< float64_t, 2 > &point) const override
 Convert a single coordinate pair.
 
virtual std::array< float64_t, 2 > worldToAnnot (const std::array< float64_t, 2 > &point) const override
 Convert a single coordinate pair.
 
virtual std::array< float64_t, 2 > worldToIndex (const std::array< float64_t, 2 > &point) const override
 Convert a single coordinate pair.
 
- Public Member Functions inherited from OpenZGY::Impl::ZgyMeta
virtual std::array< int64_t, 3 > size () const override
 Size in inline, crossline, vertical directions.
 
virtual SampleDataType datatype () const override
 Type of samples in each brick.
 
virtual std::array< float32_t, 2 > datarange () const override
 Used for float to int scaling.
 
virtual UnitDimension zunitdim () const override
 Vertical dimension.
 
virtual UnitDimension hunitdim () const override
 Horizontal dimension.
 
virtual std::string zunitname () const override
 For annotation only. Use hunitfactor, not the name, to convert to or from SI.
 
virtual std::string hunitname () const override
 For annotation only. Use hunitfactor, not the name, to convert to or from SI.
 
virtual float64_t zunitfactor () const override
 Multiply by this factor to convert from storage units to SI units.
 
virtual float64_t hunitfactor () const override
 Multiply by this factor to convert from storage units to SI units.
 
virtual float32_t zstart () const override
 First time/depth.
 
virtual float32_t zinc () const override
 Increment in vertical direction.
 
virtual std::array< float32_t, 2 > annotstart () const override
 First inline, crossline.
 
virtual std::array< float32_t, 2 > annotinc () const override
 Increment in inline, crossline directions.
 
virtual const corners_t & corners () const
 Survey corner points in world coordinates.
 
virtual const corners_t & indexcorners () const
 Survey corner points in ordinal (i,j) coordinates.
 
virtual const corners_t & annotcorners () const
 Survey corner points in inline, crossline coordinates.
 
virtual std::array< int64_t, 3 > bricksize () const override
 Size of one brick. Almost always (64,64,64), change at your own peril.
 
virtual std::vector< std::array< int64_t, 3 > > brickcount () const override
 Number of bricks at each resolution (LOD) level.
 
virtual int32_t nlods () const override
 Number of resolution (LOD) levels.
 
virtual void meta () const override
 Dictionary of meta data. NOT IMPLEMENTED.
 
virtual int32_t numthreads () const override
 Number of threads to use. NOT IMPLEMENTED.
 
virtual void set_numthreads (int32_t) override
 Number of threads to use. NOT IMPLEMENTED.
 
virtual void dump (std::ostream &os) const override
 Output in human readable form for debugging.
 
virtual SampleStatistics statistics () const override
 Statistics of all sample values on the file.
 
virtual SampleHistogram histogram () const override
 Histogram of all sample values on the file.
 

Additional Inherited Members

- Public Types inherited from OpenZGY::IZgyMeta
typedef std::int8_t int8_t
 
typedef std::int16_t int16_t
 
typedef std::int32_t int32_t
 
typedef std::int64_t int64_t
 
typedef float float32_t
 
typedef double float64_t
 
typedef std::array< int64_t, 3 > size3i_t
 
typedef std::array< std::array< float64_t, 2 >, 4 > corners_t
 
typedef std::pair< std::shared_ptr< const void >, std::int64_t > rawdata_t
 
typedef std::function< rawdata_t(const rawdata_t &, const std::array< int64_t, 3 > &)> compressor_t
 
- Static Public Member Functions inherited from OpenZGY::IZgyReader
static std::shared_ptr< IZgyReaderopen (const std::string &filename, const IOContext *iocontext=nullptr)
 Open a ZGY file for reading.
 
- Protected Attributes inherited from OpenZGY::Impl::ZgyMeta
std::shared_ptr< InternalZGY::ZgyInternalMeta > _meta
 Handle to the internal metadata layer which this class wraps.
 

Detailed Description

Concrete implementation of IZgyReader.

Constructor & Destructor Documentation

◆ ZgyReader()

OpenZGY::Impl::ZgyReader::ZgyReader ( const std::string &  filename,
const IOContext iocontext,
bool  update 
)

Open a ZGY file for reading.

Member Function Documentation

◆ close()

void OpenZGY::Impl::ZgyReader::close ( )
virtual

Close the file and release resources.

The ZgyReader destructor will call close() if not done already, catching and swallowing any exception. Unlike ZgyWriter::close() forgetting to close a file that was only open for read is not a major faux pas. It is still recommended to explicitly close, though.

Implements OpenZGY::IZgyReader.

◆ read() [1/3]

virtual void OpenZGY::Impl::ZgyReader::read ( const size3i_t &  start,
const size3i_t &  size,
float *  data,
int  lod 
) const
overridevirtual

Read an arbitrary region.

The data is read into a buffer provided by the caller. The method will apply conversion storage -> float if needed.

The start position refers to the specified lod level. At lod 0 start + data.size can be up to the survey size. At lod 1 the maximum is just half that, rounded up.

It is valid to pass a size that includes the padding area between the survey and the end of the current brick. But not more. In other words, the limit for lod 0 is actually reader()->size() rounded up to a multiple of reader->bricksize().

Implements OpenZGY::IZgyReader.

◆ read() [2/3]

virtual void OpenZGY::Impl::ZgyReader::read ( const size3i_t &  start,
const size3i_t &  size,
std::int16_t *  data,
int  lod 
) const
overridevirtual

Read an arbitrary region with no conversion.

As the read overload with a float buffer but only works for files with SampleDataType::int16 and does not scale the samples.

Implements OpenZGY::IZgyReader.

◆ read() [3/3]

virtual void OpenZGY::Impl::ZgyReader::read ( const size3i_t &  start,
const size3i_t &  size,
std::int8_t *  data,
int  lod 
) const
overridevirtual

Read an arbitrary region with no conversion.

As the read overload with a float buffer but only works for files with SampleDataType::int8 and does not scale the samples.

Implements OpenZGY::IZgyReader.

◆ readconst()

virtual std::pair<bool,double> OpenZGY::Impl::ZgyReader::readconst ( const size3i_t &  start,
const size3i_t &  size,
int  lod,
bool  as_float 
) const
overridevirtual

Get hint about all constant region.

Check to see if the specified region is known to have all samples set to the same value. Returns a pair of (is_const, const_value).

The function only makes inexpensive checks so it might return is_const=false even if the region was in fact constant. It will not make the opposite mistake. This method is only intended as a hint to improve performance.

For int8 and int16 files the caller may specify whether to scale the values or not. Even if unscaled the function returns the value as a double.

Implements OpenZGY::IZgyReader.


The documentation for this class was generated from the following file: