In case you are new to Matlab and start from scratch:
- Create a directory matlab in your root directory (e.g. Heidi should have done mkdir /home/cullen/matlab).
- Go to the new directory.
- Use the editor of your choice to create a new file startup.m.
- Add the line gerdstartup5 .
Download the file gerdstartup5.m and put it in your matlab directory. Start matlab and it should work.
Note: this will work on machines which have the directory /more/matlab from ocp.ldeo.columbia.edu mounted. Your system administrator should be able to help you, in case you can not find the directory. Currently they are available as described above on most linux boxes and all the SUNs of Lamont's computer network.
- Then add the line gerdstartup5 .
In case you already have a working startup.m file in your ~/matlab directory:
- Add the line described above to your startup.m .
In case you can not mount ocp's directory (that's the case for everybody outside of LDEO) you can now download the whole stuff. Be warned, it's 160MB. Why that much ? It includes the full coastline database used also in GMT ! Where to find it ? Here.
In case you can or do not want to download the big archive, you can now find an html listing and the code for a number of the m-files here.
Always try the help for any particular function before asking me ! And read it carefully !Conventions in my help and in my functions (this differs from the standard look and feel of Matlab help because I find it too messed up) :
- matrix / array refer to at least 2-dimensional data fields.
- vector refers to a 2-dimensional array (all data fields in Matlab have at least 2 dimensions!) with one singular dimension.
- If there is one argument called optionsor op it stands for a Matlab-structure. That is a variable with sub-variables. You can access the sub-variables via op.blabla1 and op.blabla2 but then refer to the whole thing via op . This greatly simplifies the handling of functions with lots of arguments.
- Brackets like [blabla]denote something optional or the default value.
You can find an html listing and the code for several of the following files here.
Graphics loammap Draw a nice map of scalars or vectors together with outlines of the continents. contourpm Draw a contour-plot differing between positive, zero and negative lines (color and b/w). errorbar2 Draw a line plot with error bars. In difference to standard Matlab this function allows bars in 2 directions. coledit Interactive tool to create a new color map. (see also the coledit home page ) exportfig Ever wondered how to get a figure on the paper with the same aspectratio as the one you had on the screen ? Try this function. It's supposed to handle that problem. (thanks Bruce!) colorbar3 Thinner colorbar with label. Draws only used contourlevels when applied to a contourf graph. stretch Change the distribution of colors within a colormap. E.g. if you want to concentrate the resolution into one end of the color range or if you want to concentrate it around 0. arrow Draws nice arrows (read the help carefully!). ceven Center color range around 0 Data manipulation nans Replaces elements in an array (e.g. replace -999 by NaN). remseason Remove seasonal cycle from an array or vector. Simple data analysis functions nmean / nmin / nmax
nmedian / nstd /ncumsum
nsumApplies the respective function to arrays despite NaN's. rms Calculates the root-mean-squared. binav Calculate bin-averages lastval Grab the last non-NaN number from an array (dimension can be specified) Complex data analysis functions objmap Do an objective analysis of your data. geteof Calculate EOFs (principal components). cancorr Do a canonical correlation analysis. getmssa Do MSSA lagcorr Do a (lagged) correlation. lagcov Calculate the (lagged) covariance. (also useful for calculating regressions) veccor Calculate the correlation between two vector series/maps. corrsig Calculate the significance of a correlation coefficient File handling readnc Load variables and attributes from a NetCDF file. Can load only parts of a variable ! ncload2 Like ncload (loads a variable from a NetCDF file), but replaces 'missing_value' by NaN hdrload Load an ASCII file which has a non numerical header. textread / dlmread Load mixed character/number ASCII files. save2cdf Save one variable with several attributes in a NetCDF file. Geophysical functions geowind Calculate geostrophic winds from SLP
last modified June 17th, 2004.
send comments and question to Gerd