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
6 changes: 3 additions & 3 deletions src/GMT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ export
geodesic, orthodrome, proj2wkt, setcoords!, setfld!, setcrs!, setsrs!, settimecol!, vecangles, wkt2proj,
inbbox, randgeo,

colorzones!, rasterzones!, rasterzones, lelandshade, texture_img, crop, doy2date, date2doy, fourcolors, yeardecimal,
ISOtime2unix, median, mean, quantile, std, nanmean, nanstd, skipnan, zonal_statistics, zonal_stats,
autocor, autocor!, autocov, autocov!, conv, xcorr, xcov,
colorzones!, rasterzones!, rasterzones, lelandshade, texture_img, crop, doy2date, date2doy, choropleth, fourcolors,
getdcw, ISOtime2unix, median, mean, quantile, std, nanmean, nanstd, skipnan, zonal_statistics, zonal_stats,
autocor, autocor!, autocov, autocov!, conv, yeardecimal, xcorr, xcov,

add2PSfile, append2fig, isoutlier, linearfitxy, regiongeog, streamlines, peaks, polygonlevels, randinpolygon, polyfit, polyval,

Expand Down
8 changes: 3 additions & 5 deletions src/analemma.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ function _analemma(lon, lat, year, hour, cmap, lonlat::Bool, data::Bool, d)
D = mat2ds(ana)
data && (D.colnames = cnames; return D)

do_show = ((val = find_in_dict(d, [:show])[1]) === nothing) ? true : false # Default is to show
do_show, fmt, savefig = get_show_fmt_savefig(d, true) # Default is to show
C = makecpt(cmap=cmap, range=(1, n_days))
plot(D, marker="c", markersize="4p", cmap=C, zcolor=collect(1:n_days), colorbar=(xlabel="Day of year",),
xlabel= lonlat ? "Longitude" : "Azimuth", ylabel= lonlat ? "Latitude" : "Elevation",
title=@sprintf("Analemma %02d:00 lat=%.1f", floor(Int, hour), lat), show=do_show, d...)
title=@sprintf("Analemma %02d:00 lat=%.1f", floor(Int, hour), lat), fmt=fmt, savefig=savefig, show=do_show, d...)
end

# ---------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -138,9 +138,7 @@ function _sunsetrise(lon, lat, year::Int, TZ::Int, raise::Bool, both::Bool, data
yaxis_nt = (annot=15, annot_unit=:minute2, ticks=5, ticks_unit=:minute2, label=y_label)
par = (FORMAT_DATE_MAP="o", FORMAT_TIME_PRIMARY_MAP="abbreviated")

do_show = ((val = find_in_dict(d, [:show])[1]) === nothing) ? true : false # Default is to show
fmt::String = ((val = find_in_dict(d, [:fmt])[1]) !== nothing) ? arg2str(val)::String : FMT[]::String
savefig = ((val = find_in_dict(d, [:savefig :figname :name])[1]) !== nothing) ? arg2str(val)::String : nothing
do_show, fmt, savefig = get_show_fmt_savefig(d, true) # Default is to show
opt_R = ((val = find_in_dict(d, [:R :region :limits])[1]) !== nothing) ? val : "tightx"
both ? plotyy(Dsr, Dss, yaxis=yaxis_nt, title=title, conf=par, R=opt_R, lw=1; d...) :
plot(Dsun, xaxis=xaxis_nt, yaxis=yaxis_nt, title=title, lc="#0072BD", lw="1p", conf=par, R=opt_R; d...)
Expand Down
13 changes: 2 additions & 11 deletions src/choropleth.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export choropleth


"""
choropleth(D, ids, vals; attrib="CODE", cmap="turbo", outline=true, kw...)
choropleth(D, att=""; attrib="", cmap="turbo", outline=true, kw...)
Expand Down Expand Up @@ -143,14 +140,8 @@ function helper_plot_choropleth(D, ids, vals, attrib::String, cmap, outline, _zv
zvals = (isempty(_zvals)) ? polygonlevels(D, ids, vals, att=attrib) : _zvals
pen_ouline = isa(outline, Bool) ? "0" : outline
C = isa(cmap, GMTcpt) ? cmap : makecpt(T=(minimum(vals), maximum(vals)), C=string(cmap))
plot_outline = (outline != false)
(!plot_outline) && return plot(D; level=zvals, cmap=C, kw...)
d = KW(kw)
do_show, fmt, savefig = get_show_fmt_savefig(d, false)
plot(D; level=zvals, cmap=C)
#plot!(D; pen=pen_ouline, fmt=fmt, savefig=savefig, show=do_show, d...)
d[:fmt]=fmt; d[:savefig]=savefig; d[:show]=do_show; d[:pen]=pen_ouline
common_plot_xyz("", D, "plot", false, false, d)
return (outline != false) ? plot(D; level=zvals, cmap=C, plot=(data=D, pen=pen_ouline), kw...) :
plot(D; level=zvals, cmap=C, kw...)
end

# ------------------------------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions src/getdcw.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export getdcw

"""
getdcw(codes; states=false, file::StrSymb="") -> Vector{GMTdataset}

Expand Down
14 changes: 2 additions & 12 deletions src/gmtlogo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,8 @@ function logo(cmd0::String=""; first=true, kwargs...)
c,t,r2 = jlogo(r) # r2 is the diameter of the inner circle
if (!occursin("-R", cmd)) cmd = @sprintf("-R0/%f/0/%f ", 2r, 2r) * cmd end
if (!occursin("-J", cmd)) cmd = " -Jx1 " * cmd end
do_show = false
if (do_GMTjulia)
do_show = ((val = find_in_dict(d, [:show])[1]) !== nothing && val != 0) # Too soon
end
fmt::AbstractString = ""
if (do_GMTjulia)
# Too soon to set the format. Need to finish the PS first
((val = find_in_dict(d, [:fmt])[1]) !== nothing) && (fmt = arg2str(val))
savefig::AbstractString = ""
if ((val = find_in_dict(d, [:savefig :name :figname])[1]) !== nothing) # Also too early for savefig
savefig = val
end
if (do_GMTjulia) # Too soon to use the show, fmt, ...
do_show, fmt, savefig = get_show_fmt_savefig(d, true) # Default is to show
end
cmd = "psxy " * c * cmd
((_r = check_dbg_print_cmd(d, cmd)) !== nothing && startswith(_r, "psxy")) && return _r
Expand Down
4 changes: 2 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1761,9 +1761,9 @@ in the last plotting comand. Centralise those options fetching in this function.
"""
function get_show_fmt_savefig(d, show::Bool=false)
# 'show' carries the default of the caller for the show-or-not-show
do_show = ((val = find_in_dict(d, [:show])[1]) === nothing) ? show : !show
do_show::Bool = ((val = find_in_dict(d, [:show])[1]) === nothing) ? show : (val == 1)
fmt::String = ((val = find_in_dict(d, [:fmt])[1]) !== nothing) ? arg2str(val)::String : FMT[]::String
savefig = ((val = find_in_dict(d, [:savefig :figname :name])[1]) !== nothing) ? arg2str(val)::String : nothing
savefig::Union{String,Nothing} = ((val = find_in_dict(d, [:savefig :figname :name])[1]) !== nothing) ? arg2str(val)::String : nothing
return do_show, fmt, savefig
end

Expand Down
Loading