Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adigitoleo opened this issue Sep 22, 2021 · 4 comments
Open

Comments

@adigitoleo
Copy link

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

@adigitoleo
Copy link
Author

Related to #667 , the new frame = :auto option works in modern mode and can be used as a workaround ono current master:

julia> gmtbegin("mapdraft.pdf")

julia> basemap(region = :g, frame = :auto)

julia> gmtend(show = true)

@joa-quim
Copy link
Member

joa-quim commented Sep 22, 2021

This is an easy one. Yes you are right, it should have the same defaults. I confess that I rarely use the modern mode so these type of issues go unnoticed. If you want to give it a try, please go ahead. I'll classes start shortly (start delayed still because of the covid) and need to keep working in the new RemoteS package. Also because of this, addressing your other -B issues will take longer to address.

@adigitoleo
Copy link
Author

No worries, thanks for all the guidance so far! Hopefully you don't have to do classes online like they are here in Australia...

@joa-quim
Copy link
Member

We had quite a big share of online classes but for now they will be insitu again.

adigitoleo added a commit to adigitoleo/GMT.jl that referenced this issue Sep 28, 2021
Removes some special casing of modern mode in parsee_B and parse_BJR.
This does not allow J option defaults for modern mode yet.
Also, this breaks some subplot code, e.g. example 2 in
https://www.generic-mapping-tools.org/GMT.jl/dev/subplot/#Examples.

Issue GenericMappingTools#703
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants