Skip to content

Commit

Permalink
Merge branch 'master' into longopts-sphdistance
Browse files Browse the repository at this point in the history
  • Loading branch information
joa-quim authored Mar 2, 2024
2 parents 1f060a6 + 3047036 commit a5c74a8
Show file tree
Hide file tree
Showing 11 changed files with 373 additions and 67 deletions.
67 changes: 23 additions & 44 deletions src/longopt/greenspline_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,41 @@ static struct GMT_KEYWORD_DICTIONARY module_kw[] = {
short_directives, long_directives,
short_modifiers, long_modifiers,
transproc_mask */
{ 0, 'A', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'C', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'D', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'E', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'G', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'I', "",
"", "",
{ 0, 'A', "gradient",
"", "",
"f", "format",
GMT_TP_STANDARD },
{ 0, 'L', "",
"", "",
"", "",
{ 0, 'C', "approx_fit|approximate",
"n,r,v", "largest,ratio,variance",
"c,f,i,n", "cumulative,file,incremental,no_surface",
GMT_TP_STANDARD },
{ 0, 'M', "",
"", "",
{ 0, 'D', "metadata|mode",
"", "",
"c,d,n,o,r,s,t,v,x,y,z",
"cpt|cmap,dname,invalid,offset,remark,scale,title,varname,xname,yname,zname",
GMT_TP_STANDARD },
{ 0, 'N', "",
"", "",
{ 0, 'E', "misfit",
"", "",
"r", "report",
GMT_TP_STANDARD },
{ 0, 'Q', "",
"", "",
GMT_G_OUTGRID_KW,
{ 0, 'I', "inc|increment|spacing", "", "", "", "", GMT_TP_STANDARD },
{ 0, 'L', "detrend|leave_trend",
"t,r", "leastsquares,residuals",
"", "",
GMT_TP_STANDARD },
{ 0, 'S', "",
"", "",
"", "",
{ 0, 'N', "nodes", "", "", "", "", GMT_TP_STANDARD },
{ 0, 'Q', "derivative|dir_derivative|vector", "", "", "", "", GMT_TP_STANDARD },
{ 0, 'S', "splines",
"c,l,p,q,r,t", "min_scurvature,linear,min_pcurvature,ctensionA,rtension,ctensionB",
"e,n", "error,npoints",
GMT_TP_STANDARD },
{ 0, 'T', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'W', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'Z', "",
"", "",
{ 0, 'T', "maskgrid|mask", "", "", "", "", GMT_TP_STANDARD },
{ 0, 'W', "uncertainties",
"w", "weights",
"", "",
GMT_TP_STANDARD },
{ 0, 'Z', "distmode|mode", "", "", "", "", GMT_TP_STANDARD },
{ 0, '\0', "", "", "", "", "", 0 } /* End of list marked with empty option and strings */
};
#endif /* !GREENSPLINE_INC_H */
29 changes: 7 additions & 22 deletions src/longopt/sphinterpolate_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,15 @@ static struct GMT_KEYWORD_DICTIONARY module_kw[] = {
short_directives, long_directives,
short_modifiers, long_modifiers,
transproc_mask */
{ 0, 'D', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'G', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'I', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'Q', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'T', "",
"", "",
"", "",
GMT_TP_STANDARD },
{ 0, 'Z', "",
"", "",
{ 0, 'D', "skipdup", "", "", "", "", GMT_TP_STANDARD },
GMT_G_OUTGRID_KW,
GMT_I_INCREMENT_KW,
{ 0, 'Q', "tension",
"g,l,p,s", "global,local,piecewise,smooth",
"", "",
GMT_TP_STANDARD },
{ 0, 'T', "vartension|var_tension", "", "", "", "", GMT_TP_STANDARD },
{ 0, 'Z', "scale", "", "", "", "", GMT_TP_STANDARD },
{ 0, '\0', "", "", "", "", "", 0 } /* End of list marked with empty option and strings */
};
#endif /* !SPHINTERPOLATE_INC_H */
2 changes: 1 addition & 1 deletion src/longopt/triangulate_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static struct GMT_KEYWORD_DICTIONARY module_kw[] = {
"", "",
"b", "binary",
GMT_TP_STANDARD },
{ 0, 'M', network", "", "", "", "", GMT_TP_STANDARD },
{ 0, 'M', "network", "", "", "", "", GMT_TP_STANDARD },
{ 0, 'N', "ids", "", "", "", "", GMT_TP_STANDARD },
{ 0, 'Q', "voronoi",
"n", "polygon",
Expand Down
36 changes: 36 additions & 0 deletions test/pslegend/pslegend-l2s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# Test pslegend longopts translation.

m=pslegend
l2s='--l2stranstest'
a=$m-l2s-a.txt
b=$m-l2s-b.txt
rm -f $a $b ; touch $b

cat << EOF > $a
--l2stranstest -C1/2
--l2stranstest -D10/20/2/3 -Dg1/-0.5+w7
--l2stranstest -DjBR+jLT+l2
--l2stranstest -DJBR+o1/2
--l2stranstest -Dn0/0 -Dx5/5
--l2stranstest -F+c10+gred+i4p/black
--l2stranstest -F+p2p+r1p+s1/2/gray
--l2stranstest -Mh -Me
--l2stranstest -S4
--l2stranstest -T/my/secrets -T/your/secrets
EOF

# module-specific longopts
gmt $m $l2s --clearance=1/2 >> $b
gmt $m $l2s --position=10/20/2/3 --position=mapcoords:1/-0.5+width:7 >> $b
gmt $m $l2s --position=inside:BR+janchor:LT+spacing:2 >> $b
gmt $m $l2s --position=outside:BR+anchoroffset:1/2 >> $b
gmt $m $l2s --position=boxcoords:0/0 --position=plotcoords:5/5 >> $b
gmt $m $l2s --box+clearance:10+fill:red+inner:4p/black >> $b
gmt $m $l2s --box+pen:2p+radius:1p+shade:1/2/gray >> $b
gmt $m $l2s --source=hidden --source=explicit >> $b
gmt $m $l2s --scale=4 >> $b
gmt $m $l2s --hidden_file=/my/secrets --leg_file=/your/secrets >> $b

diff $a $b --strip-trailing-cr > fail
72 changes: 72 additions & 0 deletions test/psternary/psternary-l2s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash
#
# Test psternary longopts translation.

m=psternary
l2s='--l2stranstest'
a=$m-l2s-a.txt
b=$m-l2s-b.txt
rm -f $a $b ; touch $b

cat << EOF > $a
--l2stranstest -C/some/file -C/some/other/file -Jz1i
--l2stranstest -Gred -Gp25+bgreen+fgray -Jz1i
--l2stranstest -GP3+bwhite+fred+r300 -Jz1i
--l2stranstest -L1/2/3 -L4/-/- -Jz1i
--l2stranstest -N -N -Jz1i
--l2stranstest -S-1 -S+2 -Sa3 -Jz1i
--l2stranstest -SA4 -Sc5 -Jz1i
--l2stranstest -SC6 -Sd7 -Jz1i
--l2stranstest -SD8 -Se1/2/3 -Jz1i
--l2stranstest -Sg4 -SG5 -Jz1i
--l2stranstest -Sh6 -SH7 -Jz1i
--l2stranstest -Si8 -Si9 -Jz1i
--l2stranstest -SI1 -Sj1/2/3 -Jz1i
--l2stranstest -Sj4/5/6 -SkSomething/20 -Jz1i
--l2stranstest -Sl4+tMyText+fHelv+jCM -Jz1i
--l2stranstest -Sn1 -SN2 -Jz1i
--l2stranstest -Sp3 -Sr4/5 -Jz1i
--l2stranstest -Sr+s -Jz1i
--l2stranstest -SR1/2/3 -SR4/5/6 -Jz1i
--l2stranstest -Ss7 -SS8 -Jz1i
--l2stranstest -St9 -ST1 -Jz1i
--l2stranstest -Sw1/2/3 -Sw+i4 -Jz1i
--l2stranstest -Sw+a5 -Sw+r10+p2p,red -Jz1i
--l2stranstest -Sx -Sy -Jz1i
--l2stranstest -W1p,blue,solid -Jz1i
EOF

# module-specific longopts
#
# psternary pre-scans its options array prior to longoption translation
# and will append -Jz1i if it does not see -M, meaning that we cannot
# offer any longoption equivalent for -M (e.g., --dump) or this pre-scan
# will fail to locate that equivalent and incorrectly append -Jz1i
#gmt $m $l2s --dump >> $b
gmt $m $l2s --cpt=/some/file --cmap=/some/other/file >> $b
gmt $m $l2s --fill=red --fill=bit:25+bg:green+foreground:gray >> $b
gmt $m $l2s --fill=bitreverse:3+background:white+fg:red+dpi:300 >> $b
gmt $m $l2s --labels=1/2/3 --vertex_labels=4/-/- >> $b
gmt $m $l2s --noclip --no_clip >> $b
gmt $m $l2s --symbol=xdash:1 --style=plus:2 --symbol=star:3 >> $b
gmt $m $l2s --symbol=star_area:4 --symbol=circle:5 >> $b
gmt $m $l2s --symbol=circle_area:6 --symbol=diamond:7 >> $b
gmt $m $l2s --symbol=diamond_area:8 --symbol=ellipse:1/2/3 >> $b
gmt $m $l2s --symbol=octagon:4 --symbol=octagon_area:5 >> $b
gmt $m $l2s --symbol=hexagon:6 --symbol=hexagon_area:7 >> $b
gmt $m $l2s --symbol=invtriangle:8 --symbol=inverted_tri:9 >> $b
gmt $m $l2s --symbol=invtriangle_area:1 --symbol=rotrectangle:1/2/3 >> $b
gmt $m $l2s --symbol=rotated_rec:4/5/6 --symbol=custom:Something/20 >> $b
gmt $m $l2s --symbol=letter:4+text:MyText+font:Helv+justify:CM >> $b
gmt $m $l2s --symbol=pentagon:1 --symbol=pentagon_area:2 >> $b
gmt $m $l2s --symbol=point:3 --symbol=rectangle:4/5 >> $b
gmt $m $l2s --symbol=rectangle+corners >> $b
gmt $m $l2s --symbol=roundrectangle:1/2/3 --symbol=roundrect:4/5/6 >> $b
gmt $m $l2s --symbol=square:7 --symbol=square_area:8 >> $b
gmt $m $l2s --symbol=triangle:9 --symbol=triangle_area:1 >> $b
gmt $m $l2s --symbol=wedge:1/2/3 --symbol=wedge+inner:4 >> $b
gmt $m $l2s --symbol=wedge+arc:5 --symbol=wedge+radial:10+pen:2p,red >> $b
gmt $m $l2s --symbol=cross --symbol=ydash >> $b
gmt $m $l2s --pen=1p,blue,solid >> $b

diff $a $b --strip-trailing-cr > fail
48 changes: 48 additions & 0 deletions test/pstext/pstext-l2s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
#
# Test pstext longopts translation.

m=pstext
l2s='--l2stranstest'
a=$m-l2s-a.txt
b=$m-l2s-b.txt
rm -f $a $b ; touch $b

cat << EOF > $a
--l2stranstest -A
--l2stranstest -C5/10+to
--l2stranstest -Dj1/2+v2p,red -DJ
--l2stranstest -F+a10 -F+A20
--l2stranstest -F+A30+cTL+f12,Helvetica,red
--l2stranstest -F+cCM+h+jTL
--l2stranstest -F+l -F+r -F+r10
--l2stranstest -F+tblab -F+z%4.2f -F+z
--l2stranstest -Gred+n -Ggreen+n
--l2stranstest -L -L
--l2stranstest -M
--l2stranstest -N -N
--l2stranstest -Ql -Qu
--l2stranstest -S20/30/blue
--l2stranstest -Z -Z
--l2stranstest -W1p,blue,solid
EOF

# module-specific longopts
gmt $m $l2s --azimuth >> $b
gmt $m $l2s --clearance=5/10+textbox:o >> $b
gmt $m $l2s --offset=away:1/2+line:2p,red --offset=corners >> $b
gmt $m $l2s --attributes+angle:10 --attrib+zerocenter:20 >> $b
gmt $m $l2s --attrib+Angle:30+rjustify:TL+font:12,Helvetica,red >> $b
gmt $m $l2s --attrib+region_justify:CM+header+justify:TL >> $b
gmt $m $l2s --attrib+label --attrib+record --attrib+rec_number:10 >> $b
gmt $m $l2s --attrib+text:blab --attrib+zformat:'%4.2f' --attrib+zvalues >> $b
gmt $m $l2s --fill=red+no_text --fill=green+C >> $b
gmt $m $l2s --listfonts --list >> $b
gmt $m $l2s --paragraph >> $b
gmt $m $l2s --noclip --no_clip >> $b
gmt $m $l2s --case=lower --change_case=upper >> $b
gmt $m $l2s --shade=20/30/blue >> $b
gmt $m $l2s --zvalues --threeD >> $b
gmt $m $l2s --pen=1p,blue,solid >> $b

diff $a $b --strip-trailing-cr > fail
52 changes: 52 additions & 0 deletions test/psxyz/psxyz-l2s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
#
# Test psxyz longopts translation.

m=psxyz
l2s='--l2stranstest'
a=$m-l2s-a.txt
b=$m-l2s-b.txt
rm -f $a $b ; touch $b

cat << EOF > $a
--l2stranstest -Am -Ap
--l2stranstest -Ax -Ay
--l2stranstest -Ar -At
--l2stranstest -Csomecpt -Cred,green,blue
--l2stranstest -C#22aa33,#ff00ff,#0077ee
--l2stranstest -D -D12/24
--l2stranstest -Gred+z
--l2stranstest -H5
--l2stranstest -I0.2 -I-0.8
--l2stranstest -L+b+xl+yb+p1p,blue
--l2stranstest -L+d+xr+yt
--l2stranstest -L+D+x6+y7
--l2stranstest -Nc -Nr
--l2stranstest -Q -Q
--l2stranstest -W2p,red+cl+o1p -W1p+s
--l2stranstest -W2p+v -W2p+z
--l2stranstest -Z99+t
--l2stranstest -Z/my/polygon/file.txt+T
EOF

# module-specific longopts
gmt $m $l2s --straightlines=mpfollow --straight_lines=pmfollow >> $b
gmt $m $l2s --straight_line=xyalong --straightlines=yxalong >> $b
gmt $m $l2s --straightlines=rtalong --straightlines=tralong >> $b
gmt $m $l2s --cpt=somecpt --cmap=red,green,blue >> $b
gmt $m $l2s --cpt=#22aa33,#ff00ff,#0077ee >> $b
gmt $m $l2s --offset --offset=12/24 >> $b
gmt $m $l2s --fill=red+zvalue >> $b
gmt $m $l2s --scale=5 >> $b
gmt $m $l2s --intensity=0.2 --intens=-0.8 >> $b
gmt $m $l2s --polygon+bounds+xanchor:l+yanchor:b+pen:1p,blue >> $b
gmt $m $l2s --close+symdev+xanchor:r+yanchor:t >> $b
gmt $m $l2s --closed_polygon+asymdev+xanchor:6+yanchor:7 >> $b
gmt $m $l2s --noclip=clipnorepeat --no_clip=repeatnoclip >> $b
gmt $m $l2s --nosort --no_sort >> $b
gmt $m $l2s --pen=2p,red+color:l+offset:1p --pen=1p+spline >> $b
gmt $m $l2s --pen=2p+vector --pen=2p+zvalues >> $b
gmt $m $l2s --zvalue=99+transparency >> $b
gmt $m $l2s --level=/my/polygon/file.txt+twocols >> $b

diff $a $b --strip-trailing-cr > fail
38 changes: 38 additions & 0 deletions test/sample1d/sample1d-l2s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
#
# Test sample1d longopts translation.

m=sample1d
l2s='--l2stranstest'
a=$m-l2s-a.txt
b=$m-l2s-b.txt
rm -f $a $b ; touch $b

cat << EOF > $a
--l2stranstest -Af -Ap -Am
--l2stranstest -Ar+l -AR+d
--l2stranstest -Csomecpt+h2+uin+s/some/file
--l2stranstest -C+Uin+i5
--l2stranstest -E
--l2stranstest -Fl -Fe -Fa+d1
--l2stranstest -Fc -Fs -Fn
--l2stranstest -N1 -N2 -N3
--l2stranstest -T100/200/10+i -T10+n -T/some/file
--l2stranstest -T10/20/1+a+u
--l2stranstest -W1
EOF

# module-specific longopts
gmt $m $l2s --resample=keeporig --resample=pmfollow --resample=mpfollow >> $b
gmt $m $l2s --resample=equidistant+rhumb --resample=exactfit+delete >> $b
gmt $m $l2s --cpt=somecpt+hinge:2+fromunit:in+file:/some/file >> $b
gmt $m $l2s --cmap+tounit:in+zinc:5 >> $b
gmt $m $l2s --keeptext >> $b
gmt $m $l2s --interptype=linear --interp=step --interp=akima+derivative:1 >> $b
gmt $m $l2s --interptype=cubic --interptype=smooth --interptype=none >> $b
gmt $m $l2s --time_column=1 --time_col=2 --timecol=3 >> $b
gmt $m $l2s --inc=100/200/10+inverse --inc=10+numcoords --range=/some/file >> $b
gmt $m $l2s --inc=10/20/1+paste+unique >> $b
gmt $m $l2s --weights=1 >> $b

diff $a $b --strip-trailing-cr > fail
Loading

0 comments on commit a5c74a8

Please sign in to comment.