Grdblend problem!

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

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

why gmt can’t make it!

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.

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

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

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.

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

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.

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

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

Hi, 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.


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?

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.

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.

Better to post a link to the data.

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.

jluis at ualg.pt …

sent !!!!!!!!!!!!!!!!!!!!!!!

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

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

I bought a service so that I can link to googledrive

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. Should had mentioned that.

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