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

未关闭
#703 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
julia

调研方向

从 src/common_options.jl 和 src/psbasemap.jl 开始,以 gmtbegin()、gmtend() 和 basemap() 的示例及堆栈跟踪作为切入点。跟踪 classic 模式相对于 modern 模式如何提供隐式的 -J 和 -B 值,然后验证 modern 模式在各函数中收到等效的默认值,同时显式的投影和框架选项仍会覆盖这些默认值。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Julia
星标
223
派生
35
平均合并
8 小时 1 分钟
30 天内合并 PR
9

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

GenericMappingTools/GMT.jl 的其他 Issue

查看 GenericMappingTools/GMT.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。