PIC-IRIS / PH5

Library of PH5 clients, apis, and utilities
Other
15 stars 9 forks source link

[BUG] ph5_validate fix incorrect errors/warnings #490

Closed ascire-pic closed 2 years ago

ascire-pic commented 2 years ago

ph5_validate error checking for station/event IDs needs to be updated to be more accurate with respect to limitations imposed by SEGY Rev 1 for data output. SEGY Rev 1 should be the most restrictive data format that is used for data output, so limitations imposed on station/event IDs by that standard should also be compatible with other data output formats.

In addition, a bug was discovered wrt event elevations, where ph5_validate does not register 0.0 as a valid entry in the elevation field of the event/shot table.

SEGY rev1: https://seg.org/Portals/0/SEG/News%20and%20Resources/Technical%20Standards/seg_y_rev1.pdf See trace header specification on pg15; event ID is in bytes 17-20 and station ID is in bytes 173-174

Station/array tables: Current behavior:

  1. ph5_validate gives a WARNING for station IDs greater than 32,767 (similar to warnings below in event example)
  2. ph5_validate gives an ERROR for stations IDs not between 0 and 65,535

Desired behavior:

  1. ph5_validate should probably give an ERROR for station IDs not between 0 and 32,767

Event/shot tables Current behavior:

  1. ph5_validate gives a WARNING for event IDs greater than 32,767
  2. ph5_validate gives an ERROR for event IDs not between 0 and 65,535
  3. ph5_validate gives an ERROR for "No Event location/Z/value_d found" when location/Z/value_d=0.0. It is possible that location/Z/value_d=0 does not cause this error to be given, but 0.0 should also be a valid value.

Desired behavior:

  1. ph5_validate should give an ERROR for Event IDs not between 0 and 2,147,483,647 (the limit of a signed value in 4-bytes). (While it is possible that the SEG-Y header is an unsigned value and the limit could be higher, using the more restrictive criteria still seems reasonable as 2 billion is already a ridiculous number to use as a shot identifier)
  2. ph5_validate should not give an ERROR for location/Z/value_d=0.0. At most, it should give a WARNING similar to the one that appears for station elevations of 0: "WARNING: Channel elevation seems to be 0. Is this correct???"

ph5_validate output current examples:

Event ID greater than 32,767 but less than 65,535:

Event_t 34655 1 error, 1 warning, 0 info -=-=-=-=-=-=-=-=- ERROR: No Event location/Z/value_d value found. WARNING: Event ID '34655' is more than 32767. Not compatible with SEGY revision 1.

Event ID not between 0 and 65,535, and "No Event location":

Event_t 76898 2 error, 0 warning, 0 info -=-=-=-=-=-=-=-=- ERROR: Event ID '76898' not between 0 and 65535. ERROR: No Event location/Z/value_d value found.

The event table entry for this event:

Table row 104

/Experiment_g/Sorts_g/Event_t_41514 id_s=76898 location/X/value_d=-124.444183 location/X/units_s=degrees location/Y/value_d=43.960228 location/Y/units_s=degrees location/Z/value_d=0.0 location/Z/units_s=m location/coordinate_system_s= location/projection_s= location/ellipsoid_s= location/description_s= time/ascii_s=Tue Jun 22 02:47:08 2021 time/epoch_l=1624330028 time/micro_seconds_i=320012 time/type_s=BOTH size/value_d=3300.0 size/units_s=volume in3 depth/value_d=-12.0 depth/units_s= description_s=MGL2104TD15D14A - MGL2104 airgun - Pressure 1968psi - Water depth -127.3m

ascire-pic commented 2 years ago

Issue resolved in PR#494.