Examples: NetCDF & MatLAB ========================== These directories contain examples of MatLAB commands for reading, creating, and modifying NetCDF files. All the scripts use Chuck Denham's MatLAB package which can be obtained at: "MexCDF and NetCDF Toolbox For Matlab-5&6" http://woodshole.er.usgs.gov/staffpages/cdenham/public_html/MexCDF/nc4ml5.html and must first be installed. The NetCDF files generated here are intended for use with Ingrid: http://ingrid.mit.edu/ As a result, they approximately follow the simple COARDS convention which is described at: http://www.unidata.ucar.edu/packages/netcdf/conventions.html http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html The key items for the use of NetCDF files within Ingrid are: 1) Although coordinate names such as "lat", "lon", "latitude", etc. will work without any problems for plotting data, it seems that the names "X" and "Y" sould be preferred for the coordinate names so that calculations (eg. curl) can be applied to those data sets. For an example see: TRENBERTH_tau_mask/EH3_notes_mask.txt where both naming styles are used but the latter "X", "Y" naming scheme should be preferred. 2) In order to work with the Ingrid "plot land" option, dimensions should have units of "degree_east" and "degree_north" as, for example, specified by: nc{'X'}.units = 'degree_east'; nc{'Y'}.units = 'degree_north'; The actual dimension names (eg. "lat" or "Y") are unimportant. 3) It is generally a good idea to set the "gridtype" to 1 or 0 to indicate that the coordinate "wraps" or not. The gridtype attribute allows Ingrid to, for instance, plot longitudinal data over "wrapped" ranges such as -100 to 500deg. The attribute can be set using commands such as: nc{'X'}.gridtype = ncint(1); nc{'Y'}.gridtype = ncint(0); 4) Ingrid does seem to correctly handle the "_FillValue" attribute and it can be set using a MatLAB command such as: nc{ idu }.FillValue_ = ncdouble(-9999.0); [ Note how the "_" character is moved to the end of the attribute name since MatLAB cannot correctly handle variable names with a leading underscore. ]