Skip to content

Commit

Permalink
Let data processors default to gridline reg for unspecified remote grids
Browse files Browse the repository at this point in the history
If users select a remote data set without specifying the registration then grid-processing modules shall select gridline registration while plot producers shall (continue to) select pixel registration.  This is to avoid issues such as #6678.
  • Loading branch information
PaulWessel committed May 11, 2022
1 parent 3aaff73 commit b55dcb5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gmt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -14170,7 +14170,7 @@ GMT_LOCAL bool gmtinit_is_PS_module (struct GMTAPI_CTRL *API, const char *name,
else if (!strncmp (name, "pscontour", 9U)) { /* Check for -D option */
if ((opt = GMT_Find_Option (API, 'D', options))) return false; /* -D writes dataset */
}
else if (!strncmp (name, "psevents", 8U)) { /* Check for -D option */
else if (!strncmp (name, "psevents", 8U)) { /* Check for -A option */
if ((opt = GMT_Find_Option (API, 'A', options)) == NULL) return true; /* All but -A is guaranteed to write PS */
if (opt->arg[0] == 'r' && opt->arg[1] && isdigit (opt->arg[1])) return false; /* This is just preparing an densely sampled file */
return true; /* Any other case gets here and makes PS */
Expand Down Expand Up @@ -15065,10 +15065,12 @@ struct GMT_CTRL *gmt_init_module (struct GMTAPI_CTRL *API, const char *lib_name,
gmt_M_unused(this_module_kw);
#endif

is_PS = gmtinit_is_PS_module (API, mod_name, keys, options); /* true if module will produce PS */

/* First handle any half-hearted naming of remote datasets where _g or _p should be appended */

if (options) {
if (!strcmp (mod_name, "grdtrack")) API->use_gridline_registration = true; /* Override API default since grdtrack is a data processor */
if (!is_PS) API->use_gridline_registration = true; /* Override API default since module is a data processor */
for (opt = *options; opt; opt = opt->next) { /* Loop over all options */
if (!gmtinit_might_be_remotefile (opt->arg)) continue;
if (remote_first) {
Expand Down Expand Up @@ -15184,7 +15186,6 @@ struct GMT_CTRL *gmt_init_module (struct GMTAPI_CTRL *API, const char *lib_name,
}
}

is_PS = gmtinit_is_PS_module (API, mod_name, keys, options); /* true if module will produce PS */
if (is_PS) {
if (gmtinit_set_modern_mode_if_oneliner (API, options)) /* Look out for modern -png mymap and similar specs */
return NULL;
Expand Down

0 comments on commit b55dcb5

Please sign in to comment.