Skip to content

Commit fe35a45

Browse files
authored
Work on still remaining usage of kwargs in several mat2??? functions. (#1945)
1 parent 7f7613c commit fe35a45

2 files changed

Lines changed: 61 additions & 44 deletions

File tree

src/GMT.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ using .Laszip
388388
gmtwrite(t, [0.0 0; 1 1])
389389
gmtread(t)
390390
gmtread(TESTSDIR * "assets/burro_cenora.jpg")
391-
#coast(R=:g, proj=:guess, W=(level=1, pen=(2, :green)), savefig=tempname()*".ps")
391+
coast(R=:g, proj=:guess, W=(level=1, pen=(2, :green)), savefig=tempname()*".ps")
392392
rm(t)
393393
D = mat2ds(rand(3, 3), colnames=["Time", "b", "c"])
394394
D.attrib = Dict("Timecol" => "1")

src/utils_types.jl

Lines changed: 60 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,21 @@ mat2ds(mat::GDtype) = mat # Method to simplify life and let call mat2ds on a a
8484
mat2ds(text::Union{AbstractString, Vector{<:AbstractString}}) = text_record(text) # Now we can hide text_record
8585
mat2ds(text::Vector{String}; hdr::String="", kw...) = text_record(fill(NaN,length(text),2), text, [hdr]) # The kw... is only to not error
8686

87-
function mat2ds(mat::AbstractMatrix{T}; hdr=String[], geom=0, kwargs...) where {T<:Real}
87+
function mat2ds(mat::AbstractMatrix{T}; hdr=String[], geom=0, kw...) where {T<:Real}
88+
_mat2ds_dt(mat, isa(hdr, String) ? [hdr] : vec(hdr), Int(geom), KW(kw))
89+
end
90+
function _mat2ds_dt(@nospecialize(mat), hdr::Vector{String}, geom::Int, d::Dict{Symbol,Any})
8891
# Here we are expecting that Any-ness results from columns with DateTime. If not returm 'mat' as is
89-
# DateTime columns are converted to seconds and a regular GMTdatset with appropriate column names and attribs is return
92+
# DateTime columns are converted to seconds and a regular GMTdatset with appropriate column names and attribs is return
9093
c = zeros(Bool, size(mat, 2))
9194
for k = 1:size(mat,2)
9295
if (typeof(mat[1,k]) == DateTime)
9396
mat[:,k] = Dates.value.(mat[:,k]) ./ 1000;
9497
c[k] = true
9598
end
9699
end
97-
#!any(c) && return mat # Oops, no DateTime? Ok, go to your life and probably blow somewhere.
98100

99-
D::GMTdataset = mat2ds(convert(Matrix{Float64}, mat); hdr=hdr, geom=geom, kwargs...)
101+
D::GMTdataset = _mat2ds(convert(Matrix{Float64}, mat), String[], hdr, geom, d)
100102
ind = findall(c)
101103
if (!isempty(ind))
102104
Tc = ""
@@ -139,8 +141,7 @@ In the former case (Vector{Vector}) the length of each Vector[i] must equal to t
139141
D = mat2ds([rand(6,3), rand(4,3), rand(3,3)], fill=[[:red], [:green], [:blue]], fillalpha=[0.5,0.7,0.8])
140142
"""
141143
function mat2ds(mat::Vector{<:AbstractMatrix}; hdr=String[], kwargs...)
142-
d = KW(kwargs)
143-
mat2ds(mat, hdr, d)
144+
mat2ds(mat, hdr, KW(kwargs))
144145
end
145146
function mat2ds(mat::Vector{<:AbstractMatrix{T}}, hdr::Vector{String}, d::Dict)::Vector{GMTdataset{T,2}} where {T<:Real}
146147
D = Vector{GMTdataset{eltype(mat[1]), 2}}(undef, length(mat))
@@ -205,8 +206,7 @@ mat2ds(mat::Array{T,N}, ref::GMTdataset) where {T<:Real,N} = mat2ds(mat; ref=ref
205206
# ---------------------------------------------------------------------------------------------------
206207
function mat2ds(mat::Array{T,N}, txt::Union{String,Vector{String}}=String[];
207208
hdr::Union{String,VecOrMat{String}}=String[], geom=0, kwargs...)::GDtype where {T<:Real,N}
208-
d = KW(kwargs)
209-
_mat2ds(mat, txt, isa(hdr, String) ? [hdr] : vec(hdr), Int(geom), d)
209+
_mat2ds(mat, txt, isa(hdr, String) ? [hdr] : vec(hdr), Int(geom), KW(kwargs))
210210
end
211211
function _mat2ds(@nospecialize(mat::Array{<:Real}), txt::Union{String,Vector{String}}, hdr::Vector{String}, geom::Int, d::Dict)::GDtype
212212

@@ -419,7 +419,7 @@ Cut a GMTdataset D with the indices in INDS but updating the colnames and the Ti
419419
INDS is a Tuple of 2 with ranges in rows and columns. Ex: (:, 1:3) or (:, [1,4,7]), etc...
420420
Attention, if original had attributes other than 'Timeinfo' there is no guarentie that they remain correct.
421421
"""
422-
function mat2ds(D::GMTdataset{T,N}, inds)::GMTdataset{T,N} where {T<:Real, N}
422+
function mat2ds(@nospecialize(D::GMTdataset), @nospecialize(inds))::GMTdataset
423423
(length(inds) != ndims(D)) && error("\tNumber of GMTdataset dimensions and indices components must be the same.\n")
424424
_coln = isempty(D.colnames) ? String[] : (inds[2] === Colon() || last(inds[2]) <= length(D.colnames) ? D.colnames[inds[2]] : String[])
425425
(!isempty(_coln) && (typeof(inds[1]) == Colon) && length(D.colnames) > size(D,2)) && append!(_coln, [D.colnames[end]]) # Append text colname if exists
@@ -1380,6 +1380,9 @@ end
13801380

13811381
# ---------------------------------------------------------------------------------------------------
13821382
function mat2img(mat::Union{AbstractMatrix{UInt16},AbstractArray{UInt16,3}}; x=Float64[], y=Float64[], v=Float64[], hdr=Float64[], proj4::String="", wkt::String="", img8::AbstractMatrix{UInt8}=Matrix{UInt8}(undef,0,0), kw...)
1383+
_mat2img_u16(mat, vec(Float64.(x)), vec(Float64.(y)), vec(Float64.(v)), vec(Float64.(hdr)), proj4, wkt, img8, KW(kw))
1384+
end
1385+
function _mat2img_u16(@nospecialize(mat), x::Vector{Float64}, y::Vector{Float64}, v::Vector{Float64}, hdr::Vector{Float64}, proj4::String, wkt::String, @nospecialize(img8), d::Dict{Symbol,Any})
13831386
# Take an array of UInt16 and scale it down to UInt8. Input can be 2D or 3D.
13841387
# If the kw variable 'stretch' is used, we stretch the intervals in 'stretch' to [0 255].
13851388
# Use this option to stretch the image histogram.
@@ -1390,11 +1393,8 @@ function mat2img(mat::Union{AbstractMatrix{UInt16},AbstractArray{UInt16,3}}; x=F
13901393
# The 'scale_only' kw option makes it return just the scaled array an no GMTimage creation (useful when img8 is a view).
13911394
# Use the keyword `noconv=true` to return GMTimage UInt16 type. I.e., no conversion to UInt8
13921395

1393-
d = KW(kw)
1394-
x::Vector{Float64} = vec(x); y::Vector{Float64} = vec(y); v::Vector{Float64} = vec(v);
1395-
hdr::Vector{Float64} = vec(hdr)
13961396
if ((is_in_dict(d, [:noconv])) !== nothing) # No conversion to UInt8 is wished
1397-
return mat2img16(mat; x=x, y=y, v=v, hdr=hdr, proj4=proj4, wkt=wkt, d...)
1397+
return helper_mat2img(mat, x, y, v, hdr, proj4, wkt, GMTcpt(), false, d)
13981398
end
13991399

14001400
img = isempty(img8) ? Array{UInt8, ndims(mat)}(undef, size(mat)) : img8
@@ -1442,14 +1442,17 @@ function mat2img(mat::Union{AbstractMatrix{UInt16},AbstractArray{UInt16,3}}; x=F
14421442
end
14431443
end
14441444
(haskey(d, :scale_only)) && return img # Only the scaled array is needed. Alows it to be a view
1445-
mat2img(img; x=x, y=y, v=v, hdr=hdr, proj4=proj4, wkt=wkt, d...)
1445+
helper_mat2img(img, x, y, v, hdr, proj4, wkt, GMTcpt(), false, d)
14461446
end
14471447

14481448
# ---------------------------------------------------------------------------------------------------
14491449
function mat2img(img::GMTimage; kw...)
1450+
_mat2img_gmtimg(img, KW(kw))
1451+
end
1452+
function _mat2img_gmtimg(img::GMTimage, d::Dict{Symbol,Any})
14501453
# Scale a UInt16 GMTimage to UInt8. Return a new object but with all old image parameters
14511454
(eltype(img.image) != UInt16) && return img # Nothing to do
1452-
I = mat2img(img.image; kw...)
1455+
I = _mat2img_u16(img.image, Float64[], Float64[], Float64[], Float64[], "", "", Matrix{UInt8}(undef,0,0), d)
14531456
I.proj4 = img.proj4; I.wkt = img.wkt; I.epsg = img.epsg
14541457
I.range = img.range; I.inc = img.inc; I.registration = img.registration
14551458
I.nodata = img.nodata; I.color_interp = img.color_interp;
@@ -1462,9 +1465,13 @@ end
14621465
# ---------------------------------------------------------------------------------------------------
14631466
function mat2img(mat::Union{GMTgrid,Matrix{<:AbstractFloat}}; x=Float64[], y=Float64[], hdr=Float64[],
14641467
proj4::String="", wkt::String="", GI::Union{GItype,Nothing}=nothing, clim=[0,255], cmap=GMTcpt(), kw...)
1468+
_mat2img_float(mat, vec(Float64.(x)), vec(Float64.(y)), vec(Float64.(hdr)), proj4, wkt, GI, clim, cmap, KW(kw))
1469+
end
1470+
function _mat2img_float(@nospecialize(mat), x::Vector{Float64}, y::Vector{Float64}, hdr::Vector{Float64},
1471+
proj4::String, wkt::String, @nospecialize(GI), @nospecialize(clim), @nospecialize(cmap), d::Dict{Symbol,Any})
14651472
# This is the same as Matlab's imagesc() ... plus some extras.
14661473

1467-
if (isa(mat, GMTgrid) && (opt_R::String = parse_R(KW(kw), "")[2]) != "")
1474+
if (isa(mat, GMTgrid) && (opt_R::String = parse_R(d, "")[2]) != "")
14681475
mat = grdcut(mat, R=opt_R[4:end]) # FORCES RECOMPILE plot()
14691476
end
14701477

@@ -1476,7 +1483,7 @@ function mat2img(mat::Union{GMTgrid,Matrix{<:AbstractFloat}}; x=Float64[], y=Flo
14761483
for k in CartesianIndices(t) isnan(t[k]) && (t[k] = 255f0) end
14771484
img = round.(UInt8, t)
14781485
else
1479-
img = isa(mat,GMTgrid) ? round.(UInt8, (mat.z .- mi) ./ (ma - mi) .* 255) : round.(UInt8, (mat .- mi) ./ (ma - mi) .* 255)
1486+
img = isa(mat,GMTgrid) ? round.(UInt8, (mat.z .- mi) ./ (ma - mi) .* 255) : round.(UInt8, (mat .- mi) ./ (ma - mi) .* 255)
14801487
end
14811488

14821489
(clim[1] >= clim[2]) && error("CLIM values are non-sense (min > max)")
@@ -1494,9 +1501,9 @@ function mat2img(mat::Union{GMTgrid,Matrix{<:AbstractFloat}}; x=Float64[], y=Flo
14941501
end
14951502
elseif (isa(mat, GMTgrid))
14961503
(isa(cmap, Symbol) || isa(cmap, String)) && (cmap = grd2cpt(mat, E=256, C=cmap))
1497-
I = mat2img(img; x=mat.x, y=mat.y, hdr=hdr, proj4=mat.proj4, wkt=mat.wkt, cmap=cmap, is_transposed=is_transp, kw...)
1504+
I = helper_mat2img(img, mat.x, mat.y, Float64[], hdr, mat.proj4, mat.wkt, cmap, is_transp, d)
14981505
else
1499-
I = mat2img(img; x=x, y=y, hdr=hdr, proj4=proj4, wkt=wkt, cmap=cmap, is_transposed=is_transp, kw...)
1506+
I = helper_mat2img(img, x, y, Float64[], hdr, proj4, wkt, cmap, is_transp, d)
15001507
end
15011508
isa(mat,GMTgrid) && (I.layout = mat.layout[1:3] * "a")
15021509
return I
@@ -2227,15 +2234,15 @@ end
22272234

22282235
# ---------------------------------------------------------------------------------------------------
22292236
"""
2230-
G = mat2grid(mat; reg=nothing, x=[], y=[], v=[], hdr=[], proj4::String="", wkt::String="",
2237+
G = mat2grid(mat; reg=0, x=[], y=[], v=[], hdr=[], proj4::String="", wkt::String="",
22312238
title::String="", rem::String="", cmd::String="", names::Vector{String}=String[],
22322239
scale::Float32=1f0, offset::Float32=0f0, eqc=false)
22332240
22342241
Take a 2/3D `mat` array and a HDR 1x9 [xmin, xmax, ymin, ymax, zmin, zmax, reg, xinc, yinc] header descriptor and
22352242
return a grid GMTgrid type. Alternatively to HDR, provide a pair of vectors, `x` & `y`, with the X and Y coordinates.
22362243
Optionally add a `v` vector with vertical coordinates if `mat` is a 3D array and one wants to create a ``cube``.
22372244
Optionally, the HDR arg may be omitted and it will computed from `mat` alone, but then x=1:ncol, y=1:nrow
2238-
When HDR is not used, REG == nothing [default] means create a gridline registration grid and REG = 1,
2245+
When HDR is not used, REG == 0 [default] means create a gridline registration grid and REG = 1,
22392246
or REG="pixel" a pixel registered grid.
22402247
22412248
- `eqc`: If true, it means we got a matrix representing a Equidistant Cylindrical projection but with no coords.
@@ -2260,7 +2267,7 @@ example, VAL = 1.0 Any other non Float64 will be converted to Float32
22602267
22612268
Example: mat2grid(1, hdr=[0. 5 0 5 1 1])
22622269
2263-
G = mat2grid(f::Function, x, y; reg=nothing, proj4::String="", wkt::String="", epsg::Int=0, title::String="", rem::String="")
2270+
G = mat2grid(f::Function, x, y; reg=0, proj4::String="", wkt::String="", epsg::Int=0, title::String="", rem::String="")
22642271
22652272
Where F is a function and X,Y the vectors coordinates defining it's domain. Creates a Float32 GMTgrid with
22662273
size determined by the sizes of the X & Y vectors.
@@ -2276,7 +2283,7 @@ creates a Float32 GMTgrid.
22762283
22772284
Example: G = mat2grid("sombrero")
22782285
"""
2279-
function mat2grid(val::Real=Float32(0); reg=nothing, hdr=Float64[], proj4::String="", proj::String="",
2286+
function mat2grid(val::Real=Float32(0); reg::Int=0, hdr=Float64[], proj4::String="", proj::String="",
22802287
wkt::String="", epsg::Int=0, geog::Int=-1, title::String="", tit::String="", rem::String="",
22812288
names::Vector{String}=String[], x_unit::String="", y_unit::String="", v_unit::String="",
22822289
z_unit::String="")
@@ -2285,7 +2292,7 @@ function mat2grid(val::Real=Float32(0); reg=nothing, hdr=Float64[], proj4::Strin
22852292
(eltype(hdr) != Float64) && (hdr = Float64.(hdr))
22862293
(!isa(val, AbstractFloat)) && (val = Float32(val)) # We only want floats here
22872294
if (length(hdr) == 6)
2288-
hdr = [hdr[1], hdr[2], hdr[3], hdr[4], val, val, reg === nothing ? 0. : 1., hdr[5], hdr[6]]
2295+
hdr = [hdr[1], hdr[2], hdr[3], hdr[4], val, val, Float64(reg), hdr[5], hdr[6]]
22892296
end
22902297
(isempty(proj4) && !isempty(proj)) && (proj4 = proj) # Allow both proj4 or proj keywords
22912298
(tit == "") && (tit = title) # Some versions from 1.2 remove 'tit'
@@ -2295,7 +2302,7 @@ end
22952302
# This is the way I found to find if a matrix is transposed. There must be better ways but couldn't find them.
22962303
istransposed(mat) = !isempty(fields(mat)) && (fields(mat)[1] == :parent)
22972304

2298-
function mat2grid(mat, xx=Float64[], yy=Float64[], zz=Float64[]; reg=nothing, hdr=Float64[], proj4::String="", proj::String="",
2305+
function mat2grid(mat, xx=Float64[], yy=Float64[], zz=Float64[]; reg::Int=0, hdr=Float64[], proj4::String="", proj::String="",
22992306
wkt::String="", epsg::Int=0, geog::Int=-1, title::String="", tit::String="", rem::String="",
23002307
cmd::String="", names::Vector{String}=String[], scale::Real=1f0, offset::Real=0f0, layout::String="",
23012308
is_transposed::Bool=false, x_unit::String="", y_unit::String="", v_unit::String="", z_unit::String="")
@@ -2308,36 +2315,46 @@ function mat2grid(mat, xx=Float64[], yy=Float64[], zz=Float64[]; reg=nothing, hd
23082315
x_unit=x_unit, y_unit=y_unit, v_unit=v_unit, z_unit=z_unit)
23092316
end
23102317

2311-
function mat2grid(mat::Array{T,N}; reg=nothing, x=Float64[], y=Float64[], v=Float64[], hdr=Float64[], proj4::String="", proj::String="",
2318+
function mat2grid(mat::Array{T,N}; reg=0, x=Float64[], y=Float64[], v=Float64[], hdr=Float64[], proj4::String="", proj::String="",
23122319
wkt::String="", epsg::Int=0, geog::Int=-1, title::String="", tit::String="", rem::String="", cmd::String="",
23132320
names::Vector{String}=String[], scale::Real=1f0, offset::Real=0f0, layout::String="", is_transposed::Bool=false,
23142321
x_unit::String="x", y_unit::String="y", v_unit::String="v", z_unit::String="z", eqc=false) where {T,N}
23152322

23162323
(isempty(proj4) && !isempty(proj)) && (proj4 = proj) # Allow both proj4 or proj keywords
2317-
if (!isempty(proj4) && !startswith(proj4, "+proj=") && !startswith(proj4, "proj="))
2318-
proj4 = "+proj=" * proj4 # NOW I SHOULD TEST THIS IS A VALID PROJ4 STRING. BUT HOW?
2319-
end
2320-
reg_ = 0
2321-
if (isa(reg, String) || isa(reg, Symbol))
2324+
_reg = 0
2325+
if (isa(reg, StrSymb))
23222326
t = lowercase(string(reg))
2323-
reg_ = (t != "pixel") ? 0 : 1
2327+
_reg = (t != "pixel") ? 0 : 1
23242328
elseif (isa(reg, Real))
2325-
reg_ = (reg == 0) ? 0 : 1
2329+
_reg = (reg == 0) ? 0 : 1
2330+
end
2331+
_mat2grid(mat, _reg, vec(Float64.(x)), vec(Float64.(y)), vec(Float64.(v)), vec(Float64.(hdr)),
2332+
proj4, wkt, epsg, geog, title, tit, rem, cmd, names, Float32(scale), Float32(offset), layout,
2333+
is_transposed, x_unit, y_unit, v_unit, z_unit, eqc != 0)
2334+
end
2335+
function _mat2grid(@nospecialize(mat), reg::Int, x::Vector{Float64}, y::Vector{Float64},
2336+
v::Vector{Float64}, hdr::Vector{Float64}, proj4::String, wkt::String, epsg::Int, geog::Int,
2337+
title::String, tit::String, rem::String, cmd::String, names::Vector{String}, scale::Float32,
2338+
offset::Float32, layout::String, is_transposed::Bool, x_unit::String, y_unit::String,
2339+
v_unit::String, z_unit::String, eqc::Bool)
2340+
2341+
if (!isempty(proj4) && !startswith(proj4, "+proj=") && !startswith(proj4, "proj="))
2342+
proj4 = "+proj=" * proj4 # NOW I SHOULD TEST THIS IS A VALID PROJ4 STRING. BUT HOW?
23262343
end
23272344

23282345
# Check case where we got a matrix representing a Equidistant Cylindrical projection but no coords
2329-
(eqc != 0 && (!isempty(x) || !isempty(hdr))) && @warn "eqc=true but x or hdr are not empty. Ignoring eqc=true"
2330-
if (eqc != 0 && isempty(x) && isempty(hdr))
2346+
(eqc && (!isempty(x) || !isempty(hdr))) && @warn "eqc=true but x or hdr are not empty. Ignoring eqc=true"
2347+
if (eqc && isempty(x) && isempty(hdr))
23312348
n_rows, n_cols, = size(mat)
23322349
# The default here is pixel registration when the matrix is of even size, or grid reg otherwise
2333-
(reg === nothing) && (iseven(n_rows) && iseven(n_cols) ? (reg_ = 1) : (reg_ = 0))
2334-
x_inc = 360.0 / (n_cols - (reg_ == 1)); y_inc = 180.0 / (n_rows - (reg_ == 1))
2350+
(reg == 0) && (iseven(n_rows) && iseven(n_cols) ? (reg = 1) : (reg = 0))
2351+
x_inc = 360.0 / (n_cols - (reg == 1)); y_inc = 180.0 / (n_rows - (reg == 1))
23352352
mima = extrema_nan(mat)
2336-
hdr = [-180.0, 180.0, -90.0, 90.0, mima[1], mima[2], reg_, x_inc, y_inc]
2353+
hdr = [-180.0, 180.0, -90.0, 90.0, mima[1], mima[2], reg, x_inc, y_inc]
23372354
geog = 1
23382355
(proj4 == "") && (proj4 = prj4WGS84)
23392356
end
2340-
x, y, hdr, x_inc, y_inc = grdimg_hdr_xy(mat, reg_, vec(Float64.(hdr)), vec(Float64.(x)), vec(Float64.(y)), is_transposed)
2357+
x, y, hdr, x_inc, y_inc = grdimg_hdr_xy(mat, reg, hdr, x, y, is_transposed)
23412358

23422359
# Now we still must check if the method with no input MAT was called. In that case mat = [nothing val]
23432360
# and the MAT must be finally computed.
@@ -2359,11 +2376,11 @@ function mat2grid(mat::Array{T,N}; reg=nothing, x=Float64[], y=Float64[], v=Floa
23592376
_layout = (layout == "") ? "BCB" : layout
23602377
(geog == -1 && helper_geod(proj4, wkt, epsg, false)[3]) && (geog = (range[2] <= 180) ? 1 : 2) # Signal if grid is geog.
23612378
(tit == "") && (tit = title) # Some versions from 1.2 remove 'tit'
2362-
GMTgrid(proj4, wkt, epsg, geog, range, inc, reg_, NaN, tit, rem, cmd, "", names, vec(x), vec(y), vec(v), isT ? copy(mat) : mat, x_unit, y_unit, v_unit, z_unit, _layout, scale, offset, 0, hasnans)
2379+
GMTgrid(proj4, wkt, epsg, geog, range, inc, reg, NaN, tit, rem, cmd, "", names, vec(x), vec(y), vec(v), isT ? copy(mat) : mat, x_unit, y_unit, v_unit, z_unit, _layout, scale, offset, 0, hasnans)
23632380
end
23642381

23652382
# This method creates a new GMTgrid but retains all the header data from the GI object
2366-
function mat2grid(mat::Array{T,N}, GI::GItype) where {T,N}
2383+
function mat2grid(mat::Array{T,N}, @nospecialize(GI::GItype)) where {T,N}
23672384
isT = istransposed(mat)
23682385
hasnans = any(!isfinite, mat) ? 2 : 1
23692386
x_unit, y_unit, v_unit, z_unit = isa(GI, GMTgrid) ? (GI.x_unit, GI.y_unit, GI.v_unit, GI.z_unit) : ("", "", "", "")
@@ -2373,10 +2390,10 @@ function mat2grid(mat::Array{T,N}, GI::GItype) where {T,N}
23732390
Go
23742391
end
23752392

2376-
mat2grid(f::Function, xx::AbstractVector{<:Float64}, yy::AbstractVector{<:Float64}; reg=nothing, proj4::String="", proj::String="", wkt::String="", epsg::Int=0, tit::String="", rem::String="") =
2393+
mat2grid(f::Function, xx::AbstractVector{<:Float64}, yy::AbstractVector{<:Float64}; reg::Int=0, proj4::String="", proj::String="", wkt::String="", epsg::Int=0, tit::String="", rem::String="") =
23772394
mat2grid(f; x=xx, y=yy, reg=reg, proj4=proj4, proj=proj, wkt=wkt, epsg=epsg, tit=tit, rem=rem)
23782395

2379-
function mat2grid(f::Function; reg=nothing, x::AbstractVector{<:Float64}=Float64[], y::AbstractVector{<:Float64}=Float64[], proj4::String="", proj::String="", wkt::String="", epsg::Int=0, tit::String="", rem::String="")
2396+
function mat2grid(f::Function; reg::Int=0, x::AbstractVector{<:Float64}=Float64[], y::AbstractVector{<:Float64}=Float64[], proj4::String="", proj::String="", wkt::String="", epsg::Int=0, tit::String="", rem::String="")
23802397
(isempty(x) || isempty(y)) && error("Must transmit the domain coordinates over which to calculate function.")
23812398
(isempty(proj4) && !isempty(proj)) && (proj4 = proj) # Allow both proj4 or proj keywords
23822399
z = Array{Float32,2}(undef, length(y), length(x))

0 commit comments

Comments
 (0)