Repository navigation
Pass GMT_GRID_NEEDS_PAD1 flag to GMT_Read_Data in grdfill - #6418
Conversation
|
I am not sure this will work. If I understand, you wish to pass in a grid that then should have these odd pads. Once you read it in the array is allocated. I think you have to doctor this by
Sorry, bedtime for Bonzo here now. |
|
I revised this PR to use a simpler fix by requiring a pad of at least 1 for grdfill. I also removed the C API test because the pad kept getting set as 2 regardless of adjustments to the order of setting the pad, adjusting the header, and calling the virtual file. I will add a PyGMT regression test instead. |
| offset = (uint64_t)(Grid->header->pad[YHI] + Grid->header->n_rows) * Grid->header->mx; | ||
| for (node = 0; node < (openmp_int)Grid->header->mx; node++) ID[node] = ID[node+offset] = 1; | ||
| /* Set the left and right boundary columns to UINT_MAX */ | ||
| for (node = 0; node < (uint64_t)Grid->header->pad[YHI]*Grid->header->mx; node++) ID[node] = ID[node+offset] = 1; |
There was a problem hiding this comment.
This bit makes me some tickles. Just wondering. What if the grid received was written top-down (netCDF grids can be either bottom-up or top-down). Shouldn't it then use pad[YLO]?
Ofc, this may have no sense but seeing something depending on the axis direction when we can have both directions makes my bug bell to ring.
There was a problem hiding this comment.
I think the top/bottom order is dealt with in gmt_nc when the file is read. By the time GMT modules get grids they are in the expected orientation.
There was a problem hiding this comment.
For clarification (just in case), this commit is reverting my changes back to the original code. I could go back to modifying the code to only set one boundary column/row on each side to 1.
Description of proposed changes
This PR fixes the bug reported by GenericMappingTools/pygmt#1745. This crash occurred in cases where
Grid->header->pad[YHI]>Grid->header->pad[YLO].Fixes #
Reminders