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
{{ message }}
Repository navigation
Segmentation fault if a grid has zero increments #1483
That's true, I didn't notice. It's because of the way I'm building the DataArray with the meshgrid. Still, I'll consider this a bug because of the segmentation fault, some error should be raise.
I'll consider this a bug because of the segmentation fault, some error should be raise.
I agree, but I'm not sure if the error should be done by PyGMT or by GMT.
Ping @meghanrjones
I think ideally it should be caught by both so that PyGMT users have a more readable call stack and other wrappers do not get the same problem. If the same grid is a actual file rather than a remote file, GMT catches the read error properly which suggests it is an API bug.
We could pretty easily add a check for this case in the code section below. I cannot find this documented, but I think that GMT expects monotonically increasing, evenly spaced grids even though COARDS compliant grids can be monotonically increasing or decreasing. If this is the case, we could raise GMTInvalidInput if coord_inc <=0.
I'm reopening the issue because a similar fix should be done in the upstream GMT code.
@PaulWessel @meghanrjones I think the problem is the API function GMT_Create_Data doesn't check if the parameter wesn is reasonable (in this case, wesn=[0, 0, 0, 0] is passed).
I'm reopening the issue because a similar fix should be done in the upstream GMT code.
@PaulWessel @meghanrjones I think the problem is the API function GMT_Create_Data doesn't check if the parameter wesn is reasonable (in this case, wesn=[0, 0, 0, 0] is passed).
Thanks for the information. @PaulWessel, I would like to work on fixing this issue. I'll submit a PR in the GMT repository for your feedback and ping if help is needed. We should remember to run gmt.jl tests before merging anything.
changed the title [-]segmentation fault instead of a proper error in grdimage[/-][+]Segmentation fault if a grid has zero increments[/+]on Sep 14, 2021
Activity
seisman commentedon Sep 3, 2021
There is something wrong with your x and y coords.
Printing the
davariable gives me:as you can see, x and y coords are all zeros.
yohaimagen commentedon Sep 3, 2021
That's true, I didn't notice. It's because of the way I'm building the
DataArraywith themeshgrid. Still, I'll consider this a bug because of the segmentation fault, some error should be raise.seisman commentedon Sep 3, 2021
I agree, but I'm not sure if the error should be done by PyGMT or by GMT.
Ping @meghanrjones
maxrjones commentedon Sep 3, 2021
I think ideally it should be caught by both so that PyGMT users have a more readable call stack and other wrappers do not get the same problem. If the same grid is a actual file rather than a remote file, GMT catches the read error properly which suggests it is an API bug.
We could pretty easily add a check for this case in the code section below. I cannot find this documented, but I think that GMT expects monotonically increasing, evenly spaced grids even though COARDS compliant grids can be monotonically increasing or decreasing. If this is the case, we could raise
GMTInvalidInputifcoord_inc <=0.pygmt/pygmt/clib/conversion.py
Lines 93 to 102 in d01da5a
yohaimagen commentedon Sep 4, 2021
I'll add the error.
yohaimagen commentedon Sep 4, 2021
actually, GMT is handling well monotonically decreasing grid when passing with
DataArraysee example
get us the following
so maybe we should allow it and only raise an error when
coord_inc ==0?maxrjones commentedon Sep 6, 2021
Sounds good.
seisman commentedon Sep 13, 2021
I'm reopening the issue because a similar fix should be done in the upstream GMT code.
@PaulWessel @meghanrjones I think the problem is the API function
GMT_Create_Datadoesn't check if the parameterwesnis reasonable (in this case,wesn=[0, 0, 0, 0]is passed).maxrjones commentedon Sep 13, 2021
Thanks for the information. @PaulWessel, I would like to work on fixing this issue. I'll submit a PR in the GMT repository for your feedback and ping if help is needed. We should remember to run gmt.jl tests before merging anything.
[-]segmentation fault instead of a proper error in grdimage[/-][+]Segmentation fault if a grid has zero increments[/+]