Skip to content
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

Fix bug in grdblend when setting -I that was in fact ignored and got its value from first grid. #8407

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

joa-quim
Copy link
Member

Before (result obvious wrong as it didn't respect the -I and the blended -R was wrong too)

grdmath -R0/10/0/10 -I2 X = G1.grd
grdmath -R5/15/0/10 -I1 X Y = G2.grd

grdblend G1.grd G2.grd -GG3.grd -I1
grdblend [WARNING]: File G1.grd has different increments (2/2) than the output grid (1/1) - must resample

grdblend G1.grd G2.grd -GG3.grd -I1
grdblend [WARNING]: File G2.grd has different increments (1/1) than the output grid (2/2) - must resample
grdblend [WARNING]: File G2.grd coordinates are phase-shifted w.r.t. the output grid - must resample
grdsample [WARNING]: Output sampling interval in x exceeds input interval and may lead to aliasing.
grdsample [WARNING]: Output sampling interval in y exceeds input interval and may lead to aliasing.

grdinfo G3.grd
G3.grd: Title:
G3.grd: Command: gmt grdblend G1.grd G2.grd -GG3.grd -I1
G3.grd: Remark:
G3.grd: Gridline node registration used [Cartesian grid]
G3.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
G3.grd: x_min: 0 x_max: 30 x_inc: 2 name: x n_columns: 16
G3.grd: y_min: 0 y_max: 20 y_inc: 2 name: y n_rows: 11
G3.grd: v_min: 0 v_max: 0 name: z
G3.grd: scale_factor: 1 add_offset: 0
G3.grd: format: classic
G3.grd: Default CPT:

With this PR

grdblend G1.grd G2.grd -GG3.grd -I1
grdblend [WARNING]: File G1.grd has different increments (2/2) than the output grid (1/1) - must resample

grdinfo G3.grd
G3.grd: Title:
G3.grd: Command: gmt grdblend G1.grd G2.grd -GG3.grd -I1
G3.grd: Remark:
G3.grd: Gridline node registration used [Cartesian grid]
G3.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
G3.grd: x_min: 0 x_max: 15 x_inc: 1 name: x n_columns: 16
G3.grd: y_min: 0 y_max: 10 y_inc: 1 name: y n_rows: 11
G3.grd: v_min: 0 v_max: 0 name: z
G3.grd: scale_factor: 1 add_offset: 0
G3.grd: format: classic
G3.grd: Default CPT:

Run the tests and this doesn't seem to cause any failures, but our testing system is very broken, at least for me where I can't use the GMT_DATA_SERVER=static and where the CI give different results in all 3 OS.

So, please test this too.

@joa-quim joa-quim requested a review from a team March 17, 2024 02:42
@joa-quim joa-quim changed the title Fix bug when setting -I that was in fact ignored and got its value from first grid. Fix bug in grdblend when setting -I that was in fact ignored and got its value from first grid. Mar 17, 2024
@joa-quim joa-quim merged commit 6f5493b into master Mar 18, 2024
6 checks passed
@joa-quim joa-quim deleted the fix-grdblend-inc-bug branch March 18, 2024 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant