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

ex15.sh 1.3 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. # GMT EXAMPLE 15
  3. #
  4. # Purpose: Gridding and clipping when data are missing
  5. # GMT modules: blockmedian, gmtconvert, grdclip, grdcontour, grdinfo
  6. # GMT modules: info, nearneighbor, coast, mask, surface, plot
  7. # Unix progs: rm
  8. #
  9. gmt begin ex15
  10. gmt convert @ship_15.txt -bo > ship.b
  11. region=$(gmt info ship.b -I1 -bi3d)
  12. gmt subplot begin 2x2 -M0.3c/0.1c -Fs7.5c/0 $region -JM7.5c -BWSne -T"Gridding with missing data"
  13. # Raw nearest neighbor contouring
  14. gmt nearneighbor $region -I10m -S40k -Gship.nc ship.b -bi
  15. gmt grdcontour ship.nc -JM -C250 -A1000 -Gd5c -c1,0
  16. # Grid via surface but mask out area with no data using coastlines
  17. gmt blockmedian ship.b -b3d > ship_10m.b
  18. gmt surface ship_10m.b -Gship.nc -bi
  19. gmt mask -I10m ship.b -T -Glightgray -bi3d -c1,1
  20. gmt grdcontour ship.nc -C250 -L-8000/0 -A1000 -Gd5c
  21. # Grid via surface but mask out area with no data
  22. gmt mask -I10m ship_10m.b -bi3d -c0,0
  23. gmt grdcontour ship.nc -C250 -A1000 -L-8000/0 -Gd5c
  24. gmt mask -C
  25. # Clip data above sealevel then overlay land
  26. gmt grdclip ship.nc -Sa-1/NaN -Gship_clipped.nc
  27. gmt grdcontour ship_clipped.nc -C250 -A1000 -L-8000/0 -Gd5c -c0,1
  28. gmt coast -Ggray -Wthinnest
  29. gmt grdinfo -Cn -M ship.nc | gmt plot -Sa0.5c -Wthick -i10,11 -Gred
  30. gmt subplot end
  31. gmt end show
  32. rm -f ship.b ship_10m.b ship.nc ship_clipped.nc
Tip!

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

Comments

Loading...