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

scaling.sh 1.7 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
  1. #!/usr/bin/env bash
  2. # Test case for bug in -i with psxy where there is a conversion from datavalue
  3. # assumed to be cm before the scaling takes place. The issue is this line
  4. # echo 0 0 150 | gmt psxy -Scc -i0,1,2+s0.01+o-0.5
  5. # where we are saying that 150 should be modified via -i settings to yield a
  6. # value that we wish to consider as diameter of a circle in cm. Instead, the
  7. # 150 is considered to be in cm, converted to 59.0555 (150/2.54), then scaled
  8. # as z = 59.0555 * 0.01 - 0.5 = 0.09 and then used as cm (i.e, ~ 1 mm)
  9. ps=scaling.ps
  10. #
  11. # LL: Plot 1 inch and 1 cm circles
  12. gmt psxy -R-2/2/-2/4 -Jx1c -P -Baf -Sc -Gblack -K -X5c -Y8c << EOF > $ps
  13. 0 0 1c
  14. 0 2 1i
  15. EOF
  16. # LR
  17. # Convert the value of 100 to 1 cm
  18. echo 0 0 100 | gmt psxy -R -J -Baf -O -K -Scc -i0,1,2+s0.01 -Gblack -X6c >> $ps
  19. # Convert the value of 100 to 1 inch
  20. echo 0 2 100 | gmt psxy -R -J -O -K -Sci -i0,1,2+s0.01 -Gblack >> $ps
  21. # UL
  22. # BUG: Convert the value of 150 to 1 cm via z = (150 - 50) * 0.01 = 150 * 0.01 - 0.5
  23. # The 150 is converted to inch (prematurely) then scaled and offset and may even go negative
  24. # Next line faked the answer to build a test ps:
  25. # echo 0 0 1 | gmt psxy -R -J -Baf -O -K -Scc -Gblack -X-6c -Y8c >> $ps
  26. # Next line is the offending line:
  27. echo 0 0 150 | gmt psxy -R -J -Baf -O -K -Scc -i0,1,2+s0.01+o-0.5 -Gblack -X-6c -Y8c >> $ps
  28. # Convert the value of 150 to 1 inch via z = (150 - 50) * 0.01 = 150 * 0.01 - 0.5
  29. echo 0 2 150 | gmt psxy -R -J -O -K -Sci -i0,1,2+s0.01+o-0.5 -Gblack >> $ps
  30. # UR
  31. # Simulate what we want with awk, first for cm
  32. echo 0 0 150 | awk '{print $1, $2, ($3-50)*0.01}' | gmt psxy -R -J -Baf -O -K -Scc -Gblack -X6c >> $ps
  33. # Simulate what we want with awk, for inch
  34. echo 0 2 150 | awk '{print $1, $2, ($3-50)*0.01}' | gmt psxy -R -J -O -Sci -Gblack >> $ps
Tip!

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

Comments

Loading...