New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnessary information when writing to a SACPZ file #2707
Comments
|
Hello, @megies . I am wondering if this is something that you still want to address, considering that 2+ years have passed since it was reported. If yes, may I work on this? (I think no explicit assignment is required, but since I am asking other questions, I thought I could ask that, too). Now, related to the change itself: would a try... except... approach work for you or would you prefer a boolean approach like the one you suggest? I was thinking on something like this: try:
out.append(f"* INSTTYPE : {cha.sensor.type}")
except AttributeError:
out.append("* INSTTYPE : ---") May I also change |
Feel free to go ahead. But your try/except doesn't handle all cases, it will print "None" in output if sensor is set but its type is
If you want to work on this we will also need tests for it, not sure if it's worth the hassle, considering that SACPZ is a format that probably very few people use, with how widespread StationXML has become the default. |
Oh, that is true. I was only considering the case described in the issue (i.e. sensor being I will give this a try this weekend and update when I am done or if I give up. Thank you! |
Hey, @megies: I have a feature branch with a potential fix to this (including a new test). The branch is |
We actually do not do this anymore, since sadly GitHub never officially added this workflow and the existing implementation Github has had for years on end now makes it so whoever converts the issue to a PR will "hijack" the first post authorship, which is kinda confusing. Long story short, just open a PR @jmunoz94 |
Done @megies. I do not seem to have permissions to add labels, but it is ready for review. |
No
obspy 1.2.2, Python 3.8.5, Linux
anaconda
obspy/obspy/io/sac/sacpz.py
Line 101 in d56e8eb
I am planning to write to a SACPZ file while
cha.sensor==None
which means it has no sensor information, the program will crash sinceNone.type
doesn't exit. The general purpose for us to use a SACPZ file is to remove the instrumental response and the sensor information might not be so essential. So maybe we can add an if flag here to see whethercha.sensor
exist or not?The text was updated successfully, but these errors were encountered: