Fixed width text parser
Project description
Fixed width text parser to array
Parsing different defined text formats to array data
Parser - parse anything according to the format definition
For use cases check tests folder
Format definition:
definition = {
'FIELD_1': [0, 1, 'string'],
'FIELD_2': [1, 10, 'float'],
'FIELD_3': [11, 10, 'float'],
'FIELD_4': [23, 1, 'integer'],
'FIELD_5': [24, 2, 'string'],
'FIELD_6': [26, 4, 'integer', 0],
'FIELD_7': [30, 4, 'integer', None],
'FIELD_8': [34, 4, 'float', None],
'FIELD_9': [38, 4, 'float', 0.0],
}
Field definition 'FIELD_6': [26, 4, 'integer', 0]
- 'FIELD_6' - field name
- 26 - index of text line where the field starts (count starts from 0)
- 4 - field length in characters
- string - field value type (allowed types: string, integer, float)
- 0 - default value if empty in text line record
For every data type default value is always None if field results as empty string. For every data type it is possible to set default value in format definition.
Specific format parsers
- Seismic.SpsParser.Sps21Parser - SPS format version num. SPS 2.1, JAN2006
- Seismic.VibratorParser.ApsParser
- Seismic.VibratorParser.CogParser
- Seismic.VibratorParser.VapsParser
File formats
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
FixedWidthTextParser-0.3.3.tar.gz
(10.2 kB
view hashes)
Built Distribution
Close
Hashes for FixedWidthTextParser-0.3.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac6f6c5fe19f04e30046e91866043bc22b4447063af6f790911b5e5b962a7ccd |
|
MD5 | ba29341b196ad53f4476df3c0cfd3fc6 |
|
BLAKE2b-256 | 483f68d147143314f983314193e32fb70a9f3200c8df90feed57f0f229f80581 |
Close
Hashes for FixedWidthTextParser-0.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8fad45d7ebb4be115da3e6c48248d00ee71d9281ea9824de9c0cebdfc091949 |
|
MD5 | af0b38492daebfdce86fea85128eeee8 |
|
BLAKE2b-256 | 18733e716b02fc26aed489975db7658b92918b94f5e2598b8c3937db0cac3d6f |