# Why after grdblend ,the grid spacing changed?

**URL:** https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413
**Category:** Q&A
**Created:** [April 23, 2020, 1:52pm UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413 "2020-04-23T13:52:42Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)
#### Post date: [April 23, 2020, 1:52pm UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/1 "2020-04-23T13:52:42Z")

</div>

Hello,friends  
there has four data is 12.5m spacing,and i use `grdblend` command to blend them together,and the blendedfile shows it has a spacing of 12.5005167852m.  
but the range was right ,it seemed to call a resample command,Why? and how i can get a 12.5m blended file?  
Thanks a lot!  
the four data ready to be blend:

```auto
AP_14636_FBD_F6850_RT1.dem.grd: Pixel node registration used [Cartesian grid]
AP_14636_FBD_F6850_RT1.dem.grd: Grid file format: cs = GMT netCDF format (16-bit integer, deprecated)
AP_14636_FBD_F6850_RT1.dem.grd: x_min: 766676.6875 x_max: 847651.6875 x_inc: 12.5 name: n_columns: 6478
AP_14636_FBD_F6850_RT1.dem.grd: y_min: 8144894.25 y_max: 8218369.25 y_inc: 12.5 name: n_rows: 5878
AP_14636_FBD_F6850_RT1.dem.grd: z_min: 36 z_max: 1293 name: meters**
 
AP_14636_FBD_F6860_RT1.dem.grd: Pixel node registration used [Cartesian grid]
AP_14636_FBD_F6860_RT1.dem.grd: Grid file format: cs = GMT netCDF format (16-bit integer, deprecated)
AP_14636_FBD_F6860_RT1.dem.grd: x_min: 754256.6875 x_max: 835469.1875 x_inc: 12.5 name: n_columns: 6497
AP_14636_FBD_F6860_RT1.dem.grd: y_min: 8200034.25 y_max: 8273359.25 y_inc: 12.5 name: n_rows: 5866
AP_14636_FBD_F6860_RT1.dem.grd: z_min: 44 z_max: 1292 name: meters
 
AP_15059_FBS_F6850_RT1.dem.grd: Pixel node registration used [Cartesian grid]
AP_15059_FBS_F6850_RT1.dem.grd: Grid file format: cs = GMT netCDF format (16-bit integer, deprecated)
AP_15059_FBS_F6850_RT1.dem.grd: x_min: 824462.9375 x_max: 905437.9375 x_inc: 12.5 name: n_columns: 6478
AP_15059_FBS_F6850_RT1.dem.grd: y_min: 8144043 y_max: 8217493 y_inc: 12.5 name: n_rows: 5876
AP_15059_FBS_F6850_RT1.dem.grd: z_min: -193 z_max: 1619 name: meters
 
AP_15059_FBS_F6860_RT1.dem.grd: Pixel node registration used [Cartesian grid]
AP_15059_FBS_F6860_RT1.dem.grd: Grid file format: cs = GMT netCDF format (16-bit integer, deprecated)
AP_15059_FBS_F6860_RT1.dem.grd: x_min: 811712.9375 x_max: 893225.4375 x_inc: 12.5 name: n_columns: 6521
AP_15059_FBS_F6860_RT1.dem.grd: y_min: 8199403 y_max: 8272753 y_inc: 12.5 name: n_rows: 5868
AP_15059_FBS_F6860_RT1.dem.grd: z_min: 44 z_max: 1292 name: meters

```

Blend command:(Notice i used -rp to declare a pixel node registration)

```auto
gmt grdblend blend.job -rp -Gblend.grd -R754256.6875/905437.9375/8144043.00/8273359.25

```

After Blend:

```auto
blend.grd: Pixel node registration used [Cartesian grid]
blend.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
blend.grd: x_min: 754256.6875 x_max: 905437.9375 x_inc: 12.5005167852 name: n_columns: 12094
blend.grd: y_min: 8144043 y_max: 8273359.25 y_inc: 12.500362494 name: n_rows: 10345
blend.grd: z_min: -194.100585938 z_max: 1645.43127441 name: z

```

The manul told :`Any input grid that does not share the final output grid’s node registration and grid spacing will automatically be resampled` ,but it obviously not that case.

---

<div class="post-metadata">

### Author: ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)
#### Post date: [April 23, 2020, 7:32pm UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/2 "2020-04-23T19:32:44Z")

</div>

> [@Mark](#):
>
> 8144043.00/8273359.25

is already non divisible by 12.5 intervals

---

<div class="post-metadata">

### Author: ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)
#### Post date: [April 23, 2020, 8:44pm UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/3 "2020-04-23T20:44:16Z")

</div>

`gmt math -Q 905437.9375 754256.6875 SUB` gives me 151181.25 which is clearly not a multiple of 12.5.

---

<div class="post-metadata">

### Author: ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)
#### Post date: [April 24, 2020, 7:29am UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/4 "2020-04-24T07:29:28Z")

</div>

Thanks a lot,Then i tryed another range:  
`gmt grdblend blend.job -Gblend.grd -R759256.6875/900431.6875<U+202C>/8149043.00/8268355.5<U+202C>`  
Which is the multiple of 12.5,and the info of result:

> blend.grd: Gridline node registration used [Cartesian grid]  
> blend.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7  
> blend.grd: x\_min: 759256.6875 x\_max: 900437.9375 x\_inc: 12.4994466578 name: n\_columns: 11296  
> blend.grd: y\_min: 8149043 y\_max: 8268359.25 y\_inc: 12.5003928759 name: n\_rows: 9546  
> blend.grd: z\_min: -164.104415894 z\_max: 1642.68981934 name: z  
> blend.grd: scale\_factor: 1 add\_offset: 0  
> blend.grd: format: netCDF-4 chunk\_size: 129,129 shuffle: on deflation\_level: 3

the height also resampled!

---

<div class="post-metadata">

### Author: ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)
#### Post date: [April 24, 2020, 7:30am UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/5 "2020-04-24T07:30:07Z")

</div>

Big Thanks! Professor! Then i tryed another range:  
`gmt grdblend blend.job -Gblend.grd -R759256.6875/900431.6875<U+202C>/8149043.00/8268355.5<U+202C>`  
Which is the multiple of 12.5,and the info of result:

> blend.grd: Gridline node registration used [Cartesian grid]  
> blend.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7  
> blend.grd: x\_min: 759256.6875 x\_max: 900437.9375 x\_inc: 12.4994466578 name: n\_columns: 11296  
> blend.grd: y\_min: 8149043 y\_max: 8268359.25 y\_inc: 12.5003928759 name: n\_rows: 9546  
> blend.grd: z\_min: -164.104415894 z\_max: 1642.68981934 name: z  
> blend.grd: scale\_factor: 1 add\_offset: 0  
> blend.grd: format: netCDF-4 chunk\_size: 129,129 shuffle: on deflation\_level: 3

How to choose a right range?  
I want the result is 12.5m spacing and non resampled  
I tried another software name global mapper and it return the result i wanted,  
But i also hope to use gmt to do the same thing!

---

<div class="post-metadata">

### Author: ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)
#### Post date: [April 24, 2020, 7:46am UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/6 "2020-04-24T07:46:53Z")

</div>

I can confirm the odd result of 12.500xxx. WIll look into it. It is as if floats and not doubles are used.

---

<div class="post-metadata">

### Author: ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)
#### Post date: [April 24, 2020, 7:52am UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/7 "2020-04-24T07:52:55Z")

</div>

Wait a minute. Your -R is full of hidden control characters that switches the args around. Please the -R again without copy/paste from a web page or word doc or whatever you did. Works fine then.

---

<div class="post-metadata">

### Author: ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)
#### Post date: [April 24, 2020, 8:21am UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/8 "2020-04-24T08:21:01Z")

</div>

![Snipaste_2020-04-24_16-19-27](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/f5e22e1db0ca410bc6afe00653099bb79fc45a29.png)  
I type them manually,and the result above also not the hoped

---

<div class="post-metadata">

### Author: ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)
#### Post date: [April 24, 2020, 3:42pm UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/9 "2020-04-24T15:42:23Z")

</div>

I think this is the result of a mix between grid and pixel registrations. Sometimes the blend is reported as grid and other as pixel. And about the difference from 12.5, see

```auto
(12.5 /2)/11294

ans =

      0.000553391181158137

```

which is the difference from 12.5 in your case above

---

<div class="post-metadata">

### Author: ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)
#### Post date: [April 24, 2020, 3:55pm UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/10 "2020-04-24T15:55:25Z")

</div>

Thanks Joaquim!  
It will be better if there is any resolution.

---

<div class="post-metadata">

### Author: ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)
#### Post date: [April 24, 2020, 4:03pm UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/11 "2020-04-24T16:03:39Z")

</div>

Dear Joaquim:  
another question,Please help

> [@How to solve grdcut error:Must specify one input grid file?](https://flint.soest.hawaii.edu/t/how-to-solve-grdcut-error-must-specify-one-input-grid-file/420):
>
> If can help,Huge thanks! gmt grdcut combine.grd -GcombineAOI.grd -R167.84/168.40/-16.42/-16.06 V This is return: grdcut [ERROR]: Syntax error: Must specify one input grid file In fact,combine.grd is under its directory. This is the compressed file of combine.grd: [https://drive.google.com/file/d/1stmwhZaoCMGZP0yUgBoeQr44z8ZyPc9K/view?usp=sharing](https://drive.google.com/file/d/1stmwhZaoCMGZP0yUgBoeQr44z8ZyPc9K/view?usp=sharing)

Thanks!

---

<div class="post-metadata">

### Author: ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)
#### Post date: [April 24, 2020, 4:19pm UTC](https://forum.generic-mapping-tools.org/t/why-after-grdblend-the-grid-spacing-changed/413/12 "2020-04-24T16:19:48Z")

</div>

> [@Mark](#):
>
> It will be better if there is any resolution.

Not sure what you mean. Would need to check more closely, but it might happen that your case does not have a solution that does not reinterpolate (which is different from the 12.5 increment issue). If grid origins are not at integer steps of 12.5 from each other to do a blend some must be reinterpolated. The non 12.5 issue is a question -R and -r
