# Grdblend problem!

**URL:** https://forum.generic-mapping-tools.org/t/grdblend-problem/564
**Category:** Q&A
**Tags:** gmt
**Created:** [June 21, 2020, 1:09pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564 "2020-06-21T13:09:21Z")
**Posts on this page:** 20
**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: [June 21, 2020, 1:09pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/1 "2020-06-21T13:09:21Z")

</div>

Hello,friends!  
when use grdblend to blend 4 grd file,the result was not match its border:  
command:`gmt grdblend -rp blend.job -Gblend.grd -V`

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/2013ba352a94ff732be8f01220cdb54b4697f772.png)

and this is blend by GlobalMapper,and its matches well:

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/1b3b5549092b2bd30af8c028e587dab3c5f97d3c.png)

why gmt can’t make it!

---

<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: [June 21, 2020, 1:46pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/2 "2020-06-21T13:46:31Z")

</div>

I don’t know what GlobalMapper is doing but the GMT plot is correct.  
You are overlapping data with different datum and the result is that.  
There is a post by @KristofKoch showing how to use openstreet mapa data to evercome this issue.

---

<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: [June 21, 2020, 1:59pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/3 "2020-06-21T13:59:31Z")

</div>

P.S. the picture above is plot by global mapper,and the first data is blended by GMT,the second data is blended by GlobalMapper

---

<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: [June 21, 2020, 2:01pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/4 "2020-06-21T14:01:52Z")

</div>

I don’t know is somthing wrong in my GMT command,  
I tried another command which ensure the spacing is 12.5,like the subgrid.  
`gmt grdblend -rp -R759262.9375/900425.4375‬/8149049.25/9640336.75 blend.job -Gblend.grd -V`  
but it still doesn’t match

---

<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: [June 21, 2020, 2:05pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/5 "2020-06-21T14:05:02Z")

</div>

here’s one of the debug information:  
$ gmt grdblend -rp -R759262.9375/900425.4375/8149049.25/9640336.75 blend.job -Gnewblend.grd -V  
grdblend [WARNING]: File AP\_14636\_FBD\_F6850\_RT1\_cutted.dem.grd coordinates are phase-shifted w.r.t. the output grid - must resample  
grdsample [WARNING]: (s - y\_min) must equal (NY + eps) \* y\_inc), where NY is an integer and |eps| \<= 0.0001.  
grdsample [WARNING]: s reset from 8149899.27691 to 8149894.25  
grdsample [WARNING]: (n - y\_min) must equal (NY + eps) \* y\_inc), where NY is an integer and |eps| \<= 0.0001.  
grdsample [WARNING]: n reset from 8215363.8344 to 8215369.25  
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.

---

<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: [June 21, 2020, 2:12pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/6 "2020-06-21T14:12:26Z")

</div>

Dear Joaquim, I don’t know what `coordinates are phase-shifted w.r.t. the output grid - must resample` mean,it maybe the key for this problem

---

<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: [June 21, 2020, 4:28pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/7 "2020-06-21T16:28:26Z")

</div>

No. The key to the problem is understanding what is happening. The coastlines are old (the CookBook explains that) and use the International Ellipsoid 1924 whilst your grid has data in WGS84. At large scales plots, such as yours, the difference is visible. You would have to do a datum shift to WGS84 of the coastlines to have nice match. Possibly, that’s what GlobalMapper did.

---

<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: [June 22, 2020, 3:09am UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/8 "2020-06-22T03:09:54Z")

</div>

The border was downloaded from DGAM,and below is its coordinate info:  
`GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]`  
And the grid file is :  
`+proj=utm +zone=58 +south +datum=WGS84 +units=m +no_defs`  
Then I use command :  
`gmt grdproject blend.grd -rp -Ju-58/1:1 -C -I -Fe -GblendGeodetic.grd` to make them in the same coordinate system,but it still doesn’t match

---

<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: [June 22, 2020, 3:11am UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/9 "2020-06-22T03:11:27Z")

</div>

I found that when I used grdblend,It become doesn’t match,I guess is this `coordinates are phase-shifted` caused?

---

<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: [June 22, 2020, 9:15am UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/10 "2020-06-22T09:15:21Z")

</div>

Hi, [Joaquim](https://flint.soest.hawaii.edu/u/Joaquim)  
I resampled every subgrid file in calculated range to to make it not resample when blend(no debug info:coordinate phase shift),and the result finally can match its border.  
But the calculation is long and not conducive to scripting.

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/64ae848c7e31e00f084e58aaf95e0ff4eac21d35.png)  
But I still want to know,why blend will cause coordinate phase shift which leads to resample the subgrid,and cause the final result doesn’s match its border?

---

<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: [June 22, 2020, 11:34am UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/11 "2020-06-22T11:34:20Z")

</div>

OK, my bad. In your first post and since you did not mention the coastline file origin I thought you were plotting the GMT coastlines. But now I see that the shift is purely EW.  
The cause of the phase-shift warning is because your global -R (the one you passed to grdblend) is not compatible with the individual’s -R and increment of the individual grids, so a resampling must be done. However, it is strange that the resampling leads to such a large offset. We would need to have the data files to explores this issue further.

Probably `grdpaste` is a much easier route to your assembling job, but it needes that the individual tiles have common borders.

---

<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: [June 22, 2020, 11:50am UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/12 "2020-06-22T11:50:31Z")

</div>

My source dem data is like remote sensing image,it have large overlapping area but not border,it’s a pity.  
I’ll upload my data shortly after.

---

<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: [June 22, 2020, 11:52am UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/13 "2020-06-22T11:52:31Z")

</div>

Better to post a link to the data.

---

<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: [June 22, 2020, 12:51pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/14 "2020-06-22T12:51:10Z")

</div>

Joaquim,can I get your mail adress,I can’t connect to google drive because some reason,I want send a mail attachment to you.

---

<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: [June 22, 2020, 3:42pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/15 "2020-06-22T15:42:22Z")

</div>

jluis at ualg.pt …

---

<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: [June 22, 2020, 3:56pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/16 "2020-06-22T15:56:04Z")

</div>

sent ！！！！！！！！！！！！！！！！！！！！！！！

---

<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: [June 22, 2020, 4:08pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/17 "2020-06-22T16:08:18Z")

</div>

Yes, that limit of 20 chars is silly. But I didn’t get any mail. What’s the size of the grids? You can use transfer services like [wetransfer](https://wetransfer.com/)

EDIT: actually I got the mail (it was in spam) but nothing happens when I click on those huge long addresses.

---

<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: [June 23, 2020, 6:25am UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/18 "2020-06-23T06:25:49Z")

</div>

I bought a service so that I can link to googledrive

> **[grdblendPhaseShiftProblem.zip](https://drive.google.com/file/d/1tJSe49FX9bjirfOkwuWawcNP-zDMXnTG/view?usp=sharing)**
>
> Google Drive file.

---

<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: [June 23, 2020, 5:12pm UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/19 "2020-06-23T17:12:32Z")

</div>

OK, I got them and a quick run resulted in errors running grdblend that even prevented the creation of a blended grid.

But you had brought this issue, or similar, [before](https://flint.soest.hawaii.edu/t/why-after-grdblend-the-grid-spacing-changed/413). Should had mentioned that.

---

<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: [June 24, 2020, 1:30am UTC](https://forum.generic-mapping-tools.org/t/grdblend-problem/564/20 "2020-06-24T01:30:06Z")

</div>

Yes,but the spacing does’t influence my study,so I let it pass

[Next page](https://forum.generic-mapping-tools.org/t/grdblend-problem/564.md?page=2)
