Skip to main content

Convert between SEG-Y and NetCDF

Project description

https://img.shields.io/pypi/v/netcdf_segy.svg

Convert between SEG-Y and NetCDF

This is currently only a research/demonstration tool. It is not “industrial strength”. In particular, it does not run in parallel, so will likely be slow on very large datasets (if it runs at all). Also, only the SEG-Y -> NetCDF direction is implemented.

To install: pip install netcdf_segy

SegyIO is a dependency.

To convert a SEG-Y file to NetCDF from the command line: segy2netcdf <path to input SEG-Y file> <path to output NetCDF file>. For additional options, look at the help: segy2netcdf --help.

The tool can also be called from a Python script:

from netcdf_segy.segy2netcdf import segy2netcdf

segy2netcdf(segy_path, netcdf_path)

I have created a Jupyter Notebook to discuss the advantages of NetCDF compared to SEG-Y, show an example of segy2netcdf being used, and demonstrate the attractions of loading the resulting NetCDF file with xarray: Alternatives to SEG-Y.

One of the “additional options” mentioned above is to use specified headers as dimensions. This allows you to use ‘FieldRecord’ as a dimension if your data is stored as shot gathers, for example (as in the Notebook). If you don’t do this, the NetCDF file will store the data as a 2D array with Time/Depth/SampleNumber and Traces as the dimensions. As netcdf_segy currently uses SegyIO to read the SEG-Y file, the header names are those used by that package. For your convenience, here is the list (from segyio.TraceField):

‘AliasFilterFrequency’, ‘AliasFilterSlope’, ‘CDP’, ‘CDP_TRACE’, ‘CDP_X’, ‘CDP_Y’, ‘CROSSLINE_3D’, ‘CoordinateUnits’, ‘Correlated’, ‘DataUse’, ‘DayOfYear’, ‘DelayRecordingTime’, ‘ElevationScalar’, ‘EnergySourcePoint’, ‘FieldRecord’, ‘GainType’, ‘GapSize’, ‘GeophoneGroupNumberFirstTraceOrigField’, ‘GeophoneGroupNumberLastTraceOrigField’, ‘GeophoneGroupNumberRoll1’, ‘GroupStaticCorrection’, ‘GroupUpholeTime’, ‘GroupWaterDepth’, ‘GroupX’, ‘GroupY’, ‘HighCutFrequency’, ‘HighCutSlope’, ‘HourOfDay’, ‘INLINE_3D’, ‘InstrumentGainConstant’, ‘InstrumentInitialGain’, ‘LagTimeA’, ‘LagTimeB’, ‘LowCutFrequency’, ‘LowCutSlope’, ‘MinuteOfHour’, ‘MuteTimeEND’, ‘MuteTimeStart’, ‘NStackedTraces’, ‘NSummedTraces’, ‘NotchFilterFrequency’, ‘NotchFilterSlope’, ‘OverTravel’, ‘ReceiverDatumElevation’, ‘ReceiverGroupElevation’, ‘ScalarTraceHeader’, ‘SecondOfMinute’, ‘ShotPoint’, ‘ShotPointScalar’, ‘SourceDatumElevation’, ‘SourceDepth’, ‘SourceEnergyDirectionExponent’, ‘SourceEnergyDirectionMantissa’, ‘SourceGroupScalar’, ‘SourceMeasurementExponent’, ‘SourceMeasurementMantissa’, ‘SourceMeasurementUnit’, ‘SourceStaticCorrection’, ‘SourceSurfaceElevation’, ‘SourceType’, ‘SourceUpholeTime’, ‘SourceWaterDepth’, ‘SourceX’, ‘SourceY’, ‘SubWeatheringVelocity’, ‘SweepFrequencyEnd’, ‘SweepFrequencyStart’, ‘SweepLength’, ‘SweepTraceTaperLengthEnd’, ‘SweepTraceTaperLengthStart’, ‘SweepType’, ‘TRACE_SAMPLE_COUNT’, ‘TRACE_SAMPLE_INTERVAL’, ‘TRACE_SEQUENCE_FILE’, ‘TRACE_SEQUENCE_LINE’, ‘TaperType’, ‘TimeBaseCode’, ‘TotalStaticApplied’, ‘TraceIdentificationCode’, ‘TraceIdentifier’, ‘TraceNumber’, ‘TraceValueMeasurementUnit’, ‘TraceWeightingFactor’, ‘TransductionConstantMantissa’, ‘TransductionConstantPower’, ‘TransductionUnit’, ‘UnassignedInt1’, ‘UnassignedInt2’, ‘WeatheringVelocity’, ‘YearDataRecorded’,

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netcdf_segy-1.0.1.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distribution

netcdf_segy-1.0.1-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page