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

varfilter.sh 1.0 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
  1. #!/usr/bin/env bash
  2. # Make a series of 4 spikes on a grid, then create a variable
  3. # filter width grid with 4 quandrants of different widths
  4. gmt begin varfilter ps
  5. # Make the data:
  6. gmt grdmath -R-20/20/-20/20 -I0.25 0 = a.grd
  7. gmt grdmath -R-10/10/-10/10 -I20 1 = b.grd
  8. gmt grd2xyz a.grd > tmp
  9. gmt grd2xyz b.grd >> tmp
  10. gmt xyz2grd -R-20/20/-20/20 -I0.25 tmp -Az -Gin.grd
  11. # Make the filter width grid
  12. gmt grdmath -R-20/20/-20/20 -I0.25 X 0 GE 2 MUL Y 0 GE ADD 1 ADD 5 MUL = fw.grd
  13. # Make the plot
  14. gmt subplot begin 2x2 -Fs3i -Sr -Sc -T"Variable Filter Width" -M0.5c
  15. gmt makecpt -T0/1 -Cwhite,black -H > t.cpt
  16. gmt makecpt -T0/0.005 -Cjet -H > f.cpt
  17. gmt grdimage in.grd -c0 -Ct.cpt
  18. gmt basemap -c1
  19. gmt grdimage fw.grd -Cjet -t50
  20. gmt text -F+f36p<<- EOF
  21. -10 -10 5
  22. +10 -10 15
  23. -10 +10 10
  24. +10 +10 20
  25. EOF
  26. gmt grdfilter in.grd -Fg20 -Gg.grd -D0
  27. gmt grdimage g.grd -c2 -Cf.cpt
  28. gmt grdfilter in.grd -Fgfw.grd -Gfg.grd -D0
  29. gmt grdimage fg.grd -c3 -Cf.cpt
  30. gmt subplot end
  31. gmt end show
  32. rm -f a.grd b.grd tmp in.grd fw.grd t.cpt f.cpt
Tip!

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

Comments

Loading...