Making Procedure of a size distribution plot of earthquakes from JMA seismicity catalog by Yoshio Okamoto 27th 2019

Data:  http://www.data.jma.go.jp/svd/eqev/data/bulletin/hypo.html (It seems to be in Japanese only now.)

1. Combine the data from annual to a period.

cat h1986 h1987 ----- h2015 h2016 > H1986-2016

2. Convert the data format JMA to GMT style
 
#!/bin/sh
# Data conversion JMA to GMT format
# by Yoshio Okamoto 16/July 2013, 27/February 2019

tr ' ' '_'  <H1986-2016> tp1.txt
awk 'substr($0,1,1) == "J"' tp1.txt > tp2.txt
awk '{print substr($0,2,16),substr($0,23,6),substr($0,34,7),substr($0,45,5),substr($0,53,2)}' tp2.txt > tp3.txt
awk 'substr($5,1,1) != "-" && substr($5,1,1) != "_" && substr($5,1,1) != "A" && substr($5,1,1) != "B" && substr($5,1,1) != "C"' tp3.txt > tp4.txt
tr '_' '0'  < tp4.txt> tp5.txt
awk '{print substr($0,1,16),substr($2,1,2) "." substr(substr($2,3,4)/6000,3,4),substr($3,1,3) "." substr(substr($3,4,4)/6000,3,4),substr($4,1,5)/100,substr($5,1,2)/10}' tp5.txt > tp55.txt
tr ' ' ','  < tp55.txt> tp6.txt
awk '{print $3" " $2" "$4" "$5 > "JMA1986-2016.dat" }' tp55.txt

rm *.txt

#sort -k 3 -n -r JMA986-2016.dat > JMA1986-2016_ds.dat       ## sorting by depth, if it needs.


"JMA1986-2016.dat" is a final one.

3. Pick up the region

#!/bin/sh
# Pick up a area from JMA GMT format data
# by Y.Okamoto 07/Aug 2013, 27th Feb 2019

# Pick up Area = W/E/S/N or GMT -R
W=141
E=144
S=36
N=41

# picking up by area

awk "{ if ((\$1 >= $W) && (\$1 < $E) && (\$2 >= $S) && (\$2 < $N)) { print \$1,\$2,\$3,\$4 }}" "JMA1986-2016.dat" > Sanriku1986-2016.dat


4. Making Size(M)-Frequency distribution


# count.awk modified 27th Feb 2019 by Yoshio Okamoto
# awk -f JMA_M_count.awk Sanriku1986-2016.dat > Sanriku1986-2016_GR.dat

#main

{
  v = $4*10
  count[int(v)]++
}

END {
  for (v in count) {
    print (v/10), count[int(v)]
  }
}

5. Use "Excel" or "Calc" to make a scatter plot.



Copyright (C) 2013-19 Yoshio Okamoto, all rights reserved.