-
Notifications
You must be signed in to change notification settings - Fork 224
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
The "incols" (-i) parameter doesn't works for vector input correctly #1313
Comments
Do not think this is upstream bug. Similar test with switching x,y then passing -i works as expected. |
Yes, I think this is an upstream bug, but it only affects wrappers, that's why the GMT tests pass. Here is a modified example based on @michaelgrund's example:
As you can see, passing "YXZ" data and using |
Debugging the
|
I think to use |
So I am debugging the C code. I cannot change anything in these strings in the option structure I think. Is that what you are suggesting? |
Just suggesting to use this for the debugging if you build from master branch to avoid the pygmt alias parsing:
|
So I think I found the problem, but concerned that this would certainly affect any matrix being passed in as a dataset with -i options. This is the function that determines which column we should read given input values col = 0, 1, 2, 3 ...:
I have commented out the offending line and replaced it with the one using the member order, like in gmtio_ascii_input for files. I will make a PR for this but please run all tests you have that uses a matrix for dataset input. |
Thanks for adding this @seisman, only tested it with an array as input. |
The upstream bug was fixed in GenericMappingTools/gmt#5289 and will be available in GMT 6.2.0. |
Great! Thanks for your efforts @PaulWessel @meghanrjones @seisman. |
I can work on debugging the scaling issue, but may not be able to get to it today. We should generalize the issue title a bit for tracking, since this applies to virtual file input with |
Tables are either read rec-by-rec or as an entire table. Fixing the above for record reading was simple, and that gets the right -R via gmtinfo which reads records. So the 2nd plot now shares the same y-range as the first. However, the plotting in plot reads the entire table in and since GMT_IS_REFERENCE is passed we simply hook up the vectors to avoid memory duplication. We only do this if input vectors are double precision, which they are, else we switch to GMT_IS_DUPLICATE. Unfortunately, there is no check on -i+s+o+l manipulation of data which also needs to kick us to GMT_IS_DUPLICATE so we can adjust the values...Hence the data are still in the original units and plots off chart. I will continue working on this issue later today after returning from UH. |
See GenericMappingTools/pygmt#1313 for details. This PR ensures the record-by-record reading of external vectors have any adjustments set via -i applied.
* Ensure external vector is scaled via -I on rec-by-rec parsing See GenericMappingTools/pygmt#1313 for details. This PR ensures the record-by-record reading of external vectors have any adjustments set via -i applied. * Update gmt_api.c
Reopen because the upstream fix GenericMappingTools/gmt#5289 breaks GMT.jl. See GenericMappingTools/gmt#5384 for discussions. |
A second fix was implemented in GenericMappingTools/gmt#5392. xref #1440 (I will need to check if that is a duplicate issue). |
The example script in #1313 (comment) works well with the GMT master branch, but #1440 fails. So I think they are not duplicate issues. As this issue has been fixed, I think we can close it, but we need to add a test before closing the issue. Agree? |
Thanks for checking. Yes, I agree that we can close this issue after adding a test. |
I'm trying to add a test for this issue, but I found there are still bugs with -i option. With GMT 6.2.0, -i1,0 works for PyGMT, but modifiers are ignored. For example,
|
I suspect the problem is that the fix applied in GenericMappingTools/gmt#5291 wasn't extended to table-reading. @PaulWessel, do you remember if you have any pending work for the |
I quickly looked at the source code. I think the Actually, If I understand it correctly, using the |
I stepped through the code and confirmed that Lines 1457 to 1463 in d01da5a
|
I think GenericMappingTools/gmt#5799 fixed the last of the upstream problems reported in this issue. Do we still need more tests for this before closing? |
I think we still need a test like this one #1313 (comment), because we don't have any tests that use |
Also modified the original deprecation test into a regression test for #1313
Description of the problem
Using the
incols
parameter does not allow to swap columns (seems like the parameter is ignored at all so far). I believe it's an upstream GMT bug. This was discovered in #1303 (comment).Full code that generated the error
Full output
System information
Please paste the output of
python -c "import pygmt; pygmt.show_versions()"
:@PaulWessel @meghanrjones could you please check if you can debug it?
The text was updated successfully, but these errors were encountered: