Skip to content

allow NoneType Z component azimuth values #171

@bch0w

Description

@bch0w

Pointed out to me in personal communication that PySEP will throw out a station if it tries to rotate and any of the azimuth or dip values are None. This makes sense for horizontals and would indicate improperly labelled station metadata from the datacenter, but azimuth doesn't really make sense for the vertical component. We might allow this to be NoneType if all other values are acceptable by forcing the vertical azimuth to 0 before sending the stream to ObsPy's rotate function.

To do: I need to check if ObsPy rotate complains when given a NoneType vertical azimuth value.

Related Issue: #35

Example Logfiles

[2025-08-05 14:09:15] - pysep - INFO: formatting stream of length 81 for component rotation 
[2025-08-05 14:09:15] - pysep - INFO: stream formatting returned 81 traces 
[2025-08-05 14:09:15] - pysep - INFO: rotating to components ZNE 
[2025-08-05 14:09:15] - pysep - DEBUG: C1.BI06..BHE azimuth==90.0; dip==0.0 
[2025-08-05 14:09:15] - pysep - DEBUG: C1.BI06..BHN azimuth==0.0; dip==0.0 
[2025-08-05 14:09:15] - pysep - DEBUG: C1.BI06..BHZ azimuth==None; dip==-90.0 
[2025-08-05 14:09:15] - pysep - WARNING: [BI06.BH](http://bi06.bh/)? bad rotation metadata, removing

pysep/pysep/pysep.py

Lines 1382 to 1400 in beeb7ac

for _tr in _st:
try:
meta = metadata_getter(_tr.id, _tr.stats.starttime)
az = meta["azimuth"]
dip = meta["dip"]
except Exception: # NOQA
logger.warning(f"no matching metadata for {_tr.id}")
channel_okay = False
break
logger.debug(f"{_tr.id} azimuth=={az}; dip=={dip}")
if az is None or dip is None:
channel_okay = False
break
if not channel_okay:
logger.warning(f"{sta}.{cha} bad rotation metadata, "
f"removing")
continue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions