how to manipulate a original nc file and save as a new nc file using nctoolbox

27 views
Skip to first unread message

Kuo-Hsien Chang

unread,
Apr 18, 2013, 8:45:19 AM4/18/13
to ncto...@googlegroups.com
Hello,

Are there anyone like to provide an example of how to manipulate/save nc file using nctoolbox?

I like to manipulate make "wetd" half (i.e., multiply 0.5) for all longitude and latitude, and then save as a new file called wetd_new.mon.nc.

Here is my file look like:

chang@mac1 : ~/Documents
$ ncdump -h wetd.mon.nc
netcdf wetd.mon {
dimensions:
longitude = 570 ;
latitude = 480 ;
level = 1 ;
lengthd = 10 ;
time = UNLIMITED ; // (12 currently)
variables:
short longitude(longitude) ;
longitude:units = "degrees_east" ;
short latitude(latitude) ;
latitude:units = "degrees_north" ;
short level(level) ;
level:units = "level" ;
int time(time) ;
time:units = "days since 1960-12-31" ;
short time_weights(time) ;
time_weights:units = "days" ;
char date(time, lengthd) ;
float wetd(time, level, latitude, longitude) ;
wetd:units = "days" ;
wetd:add_offset = 0. ;
wetd:scale_factor = 1. ;
wetd:valid_min = 0.f ;
wetd:valid_max = 26.483f ;
wetd:missing_value = -9999.f ;

// global attributes:
:title = "Wet Days (10 km resolution Lambert Conformal projection)." ;
:history = "Days > 0.1mm rain, per month.\n",
"This file created Fri Dec 22 15:12:03 2006" ;
}
chang@mac1 : ~/Documents


Thanks for your help.

Michael

Alexander Crosby

unread,
Apr 18, 2013, 11:33:13 AM4/18/13
to ncto...@googlegroups.com
Hello Michael, 

NCTOOLBOX does not yet support modification of files. It is a read only toolbox. We do have plans to incorporate editing and writing functionality in the future. Matlab includes (somewhat archaic) methods for opening and writing to netcdf files in its base installation. 

Alex



--
You received this message because you are subscribed to the Google Groups "nctoolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nctoolbox+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Mike McCann

unread,
Apr 18, 2013, 11:56:07 AM4/18/13
to ncto...@googlegroups.com
Look at snctools for writing netcdf files from Matlab. 

-Mike
Reply all
Reply to author
Forward
0 new messages