field header lcalda

Good afternoon, I am trying to set field header “lcalda” , using this function: “something.SetHvalue(‘lcalda’, “TRUE”)”, but I am getting next error:

Traceback (most recent call last):
File “”, line 41, in
sac.SetHvalue(‘lcalda’, “TRUE”) #calcula distancia estacion evento.
File “/Applications/”, line 461, in SetHvalue
self.hi[index] = int(value)
ValueError: invalid literal for int() with base 10: ‘TRUE’

can somebody help me about it?

Thank you so much,

Juan Carlos.

Hi Juan Carlos,

In your Snippet the second argument should be a boolean or an integer, and you gave the string ‘TRUE’, it should be:

sac.SetHvalue(‘lcalda’, True)

sac.SetHvalue(‘lcalda’, 1)



Hi Juan Carlos,

I don't know if there is a special reason why you use SacIO class,
anyway, SAC header fields can also be modified simply in
Trace.stats.sac. E.g.:

st = read("/path/to/test.sac")
st[0].stats.sac['lcalda'] = 0
st.write("/tmp/modified.sac", "SAC")