NCKS

The most useful NCO utility to use with OPeNDAP/DODS is NCKS. Basically it allows the user to retrieve a subset of the variables defined in a remote dataset, or even just a portion of a variable, and then save it to a local NetCDF file.

Example 5.1. Retrieving A Few Variables With NCKS

Suppose we are just interested in the temperature in the top layer of the CBLAST 2002-050 model run between the dates of July 1 and July 4, 2002. Here's the URL... http://queequeg.marine.rutgers.edu:9876/thredds/dodsC/roms/cblast/2002-050/averages.

Typing the following from the unix command line

$ ncks http://queequeg.marine.rutgers.edu:9876/thredds/dodsC/roms/cblast/2002-050/averages 
					

would try to squeeze the entire dataset thru the webserver on queequeg, which is over 6GB, so DON'T DO IT!!!

Typing the following from the unix command line

$ ncks -v lon_rho,lat_rho http://queequeg.marine.rutgers.edu:9876/thredds/dodsC/roms/cblast/2002-050/averages grid.nc
$ ls -al grid.nc
-rw-r--r--  1 jevans jevans 339636 Aug 24 15:07 grid.nc
$ ncdump -h grid.nc
netcdf grid {
dimensions:
	eta_rho = 130 ;
	xi_rho = 162 ;
variables:
	double lat_rho(eta_rho, xi_rho) ;
		lat_rho:long_name = "latitude of RHO-points" ;
		lat_rho:units = "degree_north" ;
		lat_rho:field = "lat_rho, scalar" ;
	double lon_rho(eta_rho, xi_rho) ;
		lon_rho:long_name = "longitude of RHO-points" ;
		lon_rho:units = "degree_east" ;
		lon_rho:field = "lon_rho, scalar" ;

		.
		.
		.
}
					

would retrieve just those two variables and save to a local netcdf file.

To get the sea surface height, we could try

$ ncks -d ocean_time,"2002-07-01 00:00:00","2002-07-04 00:00:00" -v zeta http://queequeg.marine.rutgers.edu:9876/thredds/dodsC/roms/cblast/2002-050/averages ssh.nc
$ ls -al ssh.nc
-rw-r--r--  1 jevans jevans 2024836 Aug 24 15:19 ssh.nc
$ ncdump -h ssh.nc
netcdf ssh {
dimensions:
	ocean_time = 24 ;
	eta_rho = 130 ;
	xi_rho = 162 ;
variables:
	double ocean_time(ocean_time) ;
		ocean_time:long_name = "averaged time since initialization" ;
		ocean_time:units = "seconds since 2001-01-01 00:00:00" ;
		ocean_time:calendar = "standard" ;
		ocean_time:field = "time, scalar, series" ;
	float zeta(ocean_time, eta_rho, xi_rho) ;
		zeta:long_name = "averaged free-surface" ;
		zeta:units = "meter" ;
		zeta:time = "ocean_time" ;
		zeta:coordinates = "lat_rho lon_rho" ;
		zeta:field = "free-surface, scalar, series" ;

// global attributes:	
	.
	.
	.
}