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

Andre Joost andre+joost at nurfuerspam.de
Thu Sep 11 07:58:17 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'
>

According to http://www.gdal.org/frmt_hdf5.html, the syntax should be:

HDF5:file_name:subdataset

So it has little use to put the path before the HDF5:. I'm not sure if 
GDAL accepts the path before the file_name. Running the command in the 
same folder should be a safe thing. The output file might go to another 
folder.

HTH,
André Joost



More information about the gdal-dev mailing list