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

cylundulation.sh 1.8 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
34
35
36
37
38
39
40
41
42
43
44
45
46
  1. #!/usr/bin/env bash
  2. # Testing gmt grdfft power spectrum for known signal
  3. ps=cylundulation.ps
  4. # Make data set of two sinusoids and some noise:
  5. # 1) Propagating in 20 degrees direction: J = 3, A = 6, phi = 1.0 radian
  6. # 2) Propagating in -60 degrees direction: I = 18, A = 4, phi = 0.5 radian
  7. # 3) Random noise with mean = 2 and std = 1
  8. # Note: Commands creating surf.nc are commented out since they include adding noise and we
  9. # don't want the noise to change each time, giving PS failures.
  10. #gmt grdmath -R0/127/0/127 -I1 X 18 COSD MUL Y 18 SIND MUL ADD 128 DIV 3 MUL 2 MUL PI MUL 1 ADD COS 6 MUL = A.nc
  11. #gmt grdmath -R0/127/0/127 -I1 X -60 COSD MUL Y -60 SIND MUL ADD 128 DIV 18 MUL 2 MUL PI MUL 0.5 ADD COS 4 MUL = B.nc
  12. #gmt grdmath -R0/127/0/127 -I1 2 1 NRAND = C.nc
  13. #gmt grdmath A.nc B.nc ADD C.nc ADD = surf.nc
  14. gmt makecpt -Cpolar -T-14/14 > t.cpt
  15. gmt grdimage @surf.nc -JX4.5i -Ct.cpt -B64f32g64+u" m" -BWSne -P -K -Xc -Y0.5i > $ps
  16. gmt psxy -R@surf.nc -J -O -K -Sv0.21i+e -Wthick -Gblack << EOF >> $ps
  17. 64 64 18 2i
  18. 64 64 -60 2i
  19. EOF
  20. gmt psscale -DJRM+w4.5i/0.1i -Ct.cpt -Baf -R -J -O -K >> $ps
  21. gmt grdfft @surf.nc -Ex+w -N+zp --GMT_FFT=brenner > /dev/null
  22. gmt makecpt -Cwhite,gray -T0/0.5 -N > t.cpt
  23. gmt makecpt -Fr -N -T0.5/3.5/1 -Crainbow >> t.cpt
  24. gmt grdimage surf_mag.nc -R-1/1/-1/1 -J -O -K -Ct.cpt -Bafg1+u" m@+-1@+" -BWSne+t"Two cylindrical undulations and noise" -Y5i >> $ps
  25. y=$(gmt math -Q 18 TAND =)
  26. x=$(gmt math -Q 90 -60 ADD TAND =)
  27. gmt psxy -R-1/1/-1/1 -J -O -K -Wthin << EOF >> $ps
  28. >
  29. -1 -$y
  30. 1 $y
  31. >
  32. -$x 1
  33. $x -1
  34. EOF
  35. gmt psxy -R -J -O -K -Sm0.1i+e+b -W0.25p -Gblack << EOF >> $ps
  36. 0 0 1i 0 18
  37. 0 0 1.5i -60 0
  38. EOF
  39. gmt pstext -R -J -O -K -F+f12p << EOF >> $ps
  40. 0.65 -0.35 60@.
  41. 0.52 0.08 18@.
  42. EOF
  43. gmt psscale -DJRM+w4.5i/0.1i -Ct.cpt -R -J -O -K >> $ps
  44. gmt psxy -R -J -O -T >> $ps
Tip!

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

Comments

Loading...