Data Resources: Display and Analysis tools that read PSD's netCDF files


There are many plotting/analysis packages that can read and manipulate our netCDF files. Select a program to see links and examples of how to use them.

FERRET GrADS ncBrowse
NCL (NCAR Command Language) IDL NCO (netCDF Operator)
CDAT (Climate Data Analysis Tools) Panoply IDV (Integrated Data Viewer)
MATLAB

There is also a contributed version of the ncdump utility that understands the UDUNITS dates in our files and translates them to a human readable output.

List of packages:

 
*FERRET
FERRET is a freely available visualization and analysis tool from the Pacific Marine Environment Laboratory. FERRET commands similar to these should read the file and produce a plot:
yes? use "uwnd.mean.nc"
yes? !Use only the first time step for this plot
yes? set region/l=1
yes? contour uwnd
 
*GrADS
The Graphic Analysis and Display System (GrADS), developed at COLA, is also freely available. GrADS has a SDF (Self Describing File) interface that can read a netCDF or HDF (Scientific Data Sets) file that is compatible with the COARDS netCDF conventions.
To create a plot in GrADS use commands similar to these:
ga-> sdfopen uwnd.mean.nc
Scanning self-describing file: uwnd.mean.nc
Found displayable variable uwnd with 0 levels in SDF file.
Data file uwnd.mean.nc is open as file 1
LON set to 0 360
LAT set to -89 89
LEV set to 0 0
Time values set: 1980:1:1:0 1980:1:1:0
ga-> d uwnd
 
*IDL
IDL is a commercial software package from RSI which can also read our netCDF files. In IDL 4.0 (or later), commands similar to these should work:
IDL. Version 4.0.1b (sunos sparc).
Copyright 1989-1996, Research Systems, Inc.
All rights reserved. Unauthorized reproduction prohibited.
Installation number: 1627-1.
Licensed for use by: Climate Diagnostics Center
% Compiled module: $MAIN$.
IDL> id=ncdf_open("/Datasets/coads1a.enh/sst.mean.nc")
IDL> sstid=ncdf_varid(id,"sst")
IDL> ncdf_varget,id,sstid,sst
IDL> contour,sst(*,*,1)
*IDV 
IDV is a meteorologically oriented, platform-independent application for visualization and analysis, developed using Java VisAD and other component libraries, that emphasizes interactive 3D visualization and integration of diverse data types, including COARDS netCDF files from PSD IDV was developed at Unidata as part of the Metapps Project. See the IDV homepage for information on how to install IDV on your platform. If you have Java WebStart installed you can launch IDV here. In IDV:
The data source appears in the IDV's Data Selector window. Right-click on the data source name; click on Select Times in the pop-up menu that appears, and in it click off the chackbox Use all. Then select a range of times to display with the vertical slider bar and Shift-clicks on the end times of the range. (Many PSD data sets have thousands of time steps and are too large to load all at once.) After you select the time, choose the field and display type you want by clicking on them. Then click the Create Display button. There are details about using the PSD THREDDS catalog to read our data with IDV in the IDV users guide.
 
*ncBrowse
ncBrowse is a pure Java desktop application that can create graphical displays and view the attributes of our netCDF files.
 
*Panoply
Panoply is a GUI netCDF data viewer from NASA/GISS. It plots maps and zonal averages and is easy to use. It's free and available for Mac, Windows or Linux.
*NCL 
NCL, the NCAR Command Language, is a freely available software package from NCAR which can read our NetCDF files as well. Here is a sequence of commands that should work:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
f = addfile("slp.2002.nc", "r")
slp =short2flt(f->slp) ; convert to float [contributed.ncl]
wks =gsn_open_wks("ps", "slp_ce") ; open a "x11", "ps" or "ncgm" file
plot=gsn_csm_contour_map_ce(wks, slp(0, :, :), False) ; create a default ce plot
For unpacked files in our collection, the line with "short2flt" in it should be changed to "slp=f->slp".
Further examples of NCL use are available.
 
*NCO
NCO is a (free) suite of programs that operate on netCDF files. Each operator is a standalone, command line program which is executed at the UNIX (or NT) shell-level like, e.g., ls or mkdir. The operators take netCDF or HDF4 files as input, then perform a set of operations (e.g., deriving new data, averaging, hyperslabbing, or metadata manipulation) and produce a netCDF file as output. The operators are primarily designed to aid manipulation and analysis of gridded scientific data. These tools are a powerful and easy way to perform simple manipulations on netCDF files without a major programming effort.

For example: The command:

ncrcat 85.nc 86.nc 87.nc 88.nc 89.nc 8589.nc
concatenates the 4 files along the record (time in this case) dimension and creates one single file
 
*CDAT 
CDAT Climate Data Analysis Tools (CDAT) is a software system designed to provide access to and management of gridded climate data. It uses an object-oriented scripting language to link together separate software subsystems and packages thus forming an integrated environment for solving model diagnosis problems. The power of the system comes from Python and its ability to seamlessly interconnect software. Python provides a general purpose and full-featured scripting language with a variety of user interfaces including command-line interaction, stand-alone scripts (applications) and graphical user interfaces (GUI). The modular CDAT subsystems provide access to the data, to large-array numerical operations (via Numerical Python), and visualization.
  *MATLAB
MATLAB is a high-level language and interactive environment w/extensive plotting and numerical processing available. See http://mexcdf.sourceforge.net/ for the MEXNC interface to netCDF files.
Example As for examples using the NetCDF toolbox utilities: to quickly read a netcdf file:
ncload(SSTdata.nc,'SST','lat','lon')

Using the NETCDF_toolbox:  Writing a netcdf file

function x = write_ndvar_netcdf(fname,dimname,dim,var,varname,vardesc,desc);

% dimname,dim,var,varname,vardesc are CELL arrays of, respecively,
% the dimension names, dimensions, values, names and descriptions of the variables.
%
% Example:
% dimname = {'time','lat','lon'};
% dim = {time,lat,lon};
% varname={'Pg','Pt','Ptg'}% var={Zg,Zt,Ztg};
% vardesc={'PRECIP GOGA','PRECIP TOGA','PRECIP average'}
% dd='CCM3 AMIP runs';
% fname='trend.nc'
% write_ndvar_netcdf(fname,dimname,dim,var,varname,vardesc,dd);


if length(var) ~= length(varname)
  disp('Error:  var and varname must be cell arrays of the same length')
end
if length(dimname) ~= length(dim)
  disp('Error:  dim and dimname must be cell arrays of the same length')
end
if (~iscell(var) | ~iscell(varname))
  disp('Error:  var and varname must be cell arrays of the same length')
end

% save as a netcdf file
nc = netcdf(fname, 'clobber');              % Create NetCDF file.
nc.description = desc;                      % Global att
nc.date = date

;for k = 1:length(dim) 
 nc(dimname{k}) = length(dim{k}); % Define dimensions.
 nc{dimname{k}} = dimname{k};     % Define lat-lon variables and output the data
 nc{dimname{k}}(:) = dim{k};                        
end

for k = 1:length(var);
 nc{ varname{k} } = dimname;
 nc{ varname{k} }(:) = var{k};
 nc{ varname{k} }.description = vardesc{k};
end

nc = close(nc);                                      % Close the file.