Tree-Ring Matlab Toolbox
Description
Matlab is a commercial software package for numeric computation, graphics, visualization, and high-level programming. Matlab is available from The MathWorks, Inc. The basic Matlab package has many functions generally useful for tree-ring studies. Matlab "toolboxes" with specialized functions can also purchased from The MathWorks, Inc. Toolboxes are available for signal processing, mapping, image processing, neural networks, statistics, and many other topics.
The "Tree-Ring Toolbox" is not a commercially available Matlab toolbox, but is a collection of Matlab functions I have written to do various tasks in tree-ring analysis. For example, the function crn2vec2 reads an ITRDB-formatted ".crn" file and returns the site chronology, years, and sample size as matlab vectors.
Back to Top of Page
Requirements
To use the Tree-Ring Toolbox, you must have Matlab installed on your computer or network. I use the University of Arizona's Matlab site license, which has the most recent Matlab release. The functions may not work on older versions. Depending on which functions you intend to use, you may also need to have one or more Matlab "toolboxes" installed. The comment section of each function lists which toolboxes are required. I currently have 14 toolboxes installed, but you will not need most of those. Most commonly, my functions make use of these toolboxes: Curve Fitting, Statistics and Machine Learning, Signal Processing, System Identification.
To use the Tree-Ring Toolbox, you must its functions in a directory on your Matlab path. My functions usually call on other utility functions I wrote. The best method to be sure you don't call an "unknown" function is to download the whole set of Tree-Ring Toolbox functions. I have zipped these into a file File_pooled.zip, which you should unzip into a directory on your Matlab path. I recommend keeping those functions by themselves in a dedicated folder. Put that folder first on your Matlab path, so that no other functions you might have by the same name, or not obsolete versions of the same function, are used. Alternatively, move your data to the dedicated folder and run programs with that folder as the current working directory.
I distribute these function freely. I require no acknowledgement of the source. Go ahead and modify them as you wish. I welcome any comments on the functions in the function list. But due to time constraints, I cannot promise anything more than grudging cooperation in updating or correcting functions when I'm in the mood.
Back to Top of Page
Notation
To find out what's in the Tree-Ring Matlab Toolbox, check out the function list, , which give a brief description of what the function does. I suggest you read the comment section at the beginning of any function before using the function. My opening comments are organized as follows:
- function name with 1-line description
- syntax of the function call
- date of most recent revision
- extended description of what the function does
- Input requirements
- Output
- References
- UW Functions Called (other functions I wrote)
- Matlab toolboxes required (e.g., signal processing)
Among other things, the comment secti0ons defines the input and output arguments. I use a shorthand code for such data. The best way of describing this code is by way of example:
(1x1)r real number, scalar
(3x2)r matrix (3 x 2) of real numbers
(3x1)i column vector (3 elements) of integers
(1x8)s character string of length 8
(1x1)L logical scalar
Matlab also has data types called "cells" and "structures", which are best found out about by reading the Matlab documentation. My code for cells uses braces. For example,
the code below indicates a 1 x 3 "cell" variable containing a 2x2 integer matrix, a 1x5 character string and a 1x10 row vector of real numbers.
{1x3}
(2 x 2)i
(1 x 5)s
(1 x 10)r
Among the files included is seascorr, which has been published in Computers & Geosciences. A pdf of the paper and a zip of sample data are included for seascorr. Sample data are also included for function skelcrn.
Back to Top of Page
List of Functions
- Tree-ring and climate-data analysis
- climgram -- climogram of monthly mean precipitation and temperature
- grplot -- grouped plots of ring width series, one below the other
- lockdown -- graphical & statistic check of cross-dating of cores in rlw file or of ring-width series with site chronology
- seascorr -- identify seasonal climatic signal in annual tree-ring series
- skelcrn -- skeleton plot from chronology (e.g., crn file) or ring-width series
- IO, formatting and plotting of tree-ring data
- crn2vec2 -- crn file to column vectors of index, sample size, and year
- rwlids1 -- check core ids in an rwl file and build a renaming template
- rwlids2 -- substitue ids in an rwl file
- rwlids3 -- high-grade an overloaded mat file of ring widths; first of two function (second is rwlids4) used to high-grade a collection
of measured ring widths to emphasize long, highly intercorrelated series
and evenness of sample coverage.
- rwlids4 -- trim an rwl file by deleting indicated series.
- rwl2tsm --convert .rwl file to time series matrix
- rwlinp --- load rwl series as indexed vector into Matlab
- tsplotss1 --time series plots of sample size from two sets of ring widths (for comparison of two chronologies)
- tsplotss2 --- Time series plot of 2 alternative site chronologies from matrices of core indices (for comparison of two chronologies)
- IO and formatting of climate data
- c132tss --thirteen-column monthly climate matrix to time-series structure
- Time series analysis
- acf -- autocorrelation function and confidence limits
- akaike --akaike information criterion for fitting AR models
- arspectrum -- spectrum of an AR(1) or AR(2) process
- corrdiff -- test difference of two non-zero sample correlation coefficients
- corrone -- product-moment correlation of one variable with several others (vector with columns of a matrix)
- mafilt1 -- evenly-weighted moving average of an annual time series
- mannken1 -- Mann-Kendall nonparametric test for trend
- pdgmraw -- raw periodogram of a time series
- pdgmsim -- exact simulation of Gaussian time series from its periodogram
- quenouille --confidence interval for cross-correlation of autocorrelated series
- specbt1 -- spectrum of a single time series by Blackman Tukey method
- sseff -- effective (adjusted for autocorrelation) sample size of a time series
- splinep -- spline smoothing parameter for a desired amplitude of frequency response at a specified wavelength (paramter in as define in Matlab curve fitting toolbox function csaps)
- whit1 -- fit an AR model to time series and prewhiten series with the model
- Utility: low level functions called by other functions
test that two independent correlations are estimates of the same population correlation
- eightplt -- eight plots on a page (used by grplot)
- figsize -- figure-window pixel positions from specified fractional screen-width and screen-height
- filter1 -- low-pass filter a time series using specified weights
- firstlst -- find first and last years of valid data in columns of a time series matrix
- intnan --check for imbedded NaN in a time series
- nonan1 --longest continuous block of a time series matrix without missing data
- menucell --menu for selecting elements of a cell array
- OStell --find out the operating system of the computer
- ranktie --get ranks for values in a time series that might contain ties
- rwchng --scaled values or first-difference of a time series (used by lockdown)
- rwread3 --reads a single .rw file (used by skelcrn)
- shiftcor --UNFINISHED function to be called by lockdown for the yet-to-be-implemented mode of searching for the best dating spot for a floating set of ring widths
- sov2tsm --convert strung-out-vector to time series matrix (used by rwlinp); this version does not handle names cell
- sov2tsm3 --convert strung-out-vector to time series matrix (used by rwlinp); this version handles names cell
- suplabel --places text as a title, xlabel, or ylabel on a group of subplots
- textcorn -- Add annotation text to any corner of a figure
- trailnan -- remove any trailing NaN from a time series
- trimnan -- remove any leading or trailing NaN from a time series
- wtsbinom -- weights for binomial filter with specified frequency response
- wtsgaus -- weights for Gaussian filter with specified frequency response
find first and last years of valid data in a time series matrix
Back to Top of Page