Windows GMT issue-project seismic data and gawk command issue

Dear all,

I am an amateur Windows GMT user. I use it frequently to plot the focal mechanisms, GPS vectors, and especially project seismic data using profiles. Previously, I had some problem with my scripts, but trying different troubleshooting (which I don’t recall at the moment) I managed to run the scripts easily within last months. Last week I learned the scripts do not run properly again, and the issue is again the “gawk” command line (the old issue). Furthermore, the “project” script strangely project a dataset but yields nothing on another dataset with a similar format.

Thank you for your helps in advance.
Aram Fathian

Since you only informed us about your problem but didn’t provide any details (e.g. example code), there is nothing anyone can do to help you :slight_smile:

Sorry for not being informative. Here are the scripts:

psbasemap -R44.75/46.6/34/35.5 -JM10 -P2 -B0.5g10:."":WSen -K2 -Uc > plot.ps
pscoast -R -J -O -K -W2 -Df -Na/1/0/0/255 -C151/219/242 -Ia/0/100/255 -Lf46.7/34.1/0.95/20+lkm >> plot.ps

makecpt -Crainbow -T0/30/10 -Z > seis.cpt

rem plot earthquake epicenters:
gawk ‘{print $1,$2,$3,$4*0.05}’ Dataset-1.txt | psxy -R -J -Sc -W100/100/100 -Cseis.cpt -P -V -K -O >> plot.ps

rem Project earthquake data:
project -C45.29/34.74 -E46.06/34.73 -G0.001 -N > track1.txt
psxy track1.txt -R -J -W2/100/100/100 -O -K >> plot.ps
project dataset-1.txt -C45.29/34.74 -E46.06/34.73 -W-30/30 -Q > epi_profile.txt

project focal_CMT.txt -C45.29/34.74 -E46.06/34.73 -W-30/30 -Q > profile_CMT.txt

echo 45.29 34.74 > tmp
echo 46.06 34.73 >> tmp

psxy tmp -R -J -W2,- -K -O >> plot.ps
echo 45.29 34.74 A | pstext -R -J -F+f16p,1,darkgreen -G230 -K -O >> plot.ps
echo 46.06 34.73 A’| pstext -R -J -F+f16p,1,darkgreen -G230 -K -O >> plot.ps

rem plot cross section of the earthquakes:
psbasemap -R0/90/0/25 -JX15/-5 -BWeSn -Bxa+l"Distance (km)" -Bya+l"Depth (km)" -Y15 -K -O >> plot.ps
gawk ‘{print $5,$3,$4*0.05}’ epi_profile.txt | psxy -R -JX -Sc -G0/100/255 -K -O >> plot.ps
pscoupe profile_CMT.txt -R -JX13.56/-8 -Sc0.5 -Gblack -Aa45.29/34.74/46.06/34.73/90/60/0/30 -K -O >> plot.ps

plot.ps

and the dataset format is as below:

|Lon|Lat|D|Mag|
|45.844|34.857|12|4.4|
|45.762|34.772|18.1|7.3|
|45.732|34.826|10.6|4.5|
|45.876|34.671|15.9|4.1|
|45.832|34.604|18|3.5|
|45.885|34.512|6|3.7|
|45.855|34.581|7.1|3.7|
|46.064|34.374|7.3|3.5|
|45.992|35.047|18.1|3.3|
|45.854|34.976|8|3.7|
|46.256|34.551|8|3.5|
|45.826|34.545|12.9|3.4|
|45.709|34.723|16.8|4.1|
|45.746|34.563|6.9|3.6|
|46.345|34.727|11.4|3.1|
|46.023|33.831|12|3.6|
|46.291|34.603|8.5|3|
|46.37|34.655|7.5|3|
|45.291|34.626|11.1|3.4|

Thanks

Running the script at the moment yields only this output:

I assume you don’t actually have vertical bars between each column (since that would require awk’s -F option to deal with). You also seem to have a header record not starting with # and hence you need to skip that record with -hi1.

The column are separated by tabs. The problem is that previously the script were working perfectly with these data. but now the codes run until the “gawk” line. I guess something is missing with the software on my PC. I tried to run it on my laptop as well by installing the GMT, but still dealing with this issue. I had this issue earlier but I can’t remember how I could manage to solve it.
Last week, the codes gave provide me this plot:


Now, the same codes give me only the basemap.

If data is separated by tabs you don’t need to use awk, use -i option.
Note also that you only have 4 columns in the data but access to $5 in awk.

True, but using the “project” command to calculate the “epi_profile.txt”, the result would be more than 4 columns and to plot the cross section I need to select the 5th column (distance).
I just learned that the problem might be due to the Gnuwin32 which I couldn’t manage to install on my laptop. it was previously fixed on my PC, but to unknown reason it is now the issue again. This the error I found after running the .bat file:
“ gawk is not recognized as an internal or external”

Clear error message.

As I said, you don’t even need to use awk in this particular case. But the recommended unix environment is the one that comes with Git. I think this one
https://git-scm.com/downloads

Perfect! Thanks! Now I am getting the expected results again.