Converting nc files to geotiff. Is it still possible?

Aloha.

After a long hiatus working on other things, I’m back to gmt6.

I am trying to convert a *.nc file output from surface to a geotiff but don’t seem to be able to do that anymore with gdal or ogr2ogr. Either my memory (and code) are flaky or things have changed with gdal/ogr.

Can anyone advise me as to the current state-of-play in the conversion wars? None of my old methods seem to work.

J.

Recent versions of GDAL no longer read the older GMT NetCDF grid formats. I found that I had to use GMT to read some of my older grids and save them again to get GMT to write them into a modern NetCDF file that GDAL can read. An easy trick is to use “grdmath oldGrd 1 MUL = newGrd”.

2 Likes

Does

gdal_translate file.nc file.tif

Or

gmt grdconvert file.nc -Gfile.tif=gdal:GTIFF

work?

Or write the grid directly in geotiff
https://docs.generic-mapping-tools.org/dev/surface.html#g

it’s -Gfile.tif=gd:GTiff, not -Gfile.tif=gdal:GTIFF

1 Like

Right, sorry.

Mahalo for the replies. I’ll try them all.
J.

Negative. Does not work.

grdconvert works.