Code covered by the BSD License  

Highlights from
Reading and Animating a NetCDF file of Sea Surface Temperature

Be the first to rate this file! 17 Downloads (last 30 days) File Size: 5.12 KB File ID: #26644
image thumbnail

Reading and Animating a NetCDF file of Sea Surface Temperature

by David Forstot

 

10 Feb 2010

Read, scale, and offset data in NetCDF file, animate to AVI

| Watch this File

File Information
Description

This script will step through the process of reading
data from a NetCDF file.

Missing Data, as flagged in the NetCDF file, will be
replaced with a NaN value (Not a Number).

Data is read from the file, and saved to the caller's
workspace. If the NetCDF provides data attributes
"scale_factor" and "add_offset" the script will first
scale and then offset the data.

For data that is 2 dimensional or higher, this script
will rotate it on import so it becomes row-major (the
MATLAB default) as apposed to column-major (the NetCDF
default). For 2D data this is taking the tranpose, for
3D or higher data, it is the equivalent of taking the
transpose of each data plane along the third dimension.

Data attributes are stored in a structure named with
the same name as the data but ending in "_info".

After reading the data, a separate function is called to
create an animated display of a subset of the data. It
creates an AVI video file of the animation and saves it
in the present directory.

NOTE: This is not a general solution for reading all
      NetCDF files. This is an example based on a single
      file and works for that file. It likely will not
      work for other formats.

MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
12 Nov 2011 marco c

good !

02 May 2012 John L

Nice but I think you have transposed the terms "row-major" and "column-major".

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
earth science David Forstot 25 Feb 2010 12:15:00
netcdf David Forstot 25 Feb 2010 12:15:00
animate David Forstot 25 Feb 2010 12:15:00

Contact us at files@mathworks.com