Should we set -J and -B defaults in modern mode (after `gmtbegin`)?

Open
#703 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia

Research direction

Start with src/common_options.jl and src/psbasemap.jl, using the gmtbegin(), gmtend(), and basemap() example and stack trace as entry points. Trace how classic mode supplies implicit -J and -B values versus modern mode, then verify that modern mode receives equivalent defaults across functions while explicit projection and frame options still override them.

Written by the indexing model from the issue text.

Description

Currently, when using modern mode the defaults for projection (-J) and frame (-B) are not set, for example:

julia> basemap(region = :g, show = true)  # Works because it sets implicit defaults for -J and -B

julia> gmtbegin()

julia> basemap(region = :g)
basemap [ERROR]: Must specify at least one of -A, -B, -D, -L, -T
ERROR: Something went wrong when calling the module. GMT error number = 71
Stacktrace:
 [1] gmt(cmd::String, args::Nothing)
   @ GMT ~/.julia/packages/GMT/lcweZ/src/gmt_main.jl:283
 [2] finish_PS_module(d::Dict{Symbol, Any}, cmd::Vector{String}, opt_extra::String, K::Bool, O::Bool, finish::Bool, args::Nothing)
   @ GMT ~/.julia/packages/GMT/lcweZ/src/common_options.jl:3399
 [3] basemap(cmd0::String, arg1::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:region,), Tuple{Symbol}}})
   @ GMT ~/.julia/packages/GMT/lcweZ/src/psbasemap.jl:67
 [4] top-level scope
   @ REPL[43]:1

julia> gmtend()

julia> basemap(region = :g, Vd = 2)
"psbasemap  -Rg -JX14c/0 -Baf -BWSen -P -K > /tmp/GMTjl_tmp.ps"

julia> gmtbegin()

julia> basemap(region = :g, Vd = 2)
"basemap  -Rg"

julia> gmtend()

It happens with the other functions as well of course (not just basemap). I think the defaults that are set in classic mode are quite nice, so maybe it wouldn't hurt to use them in modern mode as well? I'm not sure anything is lost by doing this: if the user wants a different projection/frame, they can still override the defaults. Also, the behaviour becomes more consistent with classic mode.

I can have a go at a patch (probably not before the weekend) if you're short on time. Just thought I'd raise the point.

Cheers

Dominant language
Julia
Stars
222
Forks
35
Avg merge
8h 1m
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenericMappingTools/GMT.jl

All issues in GenericMappingTools/GMT.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.