-
Notifications
You must be signed in to change notification settings - Fork 382
Discussion: Improve -B for GMT 6 via long-format options #254
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
Comments
I surely like this and I think it will really help the command line users. But I don't see how it can be of use for external interfaces. The fact that longoptions start with Sure that, at least in Julia, even without any further changes, it will be possible to say On the other hand
|
Thanks. However, I did not imagine the external interfaces using --. My thought was that they would supply keyword/arguments, e.g., 'frame=WSne+fill=red' or (..., frame, 'WSne+fill=red', ...) and then your parser would add the leading -- when passing the command string to GMT. You would not have to reassemble all these pieces into a valid -B option as they would be done in the C API. As for the very long --secondary-annotations, etc. Well, to be discussed. One purpose of having long arguments is to make it very clear what they are. This one does, of course, but axis2 requires more documentation. Anyway, perhaps we can have aliases like annotations2 that is the same as secondary-annotations (and --primary-annotations is the same as annotations), for instance. |
Well, the point for me is that I already wrote a parser that does all that (and more, like allow specifying the axis separately, does not use any + sub-options because they can the their own keyword (this allows expanding pen, etc)). I was think in proposing to use strncp() in the parser so both |
Sure, part of the complication is that the GMT team did not have this discussion before the external interface work started. I still think it is a good goal to standardize on a set of keywords and to put as much of any long-format parsing into GMT API as possible. However, I am not sure if it makes sense to decouple modifier arguments into separate options since there will be collisions between two or more pens or colors on the same command line. It would surely complicate the parser to know what module is needing what. |
Yes, sure that have a standardized name for the keywords is a good thing, but it's more complicated to standardize the rest. For example, in Julia I can (do) have
which is only the argument to |
The complicated -B option has been with us since GMT 1. In GMT 5 we broke it up into several -B options that set different aspects of basemap specifications. However, it remains a very busy and unclear option. Let us see what needs to be set when a basemap is required in GMT:
1. The Canvas/Frame
2. Axes
Each of the axes we selected have many sub-settings. Furthermore, there are potentially two separate annotation/tick/gridline systems per axis: p - primary (Default, closest to axis) and s - secondary (farther from axis). Each system has many settings:
3. Intervals
Draft proposal for discussion:
Introduce additional long-format --option=* options to clarify how to give basemap specifics. They do not replace -B but can be used instead of -B. Like the other long-format options (#230) they will be available to both classic and modern mode.
The first set apply to the primary (or only) axes system:
The second set apply to the secondary axes system:
There is only one label per axis but the E, N, U axes could have an "other" label:
The labels are given their own long option per axis to avoid difficulties in parsing free-form text separated by slashes (which could be part of the text); this is also why --title is a separate option.
The defaults are the same as before but needs a trigger --frame=default (like -Baf is needed today):
--frame=<MAP_FRAME_AXES>
--annotations=auto
--ticks=auto
--gridlines=none
There is some duplications here: --frame=none is the same as --annotations=none --ticks=none
A few simple examples:
would become
Pre-parsing of these long-format options in gmt_init_module will result in a series of corresponding short -B options that the standard GMT parser can handle.
Note that external interfaces may break these down further (e.g., 'x-annotations', [1 3 15 19]) but can then concatenate these separate axis settings to the required --annotations=argument format.
Please give feedback on the chosen long-options and suggest improvements. The goal is to converge on the right set of long-format options and house the parsing of these in the C API and thus relieve the external interfaces from doing tedious parsing when preparing calls to GMT via GMT_Call_Module.
The text was updated successfully, but these errors were encountered: