You have a least a few ways to do it:
- GDAL command line utilities:
Since version 2.1 GDAL working fine (read and write) with raster and vector netCDF files. You can use both GDAL command line utilities (gdal_translate and gdalwarp) to reproject and output to GeoTiff format file.
gdal_translate -of GTiff -ot Float32 -a_srs "+proj=longlat +ellps=WGS84" input.nc output.tif
- Execute GDAL utility from Python scripts:
Here is some example:
def convert_netcdf_to_geotiff(infile, outfile, band_number=1, verbose=False):
with open(os.devnull, 'w') as devnull:
"gdal_translate", infile, outfile,
"-a_srs", "+proj=longlat +ellps=WGS84",
stdout=None if verbose else devnull
- Also, you can use GDAL utility in Docker container
If you don't want or can't install/build GDAL on your machine you can use prepared Docker images with GDAL 2.1 version or other versions with support netCDF driver.
There is one of the solutions:
docker run -v $(pwd):/data geodata/gdal gdal_translate -of GTiff -ot Float32 -a_srs "+proj=longlat +ellps=WGS84" input.nc output.tif