Re: How to change global attributes in a netCDF file

From: Kate Hedstrom <kate_at_nyahnyahspammersnyahnyah>
Date: Tue, 7 Mar 2006 13:19:10 -0900

On Tue, Mar 07, 2006 at 03:09:07PM -0700, Yongxin Zhang wrote:
> Hello,
>
> I need to make changes in START_DATE in my netCDF file and then
> write back to this file. Specifically, I need to do the following:
>
> Change from:
>
> :START_DATE = "2005-05-01_00:00:00"
>
> to:
>
> :START_DATE = "2005-06-01_00:00:00"
>
> Please let me know how I can do this or where I can find an
> example to do this.

I would do this with the NCO package, which contains ncatted:

% ncatted -h
ncatted [-a ...] [-D dbg_lvl] [-h] [-l path] [-O] [-o out.nc] [-p path] [-R] [-r] in.nc [[out.nc]]

-a, --attribute att_nm,var_nm,mode,att_typ,att_val Attribute specification:
                        mode = a,c,d,m,o and att_typ = f,d,l,s,c,b
-D, --dbg_lvl, --debug-level dbg_lvl Debugging level
-h, --hst, --history Do not append to "history" global attribute
-l, --lcl, --local path Local storage path for remotely-retrieved files
-o, --output, --fl_out fl_out Output file name (or use last positional argument)
-O, --ovr, --overwrite Overwrite existing output file, if any
-p, --pth, --path path Path prefix for all input filenames
-R, --rtn, --retain Retain remotely-retrieved files after use
-r, --revision, --vrs, --version Program version and copyright
notice
in.nc Input file name(s)
[out.nc] Output file name (or use -o switch)
Where to find more help on ncatted and/or NCO:
1. User's Guide/Reference Manual: http://nco.sf.net#RTFM
2. On-line reference manual for ncatted: http://nco.sf.net/nco.html#ncatted
3. UNIX man page: 'man ncatted'
4. Known problems: http://nco.sf.net#Bugs
5. Help Forum: http://sourceforge.net/forum/forum.php?forum_id=9830
Post questions, suggestions, patches at http://sf.net/projects/nco

-- 
Kate Hedström       Arctic Region Supercomputing Center
kate_at_arsc.edu       University of Alaska, Fairbanks
Phone: 907-450-8678
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 07 2006 - 15:19:10 MST

This archive was generated by hypermail 2.2.0 : Tue Mar 07 2006 - 16:44:45 MST