Thanks Daniel, It is not clear to me how the -mo flag works. You may be right, but it also sounded like you could use it to subset the data. I can use -b of course, but this only takes numbers. I'm dealing with NetCDF files that can have hundreds or thousands of bands. So querying the metadata would be a lot easier than going through and finding the band numbers (I've done that in one set).
If there is no way to query the band metadata directly in gdal_translate, my plan B is to work on a Python script that will parse through the gdalinfo output, query the metadata and return the associated band numbers. This is more work of course, so I'm trying to see if there is an easier way. Michael On Jun 12, 2012, at 8:45 PM, Daniel Victoria wrote: > Hi Michael, > > Are you sure you should use the -mo flag? Because it looks like that > flag is for setting metadata to the output. > > Since gdal considers each time step in a NetCDF dataset a band, have > you tried using the -b switch, for selecting the band you are > interested in? > > Cheers > Daniel > > On Tue, Jun 12, 2012 at 12:37 AM, Michael Barton <michael.bar...@asu.edu> > wrote: >> This is a question for any gdal experts out there. >> >> I'm working with reading NetCDF files. gdal does an admirable job of this. >> Many of the NetCDF climate data files have many bands and I'd like import >> only some of them. Specifying a particular NetCDF SUBSET will allow gdal to >> read the data for a particular variable. >> >> For example, ... >> >> gdal_translate >> NETCDF:"/Users/cmbarton/Dropbox/NCAR_files/ppt_A1.SRESA1B_EA1-8.CCSM.atmm.2000-01_cat_2099-12.nc":ppt >> /Users/cmbarton/Dropbox/NCAR_files/out.tif >> >> ...will translate all of the data sets for the ppt (precipitation) variable >> >> AFAICT, the -mo flag in gdal_translates also allows it to operate on a >> subset of data specified by a metadata option. But I can't figure out the >> proper syntax to use it. There are hints in >> <http://www.gdal.org/frmt_netcdf.html>, but the exact way to specify >> relevant metadata still eludes me. It seems like to translate only the bands >> for which the time variable = 730015.5 days after 1-01-01, I need to run... >> >> gdal_translate -mo ppt#NETCDF_DIMENSION_time=730015.5 >> NETCDF:"/Users/cmbarton/Dropbox/NCAR_files/ppt_A1.SRESA1B_EA1-8.CCSM.atmm.2000-01_cat_2099-12.nc":ppt >> /Users/cmbarton/Dropbox/NCAR_files/out.tif >> >> But this ignores the -mo specification and simply translates all bands. >> >> So does anyone know how to specify the metadata for time in this case? >> >> Thanks >> Michael >> >> _____________________ >> C. Michael Barton >> Visiting Scientist, Integrated Science Program >> National Center for Atmospheric Research & >> University Consortium for Atmospheric Research >> 303-497-2889 (voice) >> >> Director, Center for Social Dynamics & Complexity >> Professor of Anthropology, School of Human Evolution & Social Change >> Arizona State University >> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu >> >> >> >> >> >> >> _______________________________________________ >> grass-user mailing list >> grass-user@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/grass-user >> _____________________ C. Michael Barton Visiting Scientist, Integrated Science Program National Center for Atmospheric Research & University Consortium for Atmospheric Research 303-497-2889 (voice) Director, Center for Social Dynamics & Complexity Professor of Anthropology, School of Human Evolution & Social Change Arizona State University www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu _______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user