Thanks, Lion
After applying unpack_trace_headers flag, the metadata route now looks like this:
'''
network:
station:
location:
channel:
starttime: 1970-01-01T00:00:00.000000Z
endtime: 1970-01-01T00:00:00.499247Z
sampling_rate: 1023.54145343
delta: 0.000977
npts: 512
calib: 1.0
_format: SEGY
segy: AttribDict({'trace_header': AttribDict({'receiver_group_elevation': 1108633190, 'ensemble_number': 2, 'unassigned': '\x00\x00\x00\x00UU\x00\x00', 'sweep_length_in_ms': 0, 'data_use': 1, 'original_field_record_number': 2, 'year_data_recorded': 0, 'datum_elevation_at_receiver_group': 0, 'day_of_year': 0, 'hour_of_day': 0, 'sample_interval_in_ms_for_this_trace': 977, 'number_of_samples_in_this_trace': 512, 'taper_type': 0, 'x_coordinate_of_ensemble_position_of_this_trace': -1353777152, 'gap_size': 0, 'geophone_group_number_of_trace_number_one': 0, 'low_cut_slope': 0, 'coordinate_units': 2, 'group_coordinate_y': 0, 'group_coordinate_x': 32, 'source_measurement_exponent': 0, 'instrument_early_or_initial_gain': 0, 'for_3d_poststack_data_this_field_is_for_in_line_number': 1120157882, 'source_energy_direction_exponent': 72, 'distance_from_center_of_the_source_point_to_the_center_of_the_receiver_group': 0, 'trace_weighting_factor': 0, 'mute_time_end_time_in_ms': 0, 'trace_number_within_the_ensemble': 1, 'number_of_horizontally_stacked_traces_yielding_this_trace': 1, 'geophone_group_number_of_last_trace': 0, 'over_travel_associated_with_taper': 0, 'number_of_vertically_summed_traces_yielding_this_trace': 1, 'unpacked_header': None, 'scalar_to_be_applied_to_times': -3841, 'scalar_to_be_applied_to_all_elevations_and_depths': 1, 'energy_source_point_number': 0, 'water_depth_at_source': 0, 'for_3d_poststack_data_this_field_is_for_cross_line_number': -1514247763, 'notch_filter_frequency': 0, 'source_static_correction_in_ms': 0, 'instrument_gain_constant': 0, 'sweep_trace_taper_length_at_start_in_ms': 0, 'high_cut_frequency': 0, 'lag_time_B': 0, 'lag_time_A': 0, 'high_cut_slope': 0, 'minute_of_hour': 0, 'uphole_time_at_source_in_ms': 0, 'scalar_to_be_applied_to_all_coordinates': -1000, 'shotpoint_number': 236732599, 'device_trace_identifier': 16669, 'subweathering_velocity': 0, 'source_depth_below_surface': 0, 'trace_sequence_number_within_line': 2, 'sweep_trace_taper_length_at_end_in_ms': 0, 'delay_recording_time': 0, 'weathering_velocity': 0, 'source_coordinate_x': 1171634243, 'source_coordinate_y': 1170025971, 'source_type_orientation': -12793, 'mute_time_start_time_in_ms': 0, 'sweep_frequency_at_end': 0, 'total_static_applied_in_ms': 0, 'time_basis_code': 2, 'group_static_correction_in_ms': 0, 'sweep_type': 0, 'surface_elevation_at_source': 0, 'alias_filter_frequency': 0, 'low_cut_frequency': 0, 'endian': u'<', 'trace_identification_code': 9, 'source_measurement_mantissa': 0, 'scalar_to_be_applied_to_the_shotpoint_number': -3441, 'source_measurement_unit': 0, 'source_energy_direction_mantissa': -354308278, 'second_of_minute': 0, 'trace_sequence_number_within_segy_file': 0, 'transduction_constant_exponent': -6248, 'alias_filter_slope': 0, 'sweep_frequency_at_start': 0, 'uphole_time_at_group_in_ms': 0, 'gain_type_of_field_instruments': 0, 'trace_value_measurement_unit': -16131, 'trace_number_within_the_original_field_record': 1, 'transduction_units': 23605, 'y_coordinate_of_ensemble_position_of_this_trace': -1224186476, 'notch_filter_slope': 0, 'geophone_group_number_of_roll_switch_position_one': 0, 'correlated': 0, 'datum_elevation_at_source': 0, 'water_depth_at_group': 0, 'transduction_constant_mantissa': -1203289767})})
'''
After reading the SEG-Y documentation I find that:
if trace.stats.segy.trace_header.scalar_to_be_applied_to_all_coordinates = 1000, then we should divide source coordinates by 1000
if trace.stats.segy.trace_header.coordinate_units = 2, then coordinate units are in Seconds of arc (need to divide by 3600 to degree conversion)
As result the formula to decimal degree conversion from raw SEG-Y data is:
decimal degree = source_coordinate / 1000 / 3600 = 1170025971 / 3600000 = 325
But I expect to see the value near 60 degree.
Maybe I have something I do not take into account?
Hi,
the trace headers are unpacked lazily, if you want to unpack them during reading, use
obspy.read(filename, unpack_trace_headers=True)
What the header values actually are and especially the coordinate system is fairly complex, please consult the SEG-Y documentation for that:
http://www.seg.org/documents/10161/77915/seg_y_rev1.pdf
Cheers!
Lion
Hi,
I want to create a map with GPR-tracks. I have file.sgy (SEG-Y file format) and I'm trying
to use obspy to extract lat/lon from this file for each trace, but without any success.
There is my code:
from obspy.core import read
filename = '/data/file.sgy'
st = read(filename)
tr = st[0] # first trace
print tr.stats.segy # metadata for trace 1
'''
AttribDict({'trace_header': LazyTraceHeaderAttribDict({'x_coordinate_of_ensemble_position_of_this_trace':
-1353777152, 'year_data_recorded': 0, u'unpacked_header': '\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\t\x00\x01\x00\x01\x00\x01\x00\x00\x00\x00\x00ff\x14B\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x18\xfcC\xb8\xd5E\xf3-\xbdE\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xd1\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00O\xaf\x94e\x08\xb7\xba@\xc4B\xadi\xbe\xa5\xb7@\x1c\x0e\x8f\xf2\xfd\xc0YAG\xb8\x98\xe75\\\x1dA*\xf0\x07\xceJ\xaf\xe1\xeaH
\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UU\xff\x00', 'y_coordinate_of_ensemble_position_of_this_trace':
-1224186476, 'trace_sequence_number_within_line': 1, u'endian': u'<', 'sample_interval_in_ms_for_this_trace':
977})})
'''
# get coords
x_coord = tr.stats.segy.trace_header.x_coordinate_of_ensemble_position_of_this_trace
y_coord = tr.stats.segy.trace_header.y_coordinate_of_ensemble_position_of_this_trace
print str(x_coord) + ' ' + str(y_coord)
The result is a couple coords in strange format: -1353777152 -1224186476. What kind
of coordinate system? Maybe I'm doing something wrong?
_______________________________________________
obspy-users mailing list
obspy-users@lists.swapbytes.de
http://lists.swapbytes.de/mailman/listinfo/obspy-users
_______________________________________________
obspy-users mailing list
obspy-users@lists.swapbytes.de
http://lists.swapbytes.de/mailman/listinfo/obspy-users
- - - - - - - - - - -
Ilya Filippov
Yugra State University (Chekhova str. 16, Khanty-Mansiysk, Tyumen' Region, Russian Federation, 628012):
1. Environmental Dynamics & Global Climate Change Research Centre, Senior Engineer
2. Biology Chair, Docent
3. Journal of Environmental Dynamics & Global Climate Change, Editorial Board Member
GoogleScholar profile: Илья Филиппов, Ilya Filippov - Google Scholar
Tel: +79088817605