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

periodic.sh 1.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
  1. #!/usr/bin/env bash
  2. #
  3. # Test gmt surface with periodic boundary conditions in longitude
  4. ps=periodic.ps
  5. G=-Gl-90/90/-90/-90,90/90/90/-90
  6. # Make global synthetic grid
  7. gmt grdmath -Rg -I1 X SIND Y 3 MUL COSD MUL 99 MUL = t.nc
  8. gmt math -T-45/45/1 0 = path.txt
  9. # Sample this at ~200 places randomly; saved random in GitHub so repeatable
  10. #gmt math -T0/200/1 -o1 0 360 RAND = x
  11. #gmt math -T0/200/1 -o1 -90 90 RAND = y
  12. #paste x y > random_xy.txt
  13. # Sample synthetic grid at random locations
  14. gmt grdtrack -Gt.nc random_xy.txt | gmt blockmean -Rg -I1 -fg > data.txt
  15. # Grid with gmt surface so periodic boundaries are 0|360
  16. gmt surface -R0/360/-85/85 -I1 -fg data.txt -Gdatag.nc
  17. # Grid with gmt surface so periodic boundaries are -180/+180
  18. gmt surface -R-180/180/-85/85 -I1 -fg data.txt -Gdatad.nc
  19. # Contour grid where Greenwhich was in the middle when gridding
  20. gmt grdcontour datad.nc -C10 -A50 -JQ0/5.5i -P $G -Baf -BWSne -K -Xc -Y0.65i > $ps
  21. gmt psxy -R -J -O -K path.txt -W1p,green >> $ps
  22. gmt psxy -R -J -O -K data.txt -Ss0.05i -Gred >> $ps
  23. # Contour grid where Dateline was in the middle when gridding
  24. gmt grdcontour datag.nc -C10 -A50 -JQ0/5.5i $G -O -Baf -BWsne -K -Y2.85i >> $ps
  25. gmt psxy -R -J -O -K path.txt -W1p,blue >> $ps
  26. gmt psxy -R -J -O -K data.txt -Ss0.05i -Gred >> $ps
  27. # Original synthetic grid for comparison
  28. gmt grdcontour t.nc -C10 -A50 -JQ0/5.5i $G -O -Baf -BWsne -K -Y2.85i >> $ps
  29. # Plot crossection along Equator
  30. gmt grdtrack path.txt -Gdatad.nc -o0,2 | gmt psxy -R-45/45/-70/70 -JX5.5i/1i -Y3i -Bafg90 -BWsne -W2p,green -O -K >> $ps
  31. gmt grdtrack path.txt -Rd -Gdatag.nc -o0,2 | gmt psxy -R-45/45/-70/70 -J -W0.5p,blue -O >> $ps
Tip!

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

Comments

Loading...