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

apiconv.sh 1.3 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  1. #!/usr/bin/env bash
  2. #
  3. # Test the C API for conversions between datasets, matrices, and vectors.
  4. # Also read groups of items just to free them,
  5. # This files holds what is expected to be produced
  6. cat << EOF > testapiconv_answer.txt
  7. 1 2
  8. 2 3
  9. 3 4
  10. 6 7
  11. 7 8
  12. 11 2
  13. 21 3
  14. 31 4
  15. 61 7
  16. 71 8
  17. 1 2
  18. 2 3
  19. 3 4
  20. 6 7
  21. 7 8
  22. 11 2
  23. 21 3
  24. 31 4
  25. 61 7
  26. 71 8
  27. EOF
  28. # Make to dataset tables with headers and segments
  29. cat << EOF > A.txt
  30. # Some dumb header
  31. # that happens to take up two lines
  32. > Some header for A
  33. 1 2
  34. 2 3
  35. 3 4
  36. > Another header for A
  37. 6 7
  38. 7 8
  39. EOF
  40. cat << EOF > B.txt
  41. # Another dumb header
  42. > Some header for B
  43. 11 2
  44. 21 3
  45. 31 4
  46. > Another header for B
  47. 61 7
  48. 71 8
  49. EOF
  50. # Make 3 grids, CPT, and PS
  51. gmt grdmath -R0/5/0/5 -I1 X = x.nc
  52. gmt grdmath -R0/5/0/5 -I1 Y = y.nc
  53. gmt grdmath -R0/5/0/5 -I1 X Y MUL = x.nc
  54. gmt makecpt -Cjet -T0/10 > a.cpt
  55. gmt makecpt -Cpolar -T0/100 > b.cpt
  56. gmt makecpt -Cgray -T0/1000/100 > last.cpt
  57. gmt psbasemap -R0/20/0/20 -JM6i -P -Baf > first.ps
  58. gmt psbasemap -R0/20/20/40 -JM6i -P -Baf > second.ps
  59. gmt psbasemap -R0/20/40/60 -JM6i -P -Baf > third.ps
  60. # testapiconv will read the groups or grids, cpts and ps but not doing anything
  61. # unless it crashes of course, It then writes out A and B via matrix and vector to a file
  62. testapiconv
  63. cat *AB*.txt > results.txt
  64. diff -q --strip-trailing-cr results.txt testapiconv_answer.txt > fail
Tip!

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

Comments

Loading...