I’m hoping to modify ObsPy’s NonLinLoc _read_single_hypocenter() function so that more metadata is added. I can do the coding, but I’m unsure how developers would prefer it to be done. The specific lines from the NonLinLoc hyp file look like this:
STAT_GEOG ExpectLat 45.251190 Long -121.813478 Depth 13.597396
TRANSFORM AZIMUTHAL_EQUIDIST RefEllipsoid WGS-84 LatOrig 45.374000 LongOrig -121.695000 RotCW 0.000000
STATISTICS ExpectX 11.149988 Y 11.358957 Z 24.587528 CovXX 697.118 XY 16.1396 XZ -27.9779 YY 730.49 YZ -32.1841 ZZ 236.867 EllAz1 42.7698 Dip1 85.1076 Len1 28.6925 Az2 293.445 Dip2 1.62251 Len2 49.3879 Len3 5.111915e+01
The STATISTICS line is already read in like this:
line = lines["STATISTICS"]
covariance_xx = float(line.split()[7])
covariance_yy = float(line.split()[13])
covariance_zz = float(line.split()[17])
stats_info_string = str(
"Note: Depth/Latitude/Longitude errors are calculated from covariance "
"matrix as 1D marginal (Lon/Lat errors as great circle degrees) "
"while OriginUncertainty min/max horizontal errors are calculated "
"from 2D error ellipsoid and are therefore seemingly higher compared "
"to 1D errors. Error estimates can be reconstructed from the "
"following original NonLinLoc error statistics line:\nSTATISTICS " +
lines["STATISTICS"])
.
.
.
o.comments.append(Comment(text=stats_info_string, force_resource_id=False))
This makes it a little tricky to parse out afterwards.
Would it be acceptable to include this information as a dictionary some how? For example:
# Extract TRANSFORM
line = lines["TRANSFORM"]
o.nlloc_metadata = dict()
o.nlloc_metadata['TRANSFORM'] = {
'Transform': str(line.split()[0]),
'Ellipsoid': str(line.split()[2]),
'LatOrig': float(line.split()[4]),
'LongOrig': float(line.split()[6]),
'RotCW': float(line.split()[8])
}
or just as another comment?
# Extract TRANSFORM
line = lines["TRANSFORM"]
trans_dict = dict({
'Transform': str(line.split()[0]),
'Ellipsoid': str(line.split()[2]),
'LatOrig': float(line.split()[4]),
'LongOrig': float(line.split()[6]),
'RotCW': float(line.split()[8])
})
o.comments.append(trans_dict)
Thanks for any feedback.