File Exchange

image thumbnail

Climate Data Toolbox for MATLAB

version 1.01 (108 MB) by Chad Greene
A set of low-level functions and tutorials for analyzing and displaying Earth science data.


Updated 14 May 2021

From GitHub

View Version History

View license on GitHub

This toolbox contains a standard set of MATLAB functions for analyzing and displaying climate data. The functions are computationally efficient, easy to use, and come with many tutorials that describe not only how to use CDT functions, but also offer guidance on how to interpret the results in the context of Earth science processes.

CDT logo illustration by Adam S. Nelsen (

Cite As

Chad A. Greene, Kaustubh Thirumalai, Kelly A. Kearney, José Miguel Delgado, Wolfgang Schwanghart, Natalie S. Wolfenbarger, Kristen M. Thyng, David E. Gwyther, Alex S. Gardner, and Donald D. Blankenship. The Climate Data Toolbox for MATLAB. Geochemistry, Geophysics, Geosystems 2019. doi:10.1029/2019GC008392

Comments and Ratings (67)

Justice Darko

Chad Greene

@Nick That's an interesting question. I don't have much experience working on remote servers, but your question seems general enough that someone on the Answers forum may be able to help. The issue isn't specific to this toolbox, and it should pertain to any files on the File Exchange.

Nicko Acks

Are there any instructions on how users using a central installation of matlab can install/use this toolbox? We don't really want to modify the default mathworks installation and our users tend to run with "-nodesktop" via remote ssh session (this is installed on a remote server, not on an individual desktop/workstation). The installation instructions only seem to reference installation via the desktop client add-ons. Thanks -Nick

Jakob Weis

Great piece of code. I added the functionality to specify a variable baseline as an alternative to a constant base value. I opened an 'issue' with a description and the adjusted code in the CDT GitHub repository:

Chad Greene

@Alessandro: Yes, the version of the trend function in this toolbox now includes the 'omitnan' option. If you have a previous version of the toolbox (or if you have the standalone version of the trend function found elsewhere on the File Exchange) be sure to delete those old versions, and it should work just fine.

Hi! A very nice and appealing toolbox! I was trying to apply the trend function for calculating sea level anomaly for the period 1993-2020. The matrix containing data has dimension 720x1440x366 (lat,lon,time), where 336 are the months in the studied period. The matrix contains a lot of Nans, especially in the higher latitudes. Is it correct to apply the trend function as follows in order to correctly calculate the trend taking into account in the proper manner the Nans?
[matrix_trend,p] = trend (matrix, 336, 'omitnan');

Thank you in advance.

Really helpful toolbox!
Line 89 and 92 in ts_normstrap should repmat first to match the size.

Maxime Hervo

Just amazing, thanks!

omid zandi

Zhong Ziqian



Ashneel Chandra

Chad Greene

@Laura: You are exactly right. I've fixed the error in the mann_kendall function. Thanks for tracking this down and letting me know!

Howard Labido

Just wondering, can I use it on common objects like used plastic bottles?
I have a waste treatment project where early detection and removal of certain waste is needed.

Hello Chad,
Thanks for this helpful toolbox!
I tried the 'mann_kendall' function and I obtained unusually high Z values for positive trends.
I checked the code and I saw that you multiply positive values by S to calculate Z:

Z(ind) = ((S(ind)-1)/StdS).*(S(ind));
Z(~ind) = (S(~ind)+1)/StdS;

In this way, positive trends are always significant. Is it a mistake?
Tank you.

John McDowell


Ahron Cervania

兆瑛 王

兆瑛 王


Faisal Amri

It did work! Thank you

Chad Greene

@César: Oh, I see! It helps that you included the error message and your release number! I think this is the issue: Something called implicit expansion was introduced in R2016b. Since you're using 2015a you'll need to change line 237 to

Ac = bsxfun(@plus,Ac,meanAr);

Hope that helps.

Hello Chad, I am trying to obtain climatology from 3D model data and I am obtaining the following error using climatology:
timec 4015x1 32120 double
usc 367x512x4015 6035476480 double
[us_clim,tc] = climatology(usc,timec', 'daily');
Error using +
Matrix dimensions must agree.

Error in climatology (line 237)
Ac = Ac + meanAr;

I tried to run the example for Pacific Ocean SST and the script produces the same error! I am using MATLAB Version: (R2015a)

Omar Nawaz

Ze Meng

Min Li

Andreas Reul

Thank you for the very helpfull toolbox!!!!!!!.
An example for complex EOF or something similar for current U and V EOF would be helpfull,

Darwin Cai

Carrie Merritt

Vince Clementi

Ashneel Chandra


Can I use this eof function for doing Complex EOF analysis (for wind vector) by just providing the input in complex form (U +iV).
My interest is in doing eof analysis for wind vector.

Ricardo Chevarria

Wentao Lv

Sandy Herho

jy Li


li xin

Thanks so much for this toolbox

Chad Greene

@S: Thanks for the note! The globefill function solves the issue of transparent globes.


Hi Chad,
Thanks for this helpful toolbox
I think the globeborders function is not working as intended, the surface seems to be transparent and shows the borders on the otherside of the hemisphere as well.

YI Chen

Naomi Krauzig

Hi2world Chu

Naomi Krauzig

Clare Ostle

Brian Haynes

How does the EOF program handle cyclic data at the poles? There is a large value discontinuity at the Prime Meridian, even when addressing the boundary condition prior to using the function, and the equal-area gridding used with datasets like CFSR, NCEP-NCAR, etc means the concentraion of data increaes with latitude.

Nicole Paloschi

jianzu hu


Mthetho Sovara

Shahar Grossbard

Leo Huang

shravan patil



Nick Hitt

Sina Khatami


Thank you so much Chad. I managed to get the updated version of trend fuction

Chad Greene

@Franck: That should work fine as long as the input t is a 1D array of length 288. If you type

cdt deseason

do you have any trouble running the examples?

Feel free to send me a personal email if you have a simple example I can run to recreate the problem.

Franck Eitel

@chad: this is the dimension of slp 33x17x288 (lon,lat,time)

Chad Greene

@Franck: What are the dimensions of the slp grid, and what are the dimensions of the time array?

Franck Eitel

Nice Job/toolbox Chad.
I would like to know how can I use deseason to remove seasonal cycles from the 3d grid slp(lon,lat,time) dataset.
I have tried to follow up your instruction but didn't succeed "Error: length of t must match dimensions of

Fernan Saenz


Aidan Starr

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: climanomaly, COVID19, Ice Shelf Melt Rates

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!