Bulk conversion of old GMT grd to modern NetCDF

Has anybody written a program or script to automate converting the older GMT grd files created by GMT 4 to the more modern NetCDF format used by GMT 6? I have no trouble reading the old grd files with GMT 6 (it calls the files “format: classic”), but GDAL and QGIS do not read the old files correctly. The gdalinfo command reports the old files as “NC_GLOBAL#Conventions=COARDS/CF-1.0” and the new NetCDF files created by GMT 6 as “NC_GLOBAL#Conventions=CF-1.7”. I have dozens or hundreds of files in the old format that I would like to convert.

Thanks, Eric F.

Hi Eric

Have you try grdconvert? In particulary the Format Identifier section.

Thanks, I had forgotten about the grdconvert command. It works well to convert one file to the new standard GMT6 NetCDF format without any extra format identification. I will still need to run it on each file separately.

Probably you know, but maybe you can create an script with a loop to convert all the files.