You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While certainly not documented well, I believe -d only affects the z column, which is not used here. It originated in tools like xyz2grd and similar. Perhaps it will need a +ccol modifier... [2].
While certainly not documented well, I believe -d only affects the z column, which is not used here. It originated in tools like xyz2grd and similar. Perhaps it will need a +ccol modifier... [2].
Yes, a +ccol modifier seems helpful and the simplest solution.
A bit of looking reveals the following implementation truths.
On input, any column after the first two (x, y) may be affected by -di: if (col_no > 1 && gmt_input_is_nan_proxy (GMT, GMT->current.io.curr_rec[col_no])) /* Input matched no-data setting, so change to NaN */
On output, all columns that have a NaN will be changed by -do: if (GMT->common.d.active[GMT_OUT] && gmt_M_is_dnan (val)) val = GMT->common.d.nan_proxy[GMT_OUT]; /* Write this value instead of NaNs */
There is no trace of this being discussed in the docs, so we can choose to make this a feature or a bug :-).
I assume I skipped examining the x,y coordinates since those are unlikely to be flagged as -99999 as such a point would not be useful in a data set (x,y by itself could be useful as a station location even though the observation z is invalid). However, I did not think that through as many datasets are instead time or spatial series (t,y) in which case perhaps the 2nd column should be affected by -di) or simply a list of observations (e..g, the one-column input to histogram).
The fact that a NaN x or y can be replaced on output by the chosen -99999 or similar seems to suggest the limitation in input is a bit dumb.
Proposal: Since the unique value (e.g., -99999 or similar) is unique (there won't be another one like 9898989 for column 4, for instance), I think it makes sense to apply this to all columns both on input and output. We would then declare a bug since we currently do not do this on input.
We instead remember that -d was born from deprecated options like -Nnodata in xyzgrd where we strictly only examined the z [third] column for such values. In that case, the -di is close in spirit but will also do columns beyond three
I think the first proposal makes most sense, and we also require some documentation clarification. Thoughts, @GenericMappingTools/core
I agree with the first proposal for a short-term bug fix. Adding an option for specifying the columns could be a low-priority feature request. The only case that I could imagine where it would be useful is if someone unwraps a grid that has 0 as the NaN value for z-data, though they could always specify that in grd2xyz first.
Letting -di apply to all columns causes one test failure as we are using -di0 to say 0 is a NaN, but that then (with the revision) replaces various x and y coordinates that happen to be 0 with NaNs as well, breaking the test. Given we don't want to break things, my second proposal is simply that we let -d only operate on the columns following the coordinates (2 for most modules, 1 for time-series cases, 0 for histogram/rose, etc) unless a (new and future) +a modifiers says "do this for all columns".
Letting -di apply to all columns causes one test failure as we are using -di0 to say 0 is a NaN, but that then (with the revision) replaces various x and y coordinates that happen to be 0 with NaNs as well, breaking the test. Given we don't want to break things, my second proposal is simply that we let -d only operate on the columns following the coordinates (2 for most modules, 1 for time-series cases, 0 for histogram/rose, etc) unless a (new and future) +a modifiers says "do this for all columns".
Activity
PaulWessel commentedon Aug 11, 2021
While certainly not documented well, I believe -d only affects the z column, which is not used here. It originated in tools like xyz2grd and similar. Perhaps it will need a +ccol modifier... [2].
maxrjones commentedon Aug 11, 2021
Yes, a +ccol modifier seems helpful and the simplest solution.
maxrjones commentedon Aug 11, 2021
Actually, it would be nice for this to work for multiple or all columns. So either [+ccol][+a] or [cols] with the usual column range notation.
PaulWessel commentedon Aug 12, 2021
A bit of looking reveals the following implementation truths.
if (col_no > 1 && gmt_input_is_nan_proxy (GMT, GMT->current.io.curr_rec[col_no])) /* Input matched no-data setting, so change to NaN */if (GMT->common.d.active[GMT_OUT] && gmt_M_is_dnan (val)) val = GMT->common.d.nan_proxy[GMT_OUT]; /* Write this value instead of NaNs */There is no trace of this being discussed in the docs, so we can choose to make this a feature or a bug :-).
I assume I skipped examining the x,y coordinates since those are unlikely to be flagged as -99999 as such a point would not be useful in a data set (x,y by itself could be useful as a station location even though the observation z is invalid). However, I did not think that through as many datasets are instead time or spatial series (t,y) in which case perhaps the 2nd column should be affected by -di) or simply a list of observations (e..g, the one-column input to histogram).
The fact that a NaN x or y can be replaced on output by the chosen -99999 or similar seems to suggest the limitation in input is a bit dumb.
Proposal: Since the unique value (e.g., -99999 or similar) is unique (there won't be another one like 9898989 for column 4, for instance), I think it makes sense to apply this to all columns both on input and output. We would then declare a bug since we currently do not do this on input.
We instead remember that -d was born from deprecated options like -Nnodata in xyzgrd where we strictly only examined the z [third] column for such values. In that case, the -di is close in spirit but will also do columns beyond three
I think the first proposal makes most sense, and we also require some documentation clarification. Thoughts, @GenericMappingTools/core
maxrjones commentedon Aug 12, 2021
I agree with the first proposal for a short-term bug fix. Adding an option for specifying the columns could be a low-priority feature request. The only case that I could imagine where it would be useful is if someone unwraps a grid that has 0 as the NaN value for z-data, though they could always specify that in grd2xyz first.
PaulWessel commentedon Aug 12, 2021
Unless @joa-quim or @seisman have strong opinions on this issue I will declare a bug and apply -d to all columns.
PaulWessel commentedon Aug 13, 2021
Letting -di apply to all columns causes one test failure as we are using -di0 to say 0 is a NaN, but that then (with the revision) replaces various x and y coordinates that happen to be 0 with NaNs as well, breaking the test. Given we don't want to break things, my second proposal is simply that we let -d only operate on the columns following the coordinates (2 for most modules, 1 for time-series cases, 0 for histogram/rose, etc) unless a (new and future) +a modifiers says "do this for all columns".
maxrjones commentedon Aug 13, 2021
Sounds good.
Let -d set starting column via modifier
Let -d set starting column via modifier (#5966)
maxrjones commentedon Nov 9, 2021
Closed by #5966