NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Maybe someone has already mentioned NCL? http://www.ncl.ucar.edu/Applications/ Basically you just extract the variable and tell it what the fill value should be. Then you can use the "where" command to make more _FillValues where they are needed. a = addfile("netcdffile.nc","r") x=a->variable ; 3D Variable x!0 = "Time" x!1 = "lat" x!2 = "lon" . . . x@_FillValue = -9999 Assume you have a multi-dimensional numeric array x with a missing value (x@_FillValue). Use where to take the square root of x only at locations where x is positive, and set it to a missing value otherwise: xsqrt = where(x.gt.0,sqrt(x),x@_FillValue) http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml Erik Noble Center for Climate Systems Research, Columbia University NASA Goddard Institute for Space Studies 2880 Broadway, New York, NY-10025, USA Tel: +1 (212) 678-5512; Fax: +1 (212) 678-5552 E-mail: enoble@xxxxxxxxxxxxx, en2192@xxxxxxxxxxxx WEB: http://www.giss.nasa.gov/staff/enoble.html GISS: http://www.giss.nasa.gov CCSR: http://www.ccsr.columbia.edu _______________________________________________________ On Aug 12, 2011, at 2:01 PM, Lynnes, Christopher S. (GSFC-6102) wrote: > I have a netCDF file which is missing its _FillValue attributes. I know what > they are supposed to be, so is there a utility that will let me add them, or > do I need to write a piece of code to do it? Something like ncrename, but > where I can add attribute and value if not there? > -- > Dr. Christopher Lynnes NASA/GSFC, Code 610.2 phone: 301-614-5185 > > > _______________________________________________ > netcdfgroup mailing list > netcdfgroup@xxxxxxxxxxxxxxxx > For list information or to unsubscribe, visit: > http://www.unidata.ucar.edu/mailing_lists/ > > >
netcdfgroup
archives: