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

gaps.sh 1.5 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
  1. #!/usr/bin/env bash
  2. # Test gmt sample1d interpolation with NaNs
  3. makeps () {
  4. # Must redirect gmt sample1d's stderr messages to avoid seeing them for the 3 bad records
  5. gmt set IO_NAN_RECORDS skip
  6. R=-R-1/15/-3/3
  7. gmt psbasemap $R -JX6i/3i -P -K -Y6i -B5f1g1 -B+t"Skipping NaNs and interpolating through" --FONT_TITLE=18p
  8. gmt psxy $tmp $R -JX6i/3i -Sc0.1i -W0.25p -Ggreen -O -K 2> /dev/null
  9. gmt math $tmp ISNAN 4 SUB = | gmt psxy -R -J -O -K -St0.2i -Gblack -W0.25p
  10. gmt psxy $tmp $R -J -O -K -W2p,red 2> /dev/null
  11. (gmt sample1d $tmp -I0.1 -Fl | gmt psxy $R -J -O -K -W2p,yellow,.) 2> /dev/null
  12. (gmt sample1d $tmp -I0.1 -Fc | gmt psxy $R -J -O -K -W0.5p,blue,-) 2> /dev/null
  13. (gmt sample1d $tmp -I0.1 -Fa | gmt psxy $R -J -O -K -W0.5p,blue ) 2> /dev/null
  14. # New behavior with upper case switches
  15. gmt set IO_NAN_RECORDS pass
  16. gmt psbasemap $R -J -O -K -Y-4.5i -B5f1g1 -B+t"Honoring NaNs as segment indicators" --FONT_TITLE=18p
  17. gmt psxy $tmp $R -J -Sc0.1i -W0.25p -Ggreen -O -K
  18. gmt math $tmp ISNAN 4 SUB = | gmt psxy $R -J -O -K -St0.2i -Gblack -W0.25p
  19. gmt psxy $tmp $R -J -O -K -W2p,red
  20. gmt sample1d $tmp -I0.1 -Fl | gmt psxy -R -J -O -K -W2p,yellow,.
  21. gmt sample1d $tmp -I0.1 -Fc | gmt psxy -R -J -O -K -W0.5p,blue,-
  22. gmt sample1d $tmp -I0.1 -Fa | gmt psxy -R -J -O -K -W0.5p,blue
  23. gmt pstext $R -J -F+f16p+jBL -O -K -N <<< "0 -4.5 Black triangles indicate NaN locations"
  24. gmt psxy $R -J -O -T
  25. }
  26. # First test with ASCII input
  27. ps=gaps_ascii.ps
  28. tmp=tt.txt
  29. gmt convert gaps.nc > $tmp
  30. makeps > $ps
  31. # Do the same with netCDF input
  32. ps=gaps_netcdf.ps
  33. tmp=gaps.nc
  34. makeps > $ps
  35. psref=gaps.ps
Tip!

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

Comments

Loading...