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

sphere_volume.sh 992 B

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
  1. #!/bin/bash
  2. #
  3. # $Id: grdvolume.sh 15178 2015-11-06 10:45:03Z fwobbe $
  4. # Make a sphere of radius 10 using two half grids and compute volumnes
  5. # Addressing issue #895
  6. ps=sphere_volume.ps
  7. gmt grdmath -R-10.1/10.1/-10.1/10.1 -I0.1 X Y HYPOT 10 DIV ACOS SIN 10 MUL NEG = bot_half.grd
  8. gmt grdmath bot_half.grd NEG = top_half.grd
  9. T=(`gmt grdvolume top_half.grd -C0 --FORMAT_FLOAT_OUT=%.3f`)
  10. B=(`gmt grdvolume bot_half.grd -Cr-10/0 --FORMAT_FLOAT_OUT=%.3f`)
  11. gmt grdgradient top_half.grd -Nt1 -A45 -Gint.grd
  12. echo "-100 gray 100 gray" > t.cpt
  13. gmt grdview bot_half.grd -Iint.grd -Ct.cpt -Qi100 -Jx0.2i -Jz0.2i -p125/35 -P -Baf -BwSnE -K -X1.5i > $ps
  14. echo "Area = ${B[1]} Volume = ${B[2]}" | gmt pstext -R -J -Jz -O -K -p -F+f18p+cBC+jTC -Dj0/0.4i -N >> $ps
  15. gmt grdview top_half.grd -Iint.grd -Ct.cpt -Qi100 -Jx0.2i -Jz0.2i -p125/35 -P -Baf -BwSnE -O -K -Y5.25i >> $ps
  16. echo "Area = ${T[1]} Volume = ${T[2]}" | gmt pstext -R -J -Jz -O -K -p -F+f18p+cBC+jTC -Dj0/0.4i -N >> $ps
  17. 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...