Thread: help request on "Unexpected character"

Started: 2019-01-15 07:29:00
Last activity: 2019-01-16 17:46:04
Topics: SAC Help
Sonia Bzrgn
2019-01-15 07:29:00
Hi everybody!
To correct the header of my waveforms (for example entering hypocenter information to sac header), I use this script:

#!/bin/csh


set outdir=/home/sonia/Slip/sacheader

set origin=(2012 01 11 17 08 00.79)
set lat_lon_dp=(36.3533 52.7873 15.6)
# --> year mm dd hh mm ss.s
# --> 2003 04 29 13 53 16.8





set evla=$lat_lon_dp[1]
set evlo=$lat_lon_dp[2]
set evdp=$lat_lon_dp[3]
set jul_day=`julday $origin[2] $origin[3] $origin[1] | grep Julian | awk '{print $3}'`
set sec_aux=`echo $origin[6] | awk '{print int($1),($1-int($1))*1000}'`
set OT=($origin[1] $jul_day $origin[4] $origin[5] $sec_aux[1] $sec_aux[2])



foreach st (`ls $outdir/*SAC`)

sac << END_sac
cd $outdir
readhdr $st
CHNHDR O GMT $OT
EVALUATE &,o * -1 to C
CHNHDR ALLT %C IZTYPE IO
ch evla $evla
ch evlo $evlo
ch evdp $evdp
ch LOVROK true
ch LCALDA true

writehdr over
exit
END_sac

end

and when I try to run it, I get this error:
Unexpected character: EVALUATE &,o * -1 to C
^
ERROR 1201: Could not find VARS variable C

I used to run this script in the past with another PC at the university and everything was right but now in my laptop ... I don't know what is wrong with it.
I was wondering if somebody could do me a great favor and help me through it in this critical situation for my project.
Thanks for your consideration.
  • Geo .
    2019-01-16 17:46:04
    Hi Sonia,
    Looks like you updated your sac version. Please check carefully if the
    following change works.

    EVALUATE to C &1,o& * -1

    Januka

    Januka Attanayake
    Research Fellow | Earthquake Seismology
    Homepage: *https://sites.google.com/site/janukaattanayake
    https://sites.google.com/site/janukaattanayake*

    School of Earth Sciences | McCoy Bldg. 200
    University of Melbourne | Parkville 3010 VIC
    Australia




    On Wed, 16 Jan 2019 at 04:32, Sonia Bzrgn <bazargan.s<at>ut.ac.ir> wrote:

    Hi everybody!
    To correct the header of my waveforms (for example entering hypocenter
    information to sac header), I use this script:

    #!/bin/csh


    set outdir=/home/sonia/Slip/sacheader

    set origin=(2012 01 11 17 08 00.79)
    set lat_lon_dp=(36.3533 52.7873 15.6)
    # --> year mm dd hh mm ss.s
    # --> 2003 04 29 13 53 16.8





    set evla=$lat_lon_dp[1]
    set evlo=$lat_lon_dp[2]
    set evdp=$lat_lon_dp[3]
    set jul_day=`julday $origin[2] $origin[3] $origin[1] | grep Julian | awk
    '{print $3}'`
    set sec_aux=`echo $origin[6] | awk '{print int($1),($1-int($1))*1000}'`
    set OT=($origin[1] $jul_day $origin[4] $origin[5] $sec_aux[1] $sec_aux[2])



    foreach st (`ls $outdir/*SAC`)

    sac << END_sac
    cd $outdir
    readhdr $st
    CHNHDR O GMT $OT
    EVALUATE &,o * -1 to C
    CHNHDR ALLT %C IZTYPE IO
    ch evla $evla
    ch evlo $evlo
    ch evdp $evdp
    ch LOVROK true
    ch LCALDA true

    writehdr over
    exit
    END_sac

    end

    and when I try to run it, I get this error:
    Unexpected character: EVALUATE &,o * -1 to C
    ^
    ERROR 1201: Could not find VARS variable C

    I used to run this script in the past with another PC at the university
    and everything was right but now in my laptop ... I don't know what is
    wrong with it.
    I was wondering if somebody could do me a great favor and help me through
    it in this critical situation for my project.
    Thanks for your consideration.

    ----------------------
    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/


    • Sonia Bzrgn
      2019-01-16 15:52:08
      Dear Januka,
      Thanks for taking the time to respond.
      I did what you said and the error is this:
      unknown header format: 1 ',o'

      I was wondering if you could comment about this error. Thanks for your consideration.
      Sincerely
02:10:18 v.b3198453