Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

ex22.bat 3.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  1. REM GMT EXAMPLE 22
  2. REM
  3. REM Purpose: Automatic map of last month of world-wide seismicity
  4. REM GMT modules: set, coast, plot, legend
  5. REM
  6. gmt begin ex22
  7. gmt set FONT_ANNOT_PRIMARY 10p FONT_TITLE 18p FORMAT_GEO_MAP ddd:mm:ssF
  8. REM Get the data (-s silently) from USGS using the curl
  9. REM Hardwired here to the month of October, 2017
  10. REM SITE="https://earthquake.usgs.gov/fdsnws/event/1/query.csv"
  11. REM TIME="starttime=2017-09-01%2000:00:00&endtime=2017-10-01%2000:00:00"
  12. REM MAG="minmagnitude=3"
  13. REM ORDER="orderby=magnitude"
  14. REM URL="${SITE}?${TIME}&${MAG}&${ORDER}"
  15. REM curl -s $URL > usgs_quakes_22.txt
  16. REM Count the number of events (to be used in title later. one less due to header)
  17. gmt which @usgs_quakes_22.txt -G > file.txt
  18. set /p file=<file.txt
  19. gmt info %file% -h1 -Fi -o2 > n.txt
  20. set /p n=<n.txt
  21. REM Pull out the first and last timestamp to use in legend title
  22. gmt info -h1 -f0T -i0 %file% -C --TIME_UNIT=d -I1 -o0 --FORMAT_CLOCK_OUT=- > first.txt
  23. set /p first=<first.txt
  24. gmt info -h1 -f0T -i0 %file% -C --TIME_UNIT=d -I1 -o1 --FORMAT_CLOCK_OUT=- > last.txt
  25. set /p last=<last.txt
  26. REM Assign a string that contains the current user @ the current computer node.
  27. REM Note that two @@ is needed to print a single @ in gmt text:
  28. set me=GMT guru @@ GMTbox
  29. REM Create standard seismicity color table
  30. gmt makecpt -Cred,green,blue -T0,100,300,10000 -N
  31. REM Start plotting. First lay down map, then plot quakes with size = magnitude * 0.015":
  32. gmt coast -Rg -JK180/22c -B45g30 -B+t"World-wide earthquake activity" -Gburlywood -Slightblue -A1000 -Y7c
  33. gmt plot -C -Sci -Wfaint -hi1 -i2,1,3,4+s0.015 %file%
  34. REM Create legend input file for NEIS quake plot
  35. echo H 16p,Helvetica-Bold %n% events during %first% to %last% > neis.legend
  36. echo D 0 1p >> neis.legend
  37. echo N 3 >> neis.legend
  38. echo V 0 1p >> neis.legend
  39. echo S 0.25c c 0.25c red 0.25p 0.5c Shallow depth (0-100 km) >> neis.legend
  40. echo S 0.25c c 0.25c green 0.25p 0.5c Intermediate depth (100-300 km) >> neis.legend
  41. echo S 0.25c c 0.25c blue 0.25p 0.5c Very deep (^> 300 km) >> neis.legend
  42. echo D 0 1p >> neis.legend
  43. echo V 0 1p >> neis.legend
  44. echo N 7 >> neis.legend
  45. echo V 0 1p >> neis.legend
  46. echo S 0.25c c 0.15c - 0.25p 0.75c M 3 >> neis.legend
  47. echo S 0.25c c 0.20c - 0.25p 0.75c M 4 >> neis.legend
  48. echo S 0.25c c 0.25c - 0.25p 0.75c M 5 >> neis.legend
  49. echo S 0.25c c 0.30c - 0.25p 0.75c M 6 >> neis.legend
  50. echo S 0.25c c 0.35c - 0.25p 0.75c M 7 >> neis.legend
  51. echo S 0.25c c 0.40c - 0.25p 0.75c M 8 >> neis.legend
  52. echo S 0.25c c 0.45c - 0.25p 0.75c M 9 >> neis.legend
  53. echo D 0 1p >> neis.legend
  54. echo V 0 1p >> neis.legend
  55. echo N 1 >> neis.legend
  56. REM Put together a reasonable legend text, and add logo and user's name:
  57. echo G 0.25l >> neis.legend
  58. echo P >> neis.legend
  59. echo T USGS/NEIS most recent earthquakes for the last month. The data were >> neis.legend
  60. echo T obtained automatically from the USGS Earthquake Hazards Program page at >> neis.legend
  61. echo T @_https://earthquake.usgs.gov@_. Interested users may also receive email alerts >> neis.legend
  62. echo T from the USGS. >> neis.legend
  63. echo T This script could be called monthly to update the latest information. >> neis.legend
  64. echo G 0.9c >> neis.legend
  65. echo # Add USGS logo >> neis.legend
  66. echo I @USGS.png 1i RT >> neis.legend
  67. echo G -0.75c >> neis.legend
  68. echo L 12p,Times-Italic LB %me% >> neis.legend
  69. REM OK, now we can actually run gmt legend. We center the legend below the map.
  70. REM Trial and error shows that 1.7i is a good legend height:
  71. gmt legend -DJBC+o0/1c+w18c/4.2c -F+p+glightyellow neis.legend
  72. del neis.legend usgs_quakes_22.txt
  73. gmt end show
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...