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

lonshift.sh 1.1 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
  1. #!/usr/bin/env bash
  2. #
  3. # Check if we can wrap global grids over longitude
  4. #
  5. ps=lonshift.ps
  6. # Make a data set (z values)
  7. $AWK 'BEGIN{n=12;m=0;for (j=0;j<6*n;j++) {if (j%n==0) m--;print sin(m*3.14159265/6);m++}}' > tmp.txt
  8. # Build gridline-registered grid
  9. gmt xyz2grd -I30 -Gtmp.nc -ZTLa -fg -R15/345/-75/75 tmp.txt
  10. gmt makecpt -Crainbow -T-1/1/0.1 > tmp.cpt
  11. # Plot orig grid and force actual region -R15/345/-75/75 despite a global grid
  12. gmt grdimage -Ctmp.cpt tmp.nc -JX6i/3i -Bx60f10 -By30f10 -BWeSn+t"Plotted as 15/345/-75/75" --MAP_FRAME_TYPE=plain --FONT_ANNOT_PRIMARY=10p --FORMAT_GEO_MAP=DF -R15/345/-75/75 -K -Y6.5i -Xc -P > $ps
  13. # plot location of grid nodes
  14. gmt grd2xyz tmp.nc | gmt psxy -R15/345/-75/75 -JX6i/3i -O -K -Sc0.1i -Gblack -N >> $ps
  15. # Plot orig grid but shifted by giving -R0/360/-75/75
  16. gmt grdimage -Ctmp.cpt tmp.nc -J -Bx60f10 -By30f10 -BWeSn+t"Plotted as 0/360/-75/75" --MAP_FRAME_TYPE=plain --FONT_ANNOT_PRIMARY=10p --FORMAT_GEO_MAP=DF -R0/360/-75/75 -Y-5i -O -K >> $ps
  17. # plot location of grid nodes
  18. gmt grd2xyz tmp.nc | gmt psxy -R0/360/-75/75 -JX6i/3i -O -Sc0.1i -Gblack -N >> $ps
Tip!

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

Comments

Loading...