Gridmath error

quick question; I’m trying to add a mask to a grid using grdmath and I keep getting an error about NX and NY, I tried the grdedit -A suggestion and still doesn’t solve the problem. Anyone has some experience with grdmath?

Here is the run; gmt grdmath 20210519_20210525.grd KivuMask.grd MUL = 20210519_20210525_masked.grd and the error message:
grdmath [ERROR]: (x_max-x_min) must equal (NX + eps) * x_inc), where NX is an integer and |eps| <= 0.0001.
grdmath [ERROR]: (y_max-y_min) must equal (NY + eps) * y_inc), where NY is an integer and |eps| <= 0.0001.
grdmath (gmtlib_read_grd_info): Use grdedit -A on your grid file to make region and increments compatible [KivuMask.grd]

GMT is a bit picky that the grids actually are internally consistent. Perhaps you can post the output of grdinfo for the two grids here?

Please, do no post under a wrong category. There is nothing GMT.jl in your question.

20210519_20210525.grd: Title: 20210519_20210525.grd
20210519_20210525.grd: Command: File written by MATLAB function grdwrite2.m
20210519_20210525.grd: Remark: Created 09-May-2022 18:11:01
20210519_20210525.grd: Gridline node registration used [Cartesian grid]
20210519_20210525.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
20210519_20210525.grd: x_min: 28.4859761 x_max: 30.28682384 x_inc: 0.00027778 name: x n_columns: 6484
20210519_20210525.grd: y_min: -2.3190463 y_max: -0.8982016 y_inc: 0.00027778 name: y n_rows: 5116
20210519_20210525.grd: v_min: -154.096954346 v_max: 104.191604614 name: z
20210519_20210525.grd: scale_factor: 1 add_offset: 0
20210519_20210525.grd: format: classic
KivuMask.grd: Command: grdlandmask -R28.4859761/30.28682384/-2.3190463/-0.8982016 -A+l -Df -NNaN/1 -GKivuMask.grd -I0.00027778/0.00027778
KivuMask.grd: Remark: Derived from the full resolution shorelines
KivuMask.grd: Gridline node registration used [Geographic grid]
KivuMask.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
KivuMask.grd: x_min: 28.4859761 x_max: 30.28682384 x_inc: 0.00027778 (1 sec) name: longitude n_columns: 6484
KivuMask.grd: y_min: -2.3190463 y_max: -0.8982016 y_inc: 0.00027778 (1 sec) name: latitude n_rows: 5116
KivuMask.grd: v_min: 1 v_max: 1 name: z
KivuMask.grd: scale_factor: 1 add_offset: 0
KivuMask.grd: format: netCDF-4 chunk_size: 130,132 shuffle: on deflation_level: 3

Very similar-looking, but also very large grids so a tiny offset in the increment could cause this. I note one is written from matlab and says it is Cartesian while the other is geographic. Could you please do the two commands again but add –FORMAT_FLOAT_OUT=%.16lg to them?