Thread: Character formatting - SAC/fortran

Started: 2010-02-09 18:50:09
Last activity: 2010-02-09 18:50:09
Topics: SAC Help
Fiona Darbyshire
2010-02-09 18:50:09
I inherited a code for conversion of SAC to ASCII with extra information
going into the top of the ASCII file (ready for input to another program).
It's something I haven't used for quite some time and I've installed SAC
101.2 since the last time I used it. Something seems to have changed with
respect to some of the data formatting, so I recompiled the source code and
reran it. This solved one of my data formatting problems, but appears to
have created another. There appears to be some spurious white space in front
of station and component names which is creating an issue for the program
and its use as input to another code. I extracted the relevant piece of
fortran from the code; here it is:

character*4 kstnm
character*100 fin,fout
write(*,*)'Enter infile'
call rsac1(fin,x,nlen,beg,del,NMAX,nerr)
call getkhv('KSTNM',kstnm,nerr)
write(*,*) KSTNM

For a SAC file in which the station name is AKVQ, I get the following
Standard output:

File nmresult (viewed in nedit):

(In each case there is a single space in front of the station or component
If I change the character*4 statement for a larger number, I get the full
station name, but still with the space in front and the <nul> marker in the
file under nedit. The space and the nul cause problems for inputting the
station/component information to the next stage of the data analysis
So my question is simply: why the space in front of the names, and is there
a way to eradicate it?


Fiona Darbyshire
Université du Québec à Montréal

06:15:42 v.eb79165e