[gdal-dev] Extract subdataset from netCDF in a given directory

Andre Joost andre+joost at nurfuerspam.de
Thu Sep 11 07:39:11 PDT 2014


Am 10.09.2014 20:02, schrieb VictoriaH:
> Hello, I am using gdal_translate to extract a subdataset from a netCDF file
> to a geotiff. If I run the command from the same directory where the netCDF
> file is located, there is no problem:
>
> Filename: PM25_2001_02_average.nc
>
> Ex. gdal_translate -of GTiff HDF5:"PM25_2001_02_average.nc"://Data
> /var/www/pm25/netCDF/output.tif'
>
> However, if I try to run gdal-translate and point to a netCDF file in a
> different directory, I get an error:
>
> Ex. gdal_translate -of GTiff
> /netCDF/files/HDF5:"PM25_2001_02_average.nc"://Data
> /tiff/files/pm25/netCDF/output.tif'
>

I am not sure about your syntax at ://Data. This worked for me:

gdal_translate -a_srs EPSG:4326 -a_ullr -180 -90 180 90 -of "Gtiff" 
HDF4_SDS:UNKOWN:"LISOTD_HRFC_V2.3.2013.hdf":0 test.tif

with all files in the same directory. You have to run gdalinfo first to 
get the exact name of the subdataset including the number after the :
The output filename needs to be separated by a blank.

HTH
André Joost




More information about the gdal-dev mailing list