0

I am working with a NetCDF file that has multiple subsets and each subset has multiple bands. I would like to take one subset and export each of the 28 bands into its own GeoTIFF. I thought that gdal_translate could do this via the -sds flag, which is described in GDAL documentation as "Copy all subdatasets of this file to individual output files. Use with formats like HDF that have subdatasets", however I guess this doesn't carry over to bands as well. This command:

gdal_translate -of GTiff -s_srs epsg:4326 -a_nodata = 0.0 -sds NETCDF:"oscar_vel2020_180.nc”:u temp.tif

generates the terminal prompt >.

How might I export each of the bands from the subset of the NetCDF file into its own GeoTIFF?

1

First, I think you are getting the terminal prompt because you added a = in the commandline after -a_nodata. There should just be a space there.

Aside from that, you should be able to extract one of the bands from the subdataset "NETCDF:oscar_vel2020_180.nc:u" by using the -b switch in gdal_translate. Bands are numbered starting from 1 (see the documentation for more info).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.