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