Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/GMT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const DEF_FIG_AXES = Ref{String}(DEF_FIG_AXES_BAK) # This one may be be changed
const DEF_FIG_AXES3 = Ref{String}(DEF_FIG_AXES3_BAK)# ""
const FIG_MARGIN = Ref{Int}(1) # Figure margin in points after convertion by 'psconvert'. Accessible 'margin' common option
const global CTRL = CTRLstruct(zeros(13), zeros(6), [true], [false],
[:arrows, :bubblechart, :basemap, :band, :clip, :coast, :colorbar, :grdcontour, :hband, :hlines, :inset, :logo, :lines, :grdvector, :plot, :plot3, :quiver, :scatter, :scatter3, :stairs, :text, :vlines, :vband], ["", "", ""], ["", "", "", " "], ["", ""], ["", ""], [false, true], [C_NULL], [Dict()])
[:arrows, :bubblechart, :basemap, :band, :clip, :coast, :colorbar, :grdcontour, :hband, :hlines, :inset, :logo, :lines, :grdvector, :plot, :plot3, :quiver, :scatter, :scatter3, :stairs, :text, :vlines, :vband], ["", "", ""], ["", "", "", " "], ["", ""], ["", ""], [false, true], [C_NULL], [Dict{Symbol,Any}()])
const pocket_call = Ref{Vector{Any}}(Any[nothing, nothing, nothing, nothing, nothing, nothing])# Extracted from CTRL to isolate type instability
const CTRLshapes = CTRLstruct2(true, true, "") # Used in sub-module Drawing
const prj4WGS84 = "+proj=longlat +datum=WGS84 +units=m +no_defs"# This is used in many places
Expand Down Expand Up @@ -387,7 +387,7 @@ using .Laszip
gmtwrite(t, [0.0 0; 1 1])
gmtread(t)
gmtread(TESTSDIR * "assets/burro_cenora.jpg")
coast(R=:g, proj=:guess, W=(level=1, pen=(2, :green)), savefig=tempname()*".ps")
#coast(R=:g, proj=:guess, W=(level=1, pen=(2, :green)), savefig=tempname()*".ps")
rm(t)
D = mat2ds(rand(3, 3), colnames=["Time", "b", "c"])
D.attrib = Dict("Timecol" => "1")
Expand Down
201 changes: 102 additions & 99 deletions src/common_options.jl

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/extras/mapsize2region.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ function mapsize2region(; proj="", scale="", clon=NaN, clat=NaN, width=0, height
@assert clon != NaN && clat != NaN "Center longitude and latitude must be specified"
@assert width > 0 && height > 0 "Width and height must be positive"
@assert contains(scale, ':') "Scale must be in the form of '1:xxxx'"
(!isa(proj, StrSymb)) && (proj = parse_J(Dict(:J => proj, :scale => scale), "")[1][4:end]; scale="") # scale is now in J
(bnds != "") && (bnds = parse_R(Dict(:R => bnds), "")[4:end]) # If bnds is not empty, parse it
(!isa(scale, StrSymb)) && (scale = parse_Scale(Dict(:S => scale), "")) # If scale is not a StrSymb, parse it
(!isa(proj, StrSymb)) && (proj = parse_J(Dict{Symbol,Any}(:J => proj, :scale => scale), "")[1][4:end]; scale="") # scale is now in J
(bnds != "") && (bnds = parse_R(Dict{Symbol,Any}(:R => bnds), "")[4:end]) # If bnds is not empty, parse it
(!isa(scale, StrSymb)) && (scale = parse_Scale(Dict{Symbol,Any}(:S => scale), "")) # If scale is not a StrSymb, parse it
(bnds == "" && proj == "m" || startswith(proj, "merc") || startswith(proj, "Merc")) && (bnds="-180/180/-85/85") # Default bounds for Mercator
opt_R, opt_J = mapsize2region(string(proj), scale, Float64(clon), Float64(clat), Float64(width), Float64(height), bnds)
(plot != 0) && coast(R=opt_R, J=opt_J, shore=true, show=true, Vd=1)
Expand Down
2 changes: 1 addition & 1 deletion src/extras/seismicity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function seismicity(; starttime::Union{DateTime, String}="", endtime::Union{Date
plot!(D[:,1:4]; ml="faint", S=opt_S, C=C, show=see, Vd=Vd, d...)
d = CTRL.pocket_d[1]
d[:show] = show
ms = (_size !== nothing) ? parse_opt_S(Dict(:size => _size), [3., 4, 5, 6, 7, 8, 9])[1] : [3., 4, 5, 6, 7, 8, 9] .* 0.02
ms = (_size !== nothing) ? parse_opt_S(Dict{Symbol,Any}(:size => _size), [3., 4, 5, 6, 7, 8, 9])[1] : [3., 4, 5, 6, 7, 8, 9] .* 0.02
st = (starttime != "") ? string(starttime) : string(Date(now() - Dates.Day(30)))
et = (endtime != "") ? string(endtime) : string(Date(now()))
legend && seislegend(; first=false, title="From "*st*" to "*et, cmap=C, mags=ms, pos="JBC+o0/1c+w12c/2.3c", d...)
Expand Down
2 changes: 1 addition & 1 deletion src/extras/weather.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function ecmwf(source::Symbol=:reanalysis; filename="", cb::Bool=false, dataset=
last = (region == "") ? "\n" : ",\n" # Having an extra comma at the end of the line is a json syntax error
params *= "\"download_format\": \"unarchived\"" * last
if (region != "") # The region is provided by parse_R() as a string like " -R58/6/55/9" (N/W/S/E)
optR = split(parse_R(Dict(:R => region), "")[1], '/')
optR = split(parse_R(Dict{Symbol,Any}(:R => region), "")[1], '/')
params *= "\"area\": [" * optR[1][4:end] * ", " * optR[4] * ", " * optR[2] * ", " * optR[3] * "]\n"
end
params = "{\"product_type\": [\"reanalysis\"],\n" * params * "}"
Expand Down
23 changes: 10 additions & 13 deletions src/gdal/gdal_tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -334,17 +334,19 @@ function gdalvectortranslate(indata, opts=String[]; dest="/vsimem/tmp", kwargs..
helper_run_GDAL_fun(gdalvectortranslate, indata, dest, opts, "", KW(kwargs))
end

function helper_run_GDAL_fun(f::Function, indata, dest::String, opts, method::String, d::Dict{Symbol, Any})::Union{GItype, GDtype, Gdal.AbstractDataset, Nothing}
function helper_run_GDAL_fun(f::Function, indata, dest::String, opts, method::String, d::Dict{Symbol, Any})
ressurectGDAL() # Another black-hole plug attempt.
opts = gdal_opts2vec(opts) # Guarantied to return a Vector{String}
#d = KW(kwargs)
opts_vs = gdal_opts2vec(opts) # Guarantied to return a Vector{String}
opts_vs, got_GMT_opts = GMT_opts_to_GDAL(f, opts, d)
_helper_run_GDAL_fun(f, indata, dest, opts_vs, method, got_GMT_opts, d)
d_fun = Dict{Symbol, Function}(:fun => f) # To avoid fck compilation for each different fuction
_helper_run_GDAL_fun(d_fun, indata, dest, opts_vs, method, got_GMT_opts, d)
end

# ---------------------------------------------------------------------------------------------------
function _helper_run_GDAL_fun(f::Function, indata, dest::String, opts::Union{String, Vector{String}}, method, got_GMT_opts::Bool, d::Dict{Symbol, Any})::Union{GItype, GDtype, Gdal.AbstractDataset, Nothing}
# This second level helper function reduces the number of multiple compiles. Here, only 'indata' may have different types.
function _helper_run_GDAL_fun(d_fun::Dict{Symbol, Function}, @nospecialize(indata), dest::String, opts::Vector{String}, method::String, got_GMT_opts::Bool, d::Dict{Symbol, Any})
# This second level helper function reduces the number of multiple compiles.
f = d_fun[:fun] # Get back the function name

Vd::Int = ((val = find_in_dict(d, [:Vd])[1]) !== nothing) ? val : 0 # More gymns to avoid Anys
(Vd > 0) && println(opts)
Expand Down Expand Up @@ -459,7 +461,6 @@ function GMT_opts_to_GDAL(f::Function, opts::Vector{String}, d::Dict{Symbol, Any
end
end
f == gdalgrid ? append!(opts, ["-txe", s[1], s[2], "-tye", s[3], s[4]]) : append!(opts, op)
#f == gdalgrid ? append!(opts, ["-txe", s[1], s[2], "-tye", s[3], s[4]]) : append!(opts, ["-projwin", split(opt_R[4:end], '/')[[1,4,2,3]]...]) # Ugly
end

x_srs = (f == gdaltranslate) ? "-a_srs" : "-t_srs" # But don't know if there are others that take -a_srs instead of -t_srs
Expand Down Expand Up @@ -527,7 +528,7 @@ function default_gdopts!(f::Function, ds, opts::Vector{String}, dest::String)
end

# ---------------------------------------------------------------------------------------------------
function get_gdaldataset(data, opts, isVec::Bool=false)::Tuple{Gdal.AbstractDataset, Bool}
function get_gdaldataset(data, opts::Vector{String}, isVec::Bool=false)::Tuple{Gdal.AbstractDataset, Bool}
# Get a GDAL dataset from either a file name, a GMT grid or image, or a dataset itself
# In case of a file name we must be careful and deal with possible "+b" band requests from GMT.
# isVec tells us if the filename 'data' is to be opened as a Vector or a Raster.
Expand All @@ -540,11 +541,7 @@ function get_gdaldataset(data, opts, isVec::Bool=false)::Tuple{Gdal.AbstractData
o = split(ext[ind[1]+2:end], ",") # But we must add 1 because GDAL band count is 1-based and GMT 0-based
p = parse.(Int, o) .+ 1
o = [string(c) for c in p]
if (isa(opts, Vector{String}))
for k = 1:lastindex(o) append!(opts, ["-b", o[k]]) end
else
opts *= " -b" * join(o, " -b ")
end
for k = 1:lastindex(o) append!(opts, ["-b", o[k]]) end
end
flags = isVec ? GDAL_OF_VECTOR | GDAL_OF_VERBOSE_ERROR : GDAL_OF_READONLY | GDAL_OF_VERBOSE_ERROR
_ext = lowercase(ext[2:end]) # Drop the leading dot too
Expand Down Expand Up @@ -578,7 +575,7 @@ Convert a 24bit RGB image to 8bit paletted.
"""
function dither(indata, opts=String[]; n_colors::Integer=256, save::String="", gdataset::Bool=false)
# ...
src_ds, needclose = get_gdaldataset(indata, "", false)
src_ds, needclose = get_gdaldataset(indata, String[], false)
(nraster(src_ds) < 3) && error("Input image must have at least 3 bands")
(isa(indata, GMTimage) && !startswith(indata.layout, "TRB")) &&
error("Image memory layout must be `TRB` and not $(indata.layout). Load image with gdaltranslate()")
Expand Down
3 changes: 2 additions & 1 deletion src/gdal_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ Write a MxNxP `cube` object to disk as a multilayered file.
"""
function gdalwrite(fname::AbstractString, data, optsP=String[]; opts=String[], kw...)
(fname == "") && error("Output file name is missing.")
(isempty(optsP) && !isempty(opts)) && (optsP = opts) # Accept either Positional or KW argument
(isempty(optsP) && !isempty(opts)) && (optsP = opts) # Accept either Positional or KW argument
isa(optsP, AbstractString) && (optsP = gdal_opts2vec(optsP)) # Guarantied to return a Vector{String}
ds = Gdal.get_gdaldataset(data, optsP)[1]
if (Gdal.GDALGetRasterCount(ds.ptr) >= 1)
gdaltranslate(ds, optsP; dest=fname, kw...)
Expand Down
13 changes: 8 additions & 5 deletions src/gmt_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,20 @@ end
mutable struct wrapGrids
fname::String
grd::GMTgrid
img::GMTimage
function wrapGrids(arg1, arg2)
if (arg1 !== "") new(arg1, GMTgrid())
elseif (isa(arg2, GMTgrid)) new("", arg2)
elseif (isa(arg2, Matrix{<:Real})) new("", mat2grid(arg2))
elseif (arg1 === "" && arg2 === nothing) new("", GMTgrid()) # Less usual case in grdlandmask where only kwargs are given
tg, ti = GMTgrid(), GMTimage()
if (arg1 !== "") new(arg1, tg, ti)
elseif (isa(arg2, GMTgrid)) new("", arg2, ti)
elseif (isa(arg2, GMTimage)) new("", tg, arg2)
elseif (isa(arg2, Matrix{<:Real})) new("", mat2grid(arg2), ti)
elseif (arg1 === "" && arg2 === nothing) new("", tg, ti) # Less usual case in grdlandmask where only kwargs are given
else error("Unknown types ($(typeof(arg1)), $(typeof(arg2))) in wrapGrids")
end
end
end
function unwrapGrids(w::wrapGrids)
return w.fname, !isempty(w.grd) ? w.grd : nothing
return w.fname, !isempty(w.grd) ? w.grd : !isempty(w.img) ? w.img : nothing
end

#=
Expand Down
13 changes: 8 additions & 5 deletions src/grdimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ grdimage!(arg1, arg2=nothing, arg3=nothing; kw...) = grdimage_helper("", arg1, a
function grdimage_helper(cmd0::String, arg1=nothing, arg2=nothing, arg3=nothing; first=true, kwargs...)
d, K, O = init_module(first, kwargs...) # Also checks if the user wants ONLY the HELP mode
(cmd0 != "" && arg1 === nothing && haskey(d, :inset)) && (arg1 = gmtread(cmd0); cmd0 = "")
grdimage_helper(cmd0, arg1, arg2, arg3, K, O, d)
(isa(arg1, Matrix{<:Real}) && isa(arg2, Matrix{<:Real}) && isa(arg3, Matrix{<:Real})) &&
(arg2 = mat2grid(arg2); arg3 = mat2grid(arg3)) # Because than wrapGrids will convert arg1 to GMTgrid and other two must type agree
grdimage_helper(wrapGrids(cmd0, arg1), arg2, arg3, K, O, d)
end

# ---------------------------------------------------------------------------------------------------
#function grdimage(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; first=true, kwargs...)
function grdimage_helper(cmd0::String, arg1, arg2, arg3, K::Bool, O::Bool, d::Dict{Symbol, Any})
function grdimage_helper(w::wrapGrids, arg2, arg3, K::Bool, O::Bool, d::Dict{Symbol, Any})
cmd0, arg1 = unwrapGrids(w)

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

Expand Down Expand Up @@ -84,10 +86,11 @@ function grdimage_helper(cmd0::String, arg1, arg2, arg3, K::Bool, O::Bool, d::Di
(haskey(d, :stretch) || haskey(d, :histo_bounds)) && delete!(d, [:histo_bounds, :stretch])
end

_grdimage(cmd0, arg1, arg2, arg3, O, K, d)
_grdimage(wrapGrids(cmd0, arg1), arg2, arg3, O, K, d)
end

function _grdimage(cmd0::String, arg1, arg2, arg3, O::Bool, K::Bool, d::Dict)
function _grdimage(w::wrapGrids, arg2, arg3, O::Bool, K::Bool, d::Dict{Symbol, Any})
cmd0, arg1 = unwrapGrids(w)

arg4 = nothing # For the r,g,b + intensity case

Expand Down
2 changes: 1 addition & 1 deletion src/imshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function imshow(arg1::GItype; kw...)
# This is a (poor) pach for a GMT bug that screws when plotting CPTs on the sides.
margin = "0"
if ((val = find_in_dict(d, [:colorbar], false)[1]) !== nothing)
tv = add_opt_module(Dict(:colorbar => val))
tv = add_opt_module(Dict{Symbol,Any}(:colorbar => val))
t2 = scan_opt(tv[1], "-D")
t2 = replace(t2, "JMR" => "JMC")
!contains(t2, "+o") && (t2 *= "+o$(_w/2 + 0.3)/0")
Expand Down
4 changes: 2 additions & 2 deletions src/marker_name.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Put this code in a separate file to permit access from future GMT_base module
function get_marker_name(d::Dict, arg1, symbs::Vector{Symbol}, is3D::Bool, del::Bool=true)
function get_marker_name(d::Dict, @nospecialize(arg1), symbs::Vector{Symbol}, is3D::Bool, del::Bool=true)
marca::String = ""; N = 0
for symb in symbs
if (haskey(d, symb))
Expand Down Expand Up @@ -118,7 +118,7 @@ function helper_markers(opt::String, ext, arg1::GMTdataset, N::Int, cst::Bool)
if (size(ext,2) == N) # Here ARG1 is supposed to be a matrix that will be extended.
S = Symbol(opt)
t = arg1.data # Because we need to passa matrix to this method of add_opt()
marca, t = add_opt(add_opt, (Dict(S => (par=ext,)), opt, "", [S]), (par="|",), true, t)
marca, t = add_opt(add_opt, (Dict{Symbol,Any}(S => (par=ext,)), opt, "", [S]), (par="|",), true, t)
arg1.data = t; add2ds!(arg1)
elseif (cst && length(ext) == 1)
marca = opt * "-" * string(ext)::String
Expand Down
2 changes: 1 addition & 1 deletion src/pcolor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function pcolor(G::GMTgrid, first::Bool, d::Dict{Symbol,Any})
if (find_in_dict(d, [:T :no_interp :tiles])[1] === nothing) # If no -T, make one here
opt_T = "+s"
if ((val = find_in_dict(d, [:outline])[1]) !== nothing) # -T+o is bugged for line styles
opt_T *= "+o" * add_opt_pen(Dict(:outline => val), [:outline])
opt_T *= "+o" * add_opt_pen(Dict{Symbol,Any}(:outline => val), [:outline])
end
d[:T] = opt_T
end
Expand Down
4 changes: 2 additions & 2 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,8 @@ function fill_between(arg1, arg2, first::Bool, d::Dict{Symbol, Any})
_D2 = one_array ? mat2ds(D1, (:,[1,3])) : D2 # Put second line in a unique var

if (border > 0) # Plot a white border
one_array ? common_plot_xyz("", [mat2ds(D1, (:,[1,2])), _D2], "lines", false, false, Dict(:W => "$(border),white", :Vd => Vd)) :
common_plot_xyz("", [D1, _D2], "lines", false, false, Dict(:W => "$(border),white", :Vd => Vd))
one_array ? common_plot_xyz("", [mat2ds(D1, (:,[1,2])), _D2], "lines", false, false, Dict{Symbol,Any}(:W => "$(border),white", :Vd => Vd)) :
common_plot_xyz("", [D1, _D2], "lines", false, false, Dict{Symbol,Any}(:W => "$(border),white", :Vd => Vd))
end

do_stairs && (d[:stairs_step] = :pre)
Expand Down
4 changes: 2 additions & 2 deletions src/potential/gmtgravmag3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ function _gravmag3d_helper(arg1, d::Dict{Symbol,Any})
elseif ((val = find_in_dict(d, [:Ts :stl :STL], true, "String (file name)")[1]) !== nothing && val != "") opt = " -Ts"
elseif ((val = find_in_dict(d, [:M :body], false, "String | NamedTuple")[1]) !== nothing && val != "")
if (isa(val, Tuple))
cmd = add_opt(Dict(:body => val[1]), cmd, "M", [:M :body], (shape="+s", params=","))
cmd = add_opt(Dict{Symbol,Any}(:body => val[1]), cmd, "M", [:M :body], (shape="+s", params=","))
for n = 2:numel(val)
cmd = add_opt(Dict(:body => val[n]), cmd, "", [:M :body], (shape="+s", params=","))
cmd = add_opt(Dict{Symbol,Any}(:body => val[n]), cmd, "", [:M :body], (shape="+s", params=","))
end
delete!(d, [:M :body])
else
Expand Down
4 changes: 2 additions & 2 deletions src/pscoast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function parse_dcw(cmd::String, val::Tuple)::String
for k = 1:numel(val)
if (isa(val[k], NamedTuple) || isa(val[k], Dict))
isa(val[k], AbstractDict) && (val[k] = Base.invokelatest(dict2nt, val[k]))
cmd *= add_opt(Dict(:DCW => val[k]), "", "E", [:DCW], (country="", name="", continent="=", pen=("+p", add_opt_pen),
cmd *= add_opt(Dict{Symbol,Any}(:DCW => val[k]), "", "E", [:DCW], (country="", name="", continent="=", pen=("+p", add_opt_pen),
fill=("+g", add_opt_fill), file=("+f"), inside=("_+c"), outside=("_+C"), adjust_r=("+r", arg2str), adjust_R=("+R", arg2str), adjust_e=("+e", arg2str), headers=("_+z")))
elseif (isa(val[k], Tuple))
cmd *= parse_dcw(val[k])
Expand All @@ -284,7 +284,7 @@ function parse_dcw(val::Tuple)::String
else t *= string(val[2])
end
if (length(val) > 2)
if (isa(val[3], Tuple)) t *= add_opt_fill("+g", Dict(fill => val[3]), [:fill])
if (isa(val[3], Tuple)) t *= add_opt_fill("+g", Dict{Symbol,Any}(fill => val[3]), [:fill])
else t *= string(val[3])
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/pslegend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function legend(cmd0::String, arg1, O::Bool, K::Bool, d::Dict{Symbol, Any})
# Must also recreate a NT if any of 'fontsize' or 'font' is present in 'd' (because of how digests_legend_bag works)
((val = find_in_dict(d, [:fontsize])[1]) !== nothing) && (d[:leg] = (fontsize=val,))
((val = find_in_dict(d, [:font])[1]) !== nothing) && (haskey(d, :leg) ? d[:leg] = (fontsize=d[:leg], font=val) : d[:leg] = (font=val,))
((val = find_in_dict(d, [:pos :position])[1]) !== nothing) && (LEGEND_TYPE[].optsDict = Dict(:pos => val))
((val = find_in_dict(d, [:pos :position])[1]) !== nothing) && (LEGEND_TYPE[].optsDict = Dict{Symbol,Any}(:pos => val))

digests_legend_bag(d) # It's over now, lets show up (or not) and return
return (do_show || figname != "") ? showfig(show=do_show, savefig=figname) : nothing
Expand Down
2 changes: 1 addition & 1 deletion src/subplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function mura_arg(arg)::Dict
if (isa(arg, Tuple{Tuple, Real})) arg = (arg[1], (arg[2],)) end # This looks terribly type instable
# Need first case because for example dims=(panels=((2,4),(2.5,5,1.25)),) shows up here only as
# arg = ((2, 4), (2.5, 5, 1.25)) because this function was called from within add_opt()
if (isa(arg, Tuple{Tuple, Tuple})) d = Dict(:panels => arg)
if (isa(arg, Tuple{Tuple, Tuple})) d = Dict{Symbol,Any}(:panels => arg)
else d = (isa(arg, NamedTuple)) ? nt2dict(arg) : arg
end
d
Expand Down
4 changes: 2 additions & 2 deletions src/trend1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ function trend1d(cmd0::String, arg1, d::Dict{Symbol, Any})
# can only be used once and in the last NT element. Hence, we must split execution in two parts.
opt_N = " -N"
for k = 1:length(val)-1
t = add_opt(Dict(:N => val[k]), "", "N", [:N],
t = add_opt(Dict{Symbol,Any}(:N => val[k]), "", "N", [:N],
(polynome=("p", arg2str, 1), polynomal=("p", arg2str, 1), fourier=("f", arg2str, 1), cosine=("c", arg2str, 1), sine=("s", arg2str, 1), single="_!"))
contains(t, "!") && (t = replace(t, "!" => ""); t = replace(t, t[4] => uppercase(t[4])))
opt_N *= t[4:end] * ","
end
t = add_opt(Dict(:N => val[end]), "", "N", [:N],
t = add_opt(Dict{Symbol,Any}(:N => val[end]), "", "N", [:N],
(polynome=("p", arg2str, 1), polynomal=("p", arg2str, 1), fourier=("f", arg2str, 1), cosine=("c", arg2str, 1), sine=("s", arg2str, 1), length="+l", origin="+o", robust="+r", single="_!"))
contains(t, "!") && (t = replace(t, "!" => ""); t = replace(t, t[4] => uppercase(t[4])))
opt_N *= t[4:end]
Expand Down
Loading
Loading