Proj4 work with grdproject problem

when run this code:

gmt grdproject AP_14636_FBD_F6850_RT1.dem.grd -J"+proj=utm +zone=58 +south +datum=WGS84 +units=m +no_defs +to+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" -C -F -Gtest123.grd

it will run forever and not return a result,why ?
I try to convert utm grid to wgs84 geodetic coordinates.
When I use this command:

gmt grdproject AP_14636_FBD_F6850_RT1.dem.grd -Ju-58/1:1 -C -Fe -I -GAP_14636_FBD_F6850_RT1.dem_Geodetic.grd

it can return a good look result,but also return an Error:
ERROR 1: PROJ: proj_create: Error -13: major axis or radius = 0 or not given

I browsed and it seemed to be caused by PROJ4,Thanks a lot!please help!

When I experiment with synthetic data I get this

gmt grdmath -R162/168/-10/0 -I0.1 X Y MUL = lixo.grd

gmt grdproject lixo.grd -J"+proj=utm +zone=58 +south +datum=WGS84 +units=m +no_defs" -Glixo_utm.grd

gmt grdproject lixo_utm.grd -I -J"+proj=utm +zone=58 +south +datum=WGS84 +units=m +no_defs" -Glixo_geo2.grd
First opt_R      164.000000000000/166.000000000000/-6.007148010123/-4.007148010123      1.71944e+09     3.71911e+08
Second opt_R     161.953987660797/-10.013533960436/168.046012339203/0.000000000000r
grdproject [WARNING]: Unknown conversion between GMT and GDAL ellipsoid names. Using a generic spherical body.

I find that warning worrisome and don’t get it why it’s complaining.

Your example also hangs for me (but it’s computing something).

Thanks for reply,I turned a another way,and it work well.

gdalwarp -t_srs EPSG:4326 -s_srs EPSG:32758 AP_15059_FBS_F6860_RT1.dem.tif AP_15059_FBS_F6860_RT1_Geodetic.dem.tif

As above,I use gdal directly,but I also want to konw why gmt return an error.

I will try to debug the source of that error message when I have time.

When I use gdalwarp,it can’t deal with the data in irreagular area.
The data in utm projection:

When I use gdalwarp(gdalwarp -t_srs EPSG:4326 -s_srs EPSG:32758 source.tif aim.tif)to get geodetic coordinates in WGS84:

Anyway,Thank you!Joaquim!

Strange that gdalwarp behavior. Note, your case is simple to do with the GMT syntax only. It should be something around (not sure how to set the suthern hemisphere (-Ju58S/1:1 ?)

gmt grdproject -I -C -F -R162/168/-10/0 -Ju-58/1:1 ...

@Mark I fixed the ellipsoid names issue (it was a silly bug while comparing text strings), but the other one is tougher. Possibly related to this

1 Like

Thanks a lot,Joaquim!

and another question:Why after grdblend ,the grid spacing changed?
Hope help! Big Thanks!