Skip to content

Commit df85a81

Browse files
authored
Another bunch of modules receiving a recompiling protection entry function (#1903)
1 parent d935e92 commit df85a81

9 files changed

Lines changed: 69 additions & 47 deletions

File tree

src/GMT.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ using .Laszip
402402
grdsample(Glix, inc=0.5)
403403
grdtrend(Glix, model=3)
404404
grdtrack(Glix, [1 1])
405-
coast(R=:g, proj=:guess, W=(level=1, pen=(2, :green)))
405+
coast(R=:g, proj=:guess, W=(level=1, pen=(2, :green)), savefig=tempname()*".ps")
406406
#gridit(rand(10,3), preproc=true, I=0.1);
407407
#earthregions("PT", Vd=2);
408408
#violin(rand(50), fmt=:ps);

src/gmtreadwrite.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,16 @@ to read a jpg image with the bands reversed
8585
8686
I = gmtread("image.jpg", band=[2,1,0]);
8787
"""
88-
function gmtread(_fname::String; kwargs...)
88+
function gmtread(fname::String; kwargs...)
89+
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
90+
gmtread(fname, d)
91+
end
92+
function gmtread(fname::String, d::Dict{Symbol, Any})
8993

90-
endswith(_fname, ".xlsx") && return read_xls(_fname; kwargs...) # Excel extension
94+
endswith(fname, ".xlsx") && return read_xls(_fname; kwargs...) # Excel extension
9195

92-
fname::String = _fname # Because args signatures seam to worth shit in body.
93-
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
96+
#fname::String = _fname # Because args signatures seam to worth shit in body.
97+
#d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
9498
cmd::String, opt_R::String = parse_R(d, "")
9599
cmd, opt_i = parse_i(d, cmd)
96100
cmd, opt_h = parse_h(d, cmd)
@@ -194,7 +198,7 @@ function gmtread(_fname::String; kwargs...)
194198
elseif (opt_T == "obj") # Means we got a .obj file. Read it and leave
195199
return read_obj(fname)
196200
elseif (opt_T == "las") # Means we got a .laz or .las file. Read it and leave
197-
o_las = lazread(fname; kwargs...)
201+
o_las = lazread(fname; d...)
198202
return getproperty(o_las, Symbol(o_las.stored))
199203
end
200204
else

src/grd2kml.jl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,17 @@ Parameters
4949
5050
To see the full documentation type: ``@? grd2kml``
5151
"""
52-
function grd2kml(cmd0::String="", arg1=nothing; kwargs...)
53-
54-
arg2 = nothing; arg3 = nothing; # for CPT and/or illum
52+
grd2kml(cmd0::String; kwargs...) = grd2kml_helper(cmd0, nothing; kwargs...)
53+
grd2kml(arg1; kwargs...) = grd2kml_helper("", arg1; kwargs...)
54+
function grd2kml_helper(cmd0::String, arg1; kwargs...)
5555
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
56+
grd2kml_helper(cmd0, arg1, d)
57+
end
58+
59+
# ---------------------------------------------------------------------------------------------------
60+
function grd2kml_helper(cmd0::String, arg1, d::Dict{Symbol, Any})
5661

62+
arg2 = nothing; arg3 = nothing; # for CPT and/or illum
5763
cmd, = parse_common_opts(d, "", [:V_params :f :n])
5864
cmd = parse_these_opts(cmd, d, [[:A :mode], [:E :url], [:F :filter], [:H :subpixel :sub_pixel],
5965
[:L :tilesize :tile_size], [:N :prefix], [:Q :nan_t :nan_alpha], [:S :extra_layers :extralayers], [:T :title], [:W :contours]])
@@ -62,7 +68,4 @@ function grd2kml(cmd0::String="", arg1=nothing; kwargs...)
6268
cmd, N_used, arg1, arg2, = get_cpt_set_R(d, cmd0, cmd, " ", got_fname, arg1, arg2)
6369
cmd, arg1, arg2, arg3 = common_shade(d, cmd, arg1, arg2, arg3, nothing, "grd2kml")
6470
common_grd(d, "grd2kml " * cmd, arg1, arg2, arg3) # Finish build cmd and run it
65-
end
66-
67-
# ---------------------------------------------------------------------------------------------------
68-
grd2kml(arg1; kw...) = grd2kml("", arg1; kw...)
71+
end

src/grdclip.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ Clip the range of grid values. will set values < low to below and/or values > hi
55
You can also specify one or more intervals where all values should be set to ``between``,
66
or replace individual values.
77
8-
See full GMT docs at [`grdclip`]($(GMTdoc)grdclip.html)
9-
108
Parameters
119
----------
1210
@@ -50,11 +48,13 @@ Parameters
5048
"""
5149
grdclip(cmd0::String; kwargs...) = grdclip_helper(cmd0, nothing; kwargs...)
5250
grdclip(arg1; kwargs...) = grdclip_helper("", arg1; kwargs...)
53-
54-
# ---------------------------------------------------------------------------------------------------
5551
function grdclip_helper(cmd0::String, arg1; kwargs...)
56-
5752
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
53+
grdclip_helper(cmd0, arg1, d)
54+
end
55+
56+
# ---------------------------------------------------------------------------------------------------
57+
function grdclip_helper(cmd0::String, arg1, d::Dict{Symbol, Any})
5858

5959
cmd, = parse_common_opts(d, "", [:G :R :V_params])
6060
cmd = add_opt(d, cmd, "S", [:S])

src/grdcut.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@ To see the full documentation type: ``@? grdcut``
4343
grdcut(cmd0::String; kwargs...) = grdcut_helper(cmd0, nothing; kwargs...)
4444
grdcut(arg1; kwargs...) = grdcut_helper("", arg1; kwargs...)
4545
grdcut(; kwargs...) = grdcut_helper("", nothing; kwargs...) # To allow grdcut(data=..., ...)
46+
function grdcut_helper(cmd0::String, arg1; kwargs...)
47+
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
48+
grdcut_helper(cmd0, arg1, d)
49+
end
4650

4751
# ---------------------------------------------------------------------------------------------------
48-
function grdcut_helper(cmd0::String, arg1; kwargs...)::Union{Nothing, GMTgrid, GMTimage, String}
52+
function grdcut_helper(cmd0::String, arg1, d::Dict{Symbol, Any})::Union{Nothing, GMTgrid, GMTimage, String}
4953

5054
arg2 = nothing
51-
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
5255
cmd::String, opt_R::String = parse_R(d, "")
5356
cmd, = parse_common_opts(d, cmd, [:V_params :f])
5457
opt_J, = parse_J(d, "")

src/grdfilter.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Filter a grid file in the time domain using one of the selected convolution or non-convolution
55
isotropic or rectangular filters and compute distances using Cartesian or Spherical geometries.
66
7-
See full GMT docs at [`grdfilter`]($(GMTdoc)grdfilter.html)
8-
97
Parameters
108
----------
119
@@ -34,13 +32,15 @@ To see the full documentation type: ``@? grdfilter``
3432
"""
3533
grdfilter(cmd0::String; kwargs...) = grdfilter_helper(cmd0, nothing; kwargs...)
3634
grdfilter(arg1; kwargs...) = grdfilter_helper("", arg1; kwargs...)
35+
function grdfilter_helper(cmd0::String, arg1; kwargs...)
36+
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
37+
grdfilter_helper(cmd0, arg1, d)
38+
end
3739

3840
# ---------------------------------------------------------------------------------------------------
39-
function grdfilter_helper(cmd0::String, arg1; kwargs...)
41+
function grdfilter_helper(cmd0::String, arg1, d::Dict{Symbol, Any})
4042

41-
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
4243
cmd, = parse_common_opts(d, "", [:G :RIr :V_params :f])
4344
cmd = parse_these_opts(cmd, d, [[:D :distflag :distance], [:F :filter], [:N :nans], [:T :toggle]])
44-
4545
common_grd(d, cmd0, cmd, "grdfilter ", arg1) # Finish build cmd and run it
4646
end

src/grdimage.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,21 @@ Parameters
4040
4141
To see the full documentation type: ``@? grdimage``
4242
"""
43-
function grdimage(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; first=true, kwargs...)
43+
grdimage(arg1, arg2=nothing, arg3=nothing; kw...) = grdimage_helper("", arg1, arg2, arg3; first=true, kw...)
44+
grdimage(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; kw...) =
45+
grdimage_helper(cmd0, arg1, arg2, arg3; first=true, kw...)
46+
grdimage!(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; kw...) =
47+
grdimage_helper(cmd0, arg1, arg2, arg3; first=false, kw...)
48+
grdimage!(arg1, arg2=nothing, arg3=nothing; kw...) = grdimage_helper("", arg1, arg2, arg3; first=false, kw...)
49+
function grdimage_helper(cmd0::String, arg1=nothing, arg2=nothing, arg3=nothing; first=true, kwargs...)
4450
d, K, O = init_module(first, kwargs...) # Also checks if the user wants ONLY the HELP mode
4551
(cmd0 != "" && arg1 === nothing && haskey(d, :inset)) && (arg1 = gmtread(cmd0); cmd0 = "")
52+
grdimage_helper(cmd0, arg1, arg2, arg3, K, O, d)
53+
end
54+
55+
# ---------------------------------------------------------------------------------------------------
56+
#function grdimage(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; first=true, kwargs...)
57+
function grdimage_helper(cmd0::String, arg1, arg2, arg3, K::Bool, O::Bool, d::Dict{Symbol, Any})
4658

4759
common_insert_R!(d, O, cmd0, arg1) # Set -R in 'd' out of grid/images (with coords) if limits was not used
4860

@@ -74,6 +86,7 @@ function grdimage(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; fir
7486

7587
_grdimage(cmd0, arg1, arg2, arg3, O, K, d)
7688
end
89+
7790
function _grdimage(cmd0::String, arg1, arg2, arg3, O::Bool, K::Bool, d::Dict)
7891

7992
arg4 = nothing # For the r,g,b + intensity case
@@ -217,9 +230,3 @@ function common_shade(d::Dict, cmd::String, arg1, arg2, arg3, arg4, prog)
217230
return cmd, arg1, arg2, arg3, arg4
218231
end
219232

220-
# ---------------------------------------------------------------------------------------------------
221-
grdimage!(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; kw...) =
222-
grdimage(cmd0, arg1, arg2, arg3; first=false, kw...)
223-
224-
grdimage(arg1, arg2=nothing, arg3=nothing; kw...) = grdimage("", arg1, arg2, arg3; first=true, kw...)
225-
grdimage!(arg1, arg2=nothing, arg3=nothing; kw...) = grdimage("", arg1, arg2, arg3; first=false, kw...)

src/grdproject.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@ To see the full documentation type: ``@? grdproject``
4040
"""
4141
grdproject(cmd0::String; kwargs...) = grdproject_helper(cmd0, nothing; kwargs...)
4242
grdproject(arg1; kwargs...) = grdproject_helper("", arg1; kwargs...)
43+
function grdproject_helper(cmd0::String, arg1; kwargs...)
44+
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
45+
grdproject_helper(cmd0, arg1, d)
46+
end
4347

4448
# ---------------------------------------------------------------------------------------------------
45-
function grdproject_helper(cmd0::String, arg1; kwargs...)
49+
function grdproject_helper(cmd0::String, arg1, d::Dict{Symbol, Any})
4650

47-
d = init_module(false, kwargs...)[1] # Also checks if the user wants ONLY the HELP mode
4851
cmd::String = parse_n(d, "", true)[1] # Here we keep the GMT default to Antialiasing
4952
cmd = parse_common_opts(d, cmd, [:G :R :V_params :r])[1]
5053
if ((val = find_in_dict(d, [:J :proj :projection], false)[1]) !== nothing) # Here we don't want any default value

src/grdvector.jl

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ Takes two 2-D grid files which represents the x- and y-components of a vector fi
55
a vector field plot by drawing vectors with orientation and length according to the information
66
in the files. Alternatively, polar coordinate r, theta grids may be given instead.
77
8-
See full GMT docs at [`grdvector`]($(GMTdoc)grdvector.html)
9-
108
Parameters
119
----------
1210
@@ -55,9 +53,22 @@ Parameters
5553
5654
To see the full documentation type: ``@? grdvector``
5755
"""
58-
function grdvector(arg1, arg2; first=true, kwargs...)
56+
grdvector(arg1, arg2; kw...) = grdvector_helper(arg1, arg2; first=true, kw...)
57+
grdvector!(arg1, arg2; kw...) = grdvector_helper(arg1, arg2; first=false, kw...)
58+
grdvector(arg1::Matrix{<:Real}, arg2::Matrix{<:Real}; kw...) = grdvector_helper(mat2grid(arg1), mat2grid(arg2); kw...)
59+
grdvector!(arg1::Matrix{<:Real}, arg2::Matrix{<:Real}; kw...) = grdvector_helper(mat2grid(arg1), mat2grid(arg2); first=false, kw...)
60+
grdvector(arg1::Matrix{<:Real}, arg2::Matrix{<:Real}, arg3::Matrix{<:Real}, arg4::Matrix{<:Real}; kw...) =
61+
grdvector_helper(mat2grid(arg3, x=Float64.(arg1[1,:]), y=Float64.(arg2[:,1])), mat2grid(arg4, x=Float64.(arg1[1,:]), y=Float64.(arg2[:,1])); kw...)
62+
grdvector!(arg1::Matrix{<:Real}, arg2::Matrix{<:Real}, arg3::Matrix{<:Real}, arg4::Matrix{<:Real}; kw...) =
63+
grdvector_helper(mat2grid(arg3, x=Float64.(arg1[1,:]), y=Float64.(arg2[:,1])), mat2grid(arg4, x=Float64.(arg1[1,:]), y=Float64.(arg2[:,1])); first=false, kw...)
5964

65+
function grdvector_helper(arg1, arg2; first=true, kwargs...)
6066
d, K, O = init_module(first, kwargs...) # Also checks if the user wants ONLY the HELP mode
67+
grdvector_helper(arg1, arg2, K, O, d)
68+
end
69+
70+
# ---------------------------------------------------------------------------------------------------
71+
function grdvector_helper(arg1, arg2, K::Bool, O::Bool, d::Dict{Symbol, Any})
6172

6273
# Must call parse_R first to get opt_R that is needed in the get_grdinfo() call.
6374
cmd, opt_R = parse_R(d, "", O=O)
@@ -72,7 +83,7 @@ function grdvector(arg1, arg2; first=true, kwargs...)
7283
DEF_FIG_AXES_::String = (IamModern[]) ? "" : DEF_FIG_AXES[] # DEF_FIG_AXES is a global const
7384
cmd, opt_B = parse_B(d, cmd, (O ? "" : DEF_FIG_AXES_))
7485

75-
cmd = parse_common_opts(d, cmd, [:UVXY :f :p :t :margin :params]; first=first)[1]
86+
cmd = parse_common_opts(d, cmd, [:UVXY :f :p :t :margin :params]; first=!O)[1]
7687
!(contains(cmd, "-V")) && (cmd *= " -Ve") # Shut up annoying warnings if -S has no units
7788
cmd = parse_these_opts(cmd, d, [[:A :polar], [:N :noclip :no_clip], [:T :sign_scale], [:Z :azimuth]])
7889
opt_S = add_opt(d, "", "S", [:S :vscale :vec_scale],
@@ -181,14 +192,5 @@ end
181192
get_grdinfo(grd::String, opt_R::String) = gmt_grdinfo_C(opt_R * " " * grd).data
182193
get_grdinfo(grd::GMTgrid, opt_R::String)::Matrix{Float64} = gmt("grdinfo -C" * opt_R, grd).data
183194

184-
# ---------------------------------------------------------------------------------------------------
185-
grdvector!(arg1, arg2; kw...) = grdvector(arg1, arg2; first=false, kw...)
186-
grdvector(arg1::Matrix{<:Real}, arg2::Matrix{<:Real}; kw...) = grdvector(mat2grid(arg1), mat2grid(arg2); kw...)
187-
grdvector!(arg1::Matrix{<:Real}, arg2::Matrix{<:Real}; kw...) = grdvector(mat2grid(arg1), mat2grid(arg2); first=false, kw...)
188-
grdvector(arg1::Matrix{<:Real}, arg2::Matrix{<:Real}, arg3::Matrix{<:Real}, arg4::Matrix{<:Real}; kw...) =
189-
grdvector(mat2grid(arg3, x=Float64.(arg1[1,:]), y=Float64.(arg2[:,1])), mat2grid(arg4, x=Float64.(arg1[1,:]), y=Float64.(arg2[:,1])); kw...)
190-
grdvector!(arg1::Matrix{<:Real}, arg2::Matrix{<:Real}, arg3::Matrix{<:Real}, arg4::Matrix{<:Real}; kw...) =
191-
grdvector(mat2grid(arg3, x=Float64.(arg1[1,:]), y=Float64.(arg2[:,1])), mat2grid(arg4, x=Float64.(arg1[1,:]), y=Float64.(arg2[:,1])); first=false, kw...)
192-
193195
const quiver = grdvector # Aliases
194196
const quiver! = grdvector!

0 commit comments

Comments
 (0)