Hello Sac Users
I received an email from a fellow retired seismologist who has used SAC
for decades and is a user of macros and Blackboard Variables. He encountered
an apparent issue with large numbers not working. I have experimented and
I think SETBB/GETBB don't seem to work for numbers >= 2^31
SAC> setbb ts1 3.14159
SAC> getbb ts1
ts1 = 3.14159
SAC> setbb ts2 2.0E+09
SAC> getbb ts2
ts2 = 2000000000
SAC> setbb ts3 2.2E+09
SAC> getbb ts3
ts3 = -2147483648
trying 2^31 -1 and 2^31
SAC> setbb ts4 2147483647
SAC> getbb ts4
ts4 = 2147483647
SAC> setbb ts5 2147483648
SAC> getbb ts5
ts5 = -2147483648
I haven't seen any Blackboard Variable limitations in the SAC documentation.
I am not even sure how SAC internally represents and stores
Blackboard Variables.
Are Large real values not supported? Thanks for any workarounds or
clarifications on the intent of Blackboard Variables for large floating
point
values.
George Randall
Retired but still interested in SAC
I received an email from a fellow retired seismologist who has used SAC
for decades and is a user of macros and Blackboard Variables. He encountered
an apparent issue with large numbers not working. I have experimented and
I think SETBB/GETBB don't seem to work for numbers >= 2^31
SAC> setbb ts1 3.14159
SAC> getbb ts1
ts1 = 3.14159
SAC> setbb ts2 2.0E+09
SAC> getbb ts2
ts2 = 2000000000
SAC> setbb ts3 2.2E+09
SAC> getbb ts3
ts3 = -2147483648
trying 2^31 -1 and 2^31
SAC> setbb ts4 2147483647
SAC> getbb ts4
ts4 = 2147483647
SAC> setbb ts5 2147483648
SAC> getbb ts5
ts5 = -2147483648
I haven't seen any Blackboard Variable limitations in the SAC documentation.
I am not even sure how SAC internally represents and stores
Blackboard Variables.
Are Large real values not supported? Thanks for any workarounds or
clarifications on the intent of Blackboard Variables for large floating
point
values.
George Randall
Retired but still interested in SAC
-
George,
This looks like a bug, There should be a check for integer overflow.
You can try adding some epsilon to the value
SAC> setbb ts4 2147483648.000001
SAC> getbb ts4
ts4 = 2.14748e+09
Although that may not be desirable.
As the number looks like an integer, it gets stored as one, but it should be stored as a float as the 32 bit integer representation is insufficient / wrong./
Brian
On Oct 17, 2022, at 11:55 AM, George Randall (via IRIS) <sac-help-bounce<at>lists.ds.iris.edu> wrote:
Hello Sac Users
I received an email from a fellow retired seismologist who has used SAC
for decades and is a user of macros and Blackboard Variables. He encountered
an apparent issue with large numbers not working. I have experimented and
I think SETBB/GETBB don't seem to work for numbers >= 2^31
SAC> setbb ts1 3.14159
SAC> getbb ts1
ts1 = 3.14159
SAC> setbb ts2 2.0E+09
SAC> getbb ts2
ts2 = 2000000000
SAC> setbb ts3 2.2E+09
SAC> getbb ts3
ts3 = -2147483648
trying 2^31 -1 and 2^31
SAC> setbb ts4 2147483647
SAC> getbb ts4
ts4 = 2147483647
SAC> setbb ts5 2147483648
SAC> getbb ts5
ts5 = -2147483648
I haven't seen any Blackboard Variable limitations in the SAC documentation.
I am not even sure how SAC internally represents and stores Blackboard Variables.
Are Large real values not supported? Thanks for any workarounds or
clarifications on the intent of Blackboard Variables for large floating point
values.
George Randall
Retired but still interested in SAC
----------------------
SAC Help
Topic home: https://urldefense.proofpoint.com/v2/url?u=http-3A__ds.iris.edu_message-2Dcenter_topic_sac-2Dhelp_&d=DwIGaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=xlrnQuY_RWoRIvnCDJ5AfQ&m=nHsA5-JMUswify7RfdLPR0tlKO1CMoV50YLwBlPVhAJBEFqeX399FMcK_gWckuHy&s=F6RG1qgqBKGAnXVTqcW3hXoqofICVFVcxStWHy3LYUo&e= | Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu
Sent from the IRIS Message Center (https://urldefense.proofpoint.com/v2/url?u=http-3A__ds.iris.edu_message-2Dcenter_&d=DwIGaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=xlrnQuY_RWoRIvnCDJ5AfQ&m=nHsA5-JMUswify7RfdLPR0tlKO1CMoV50YLwBlPVhAJBEFqeX399FMcK_gWckuHy&s=TibMLXr_mQ-J8gJWVSg_GK2waXgPYGFN1ee5QhF2iF4&e= )
Update subscription preferences at https://urldefense.proofpoint.com/v2/url?u=http-3A__ds.iris.edu_account_profile_&d=DwIGaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=xlrnQuY_RWoRIvnCDJ5AfQ&m=nHsA5-JMUswify7RfdLPR0tlKO1CMoV50YLwBlPVhAJBEFqeX399FMcK_gWckuHy&s=_YEmfiq_JlihNNGpUbj7BjjqaHiW8xFYprdKMUCe-C4&e=
-
Dear George -
SAC BB variables are simply character strings.
However, SAC’s input parser will take certain tokens (character sequences separated by white space) and turn them into numbers before processing the command if the token looks like a number. That’s what I think is causing your puzzlement here.
Different versions of SAC tokenize commands differently, so the particular behavior will change depending on the version that you’re using. The original SAC turned everything that looked like a number into a floating point number. Newer versions might tokenize numeric-looking strings as integers or real numbers depending on size and/or use of exponential notation. A good way to defeat any conversion to any kind of number is to enclose the text in quotes or primes, e.g.
SETBB TS1 ‘3.14159’
SETBB TS2 “2200000000”
etc.
SAC parsing methods aren’t clear in any of the documentation - sorry. But it is debatable whether their quirks should be documented as opposed to being implemented to avoid unexpected behavior for users (like you’ve discovered with whatever version of SAC that you’ve used).
On 17 Oct 2022, at 16:55, George Randall (via IRIS) <sac-help-bounce<at>lists.ds.iris.edu> wrote:
George Helffrich
Hello Sac Users
I received an email from a fellow retired seismologist who has used SAC
for decades and is a user of macros and Blackboard Variables. He encountered
an apparent issue with large numbers not working. I have experimented and
I think SETBB/GETBB don't seem to work for numbers >= 2^31
SAC> setbb ts1 3.14159
SAC> getbb ts1
ts1 = 3.14159
SAC> setbb ts2 2.0E+09
SAC> getbb ts2
ts2 = 2000000000
SAC> setbb ts3 2.2E+09
SAC> getbb ts3
ts3 = -2147483648
trying 2^31 -1 and 2^31
SAC> setbb ts4 2147483647
SAC> getbb ts4
ts4 = 2147483647
SAC> setbb ts5 2147483648
SAC> getbb ts5
ts5 = -2147483648
I haven't seen any Blackboard Variable limitations in the SAC documentation.
I am not even sure how SAC internally represents and stores Blackboard Variables.
Are Large real values not supported? Thanks for any workarounds or
clarifications on the intent of Blackboard Variables for large floating point
values.
George Randall
Retired but still interested in SAC
----------------------
SAC Help
Topic home: http://ds.iris.edu/message-center/topic/sac-help/ | Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu
Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
Update subscription preferences at http://ds.iris.edu/account/profile/
george<at>elsi.jp
-
Hello,
I also wrote a similar problem (below) to the mail-list about one year ago.
Because I cannot use BB variable with large amplitude numbers (i.e.
counts), first I divide the amplitudes by a number (i.e. 1e6) to get a
smaller number before normalizing the waveforms :(
best regards
Onur
-- 18.09.2021 -----
Hi,
I use sac v102.0 (64bit) on Kubuntu v16 (64bit) .
After FFT of a squared waveform (amplitude unit is count), the maximum and
minimum values on the header are
FILE: 1-SAC/a.sac - 1
--------------------
DEPMAX = 1.441192e+13
DEPMIN = 7.639150e+07
NVHDR = 7
However, I give the following command
message " max-min &1,DEPMAX &1,DEPMIN "
max-min -2147483648 76391496
The maximum number is not true, so I cannot normalize the data.
The value of the &1,DEPMAX is the limit of 32bit-number (2^32)/2
Do you have any suggestions?
Best regards
Onur Tan
PS. Here is the sac binary
bin> file sac
sac: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32,
BuildID[sha1]=e8e1bcc88c9c35a7d485a1c78c1f93da6793deee, not s
tripped
------
George Randall (via IRIS) <sac-help-bounce<at>lists.ds.iris.edu>, 17 Eki 2022
Pzt, 18:59 tarihinde şunu yazdı:
Hello Sac Users
I received an email from a fellow retired seismologist who has used SAC
for decades and is a user of macros and Blackboard Variables. He
encountered
an apparent issue with large numbers not working. I have experimented and
I think SETBB/GETBB don't seem to work for numbers >= 2^31
SAC> setbb ts1 3.14159
SAC> getbb ts1
ts1 = 3.14159
SAC> setbb ts2 2.0E+09
SAC> getbb ts2
ts2 = 2000000000
SAC> setbb ts3 2.2E+09
SAC> getbb ts3
ts3 = -2147483648
trying 2^31 -1 and 2^31
SAC> setbb ts4 2147483647
SAC> getbb ts4
ts4 = 2147483647
SAC> setbb ts5 2147483648
SAC> getbb ts5
ts5 = -2147483648
I haven't seen any Blackboard Variable limitations in the SAC
documentation.
I am not even sure how SAC internally represents and stores
Blackboard Variables.
Are Large real values not supported? Thanks for any workarounds or
clarifications on the intent of Blackboard Variables for large floating
point
values.
George Randall
Retired but still interested in SAC
----------------------
SAC Help
Topic home: http://ds.iris.edu/message-center/topic/sac-help/ |
Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu
Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
Update subscription preferences at http://ds.iris.edu/account/profile/