Display and Analysis tools that read PSL's netCDF files
There are multiple plotting/analysis packages that can read and manipulate our netCDF files. Select a program to see links and examples of how to use them. We do not warranty any of this information, nor do we generally offer help with using any of these tools.
|NCL: NCAR Command Language||IDL||NCO: netCDF Operator|
|CDAT: Climate Data Analysis Tools||Panoply||IDV: Integrated Data Viewer|
List of packages:
a freely available
visualization and analysis tool from the
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
The Graphic Analysis
and Display System (GrADS), developed/supported at
COLA/George Mason U, 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
CF 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
a commercial software package from
ITT Visual Information Solutions which can also read
our netCDF files.
In IDL 4.0 (or later), commands similar to these should work:
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)
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 CF netCDF files from PSL. IDV is developed at UCAR's
Unidata Program Center. 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.
Publicly available PSL datasets are available through the PSL THREDDS catalog which is linked from the main IDV catalog in the Catalog Chooser under Community Data Servers. Select the dataset you want to load. Once it is loaded the data source appears in the IDV's Field Selector window. You can subset the times for the entire dataset or an individual display. To select times for the entire dataset, right-click on the data source name; click on Properties in the pop-up menu that appears. In the Times tab in the Properties dialog, click off the checkbox "Use Default". Then select a range of times to use. You can right click on the times to get some predefined options, or select the starting time and Shift-click on the end time of the range you want. (Many PSL 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. Alternatively, you can select the times for a particular variable in the Times tab of the Data Subset panel in the lower right portion of the Field Selector. Then click the Create Display button. For more information, see the IDV Users Guide.
- ncBrowse is a pure Java desktop application that can create graphical displays and view the attributes of our netCDF files.
- 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, 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:
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" fil plot=gsn_csm_contour_map_ce(wks, slp(0, :, :), False) ; create a default ce plot
Further examples of NCL use are available.
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
- 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.
is a high-level language
and interactive environment w/extensive plotting and numerical processing
available. NetCDF support is built in for versions MATLAB 7.7 and beyond. For
versions prior to that one, you can use
for the MEXNC interface to netCDF files. NetCDF-4 support starts with
Higher Level NetCDF Code
% MATLAB script to inquire about variable names and read in all variables % from a netcdf file. Uses native netcdf support in MATLAB % % Usage: % oid='myfile.nc'; % nc_readall % % Warning: this reads in variables and assigns them to the same variable name in MATLAB as in the netcdf file % does not handle udunits, so time coordinate typically needs to be modified for use in MATLAB. % % oid file name or URL to a netcdf file f = ncinfo(oid); nvars = length(f.Variables); for k = 1:nvars varname=f.Variables(k).Name; disp(['Reading: ' varname]); eval([varname ' = ncread(''' oid ''',''' varname ''');']); end
Native NetCDF code
oid='https://psl.noaa.gov/thredds/dodsC/Datasets/noaa.ersst/sst.mnmean.nc' sst=double(ncread(oid,'sst')); nlat=double(ncread(oid,'lat')); nlon=double(ncread(oid,'lon')); mv=ncreadatt(oid,'/sst','missing_value'); sst(find(sst==mv))=NaN; [Nlt,Nlg]=meshgrid(nlat,nlon); %Plot the SST data without using the MATLAB Mapping Toolbox figure pcolor(Nlg,Nlt,sst(:,:,1));shading interp; load coast;hold on;plot(long,lat);plot(long+360,lat);hold off colorbar %Plot the SST data using the MATLAB Mapping Toolbox figure axesm('eqdcylin','maplatlimit',[-80 80],'maplonlimit',[0 360]); % Create a cylindrical equidistant map pcolorm(Nlt,Nlg,sst(:,:,1)) % pseudocolor plot "stretched" to the grid load coast % add continental outlines plotm(lat,long) colorbar oid = 'https://psl.noaa.gov/thredds/dodsC/Datasets/NARR/Monthlies/monolevel/prate.mon.mean.nc' prate=ncread(oid,'prate'); nlat=double(ncread(oid,'lat')); nlon=double(ncread(oid,'lon')); scale = ncreadatt(oid,'/prate','scale_factor'); offset = ncreadatt(oid,'/prate','add_offset'); mv=double(ncreadatt(oid,'/prate','missing_value')); mv = double(mv*scale+offset); prate(find(prate>=mv))=NaN; %Plot the NARR precipitation data using the MATLAB Mapping Toolbox figure axesm('robinson','Frame','on','Grid','on','maplatlimit',[0 88],'maplonlimit',[150 0],'MeridianLabel','on','ParallelLabel','on'); pcolorm(nlat,nlon,log(prate(:,:,1))) % pseudocolor plot "stretched" to the grid load coast % add continental outlines plotm(lat,long) colorbar figure axesm('ortho','Grid','on','Frame','on','Origin',[40,250,14],'maplatlimit',[0 88],'maplonlimit',[150 0]); % Create a cylindrical equidistant map pcolorm(nlat,nlon,log(prate(:,:,1))) % pseudocolor plot "stretched" to the grid load coast % add continental outlines plotm(lat,long) colorbar
- Reading NetCDF in Excel
- Reading NetCDF in ArcGIS. NetCDF ArcGIS Tutorial.
- Reading NetCDF in R
library(ncdf4) name="/Datasets/noaa.ersst.v5/sst.mnmean.nc" ncin <- nc_open(name) lon <- ncvar_get(ncin,"lon") head(lon) sst <- ncvar_get(ncin,dname) dname <- "sst"
- Reading NetCDF in Python
import netCDF4 import numpy as np f = netCDF4.Dataset('/Datasets/noaa.ersst.v5/sst.mnmean.nc') print(f.variables.keys()) # get all variable names sst = f.variables['sst'] # sst variable time = f.variables['time'] print(time)
- The OriginPro Application is a commercial graphing and analysis software package from OriginLab. Version 2021b (9.85) and later supports import, graphing and analysis of NetCDF files in a point-and-click GUI environment. Users can easily import and reduce NetCDF files by partial import or averaging, and perform matrix stats, subtraction, simple math, and linear fit along the time axis. Shapefile-based ROI averaging is supported to create time axis profiles. Contour and image plots can be created to explore the data.