Reading/writing a matrix from/to a grid file (#3848)#3856
Conversation
* Allow GMT_Read_Data to return a matrix from a grid file Experimental. INitially it just read an ascii table but it would be convenient to recognize file extensions *.grd and *.nc plus the remote grids @earth*. * Complete plan for read/write matrix via grids * Update testapi_grid2matrix.c * Fix the chunk issue * Create apimat2grd.ps * Update some test codes to read OPINTS not SURFACE if ascii, and update PS * Update api.rst
|
@PaulWessel There are two conflicts when picking PR #3848 into 6.1 branch. Please see how to resolve these two conflicts. |
src/gmt_api.c
Outdated
| <<<<<<< HEAD | ||
| /* If neither TRB or TRP we call for a changed layout, which may or may not have been implemented */ | ||
| GMT_Change_Layout (GMT->parent, GMT_IS_IMAGE, GMT->parent->GMT->current.gdal_read_in.O.mem_layout, 0, I, NULL, NULL); | ||
| ======= | ||
| >>>>>>> 02af19c043... Reading/writing a matrix from/to a grid file (#3848) |
There was a problem hiding this comment.
Looks like diff has a bug to me. This line involves a change to an image variable I, but we are doing grids in this function. This is completely crazy. It must have found some similar passage and placed it in the wrong spot. Those lines are found in the function gmtapi_expand_index_image, which is not involved in grid reading. So I guess delete?
There was a problem hiding this comment.
Obviously, diff doesn't do a good job for big changes like this one.
src/gmt_api.c
Outdated
| <<<<<<< HEAD | ||
| if ((mode & GMT_CONTAINER_ONLY) && S_obj->region && S_obj->method == GMT_IS_FILE) { | ||
| GMT_Report (API, GMT_MSG_ERROR, "Cannot request a subset when just inquiring about the grid header\n"); | ||
| return_null (API, GMT_SUBSET_NOT_ALLOWED); | ||
| ======= | ||
| else { | ||
| GMT_Report (GMT->parent, GMT_MSG_ERROR, "Unrecognized source type %d in gmtapi_write_matrix\n", dest_type); | ||
| return (GMT_NOT_A_VALID_METHOD); | ||
| >>>>>>> 02af19c043... Reading/writing a matrix from/to a grid file (#3848) |
There was a problem hiding this comment.
Likewise craziness. That code under HEAD is found in gmtapi_import_grid, but we are in the matrix section! I know I moved large sections of code from around lines 3000 to below 5000 since the import and export matrix functions were calling import/export_grid functions that needed to be declared first. This must have really messed up diff.
|
How can I see this more in context? I need to look at more lines. |
|
Just go to https://github.com/GenericMappingTools/gmt/pull/3856/files, and click "Load diff". There are a lot of changes in gmt_api.c. You can just search for |
|
So I can edit but I am now very distrustful of the diff... |
|
I have resolve these two conflicts. We'd better run the full tests for this PR again to make sure it works for 6.1 branch. |
Backport #3848 to 6.1.
Fixes #
Reminders