CliMat – MATLAB

logo_climat_web

The Climate toolbox for Matlab (CliMat toolbox) is a collection of matlab functions for processing and analyze climate related data.This toolbox is essentially a revised and extended version of Manu’s RNT TOOLBOX.

 

 

 Toolbox structure

Every function follows this naming convection ct[type]_[fucntionname] [Type] may be one of the follow strings:

ext:  Extracting data (like NOOA SST, NCEP, etc, cmip5) from servers, mostly from our local servers. The data are loaded into the Matlab workspace.
ana: Any kind of analysis. For ex. Correlations, EOFs, Time_series,
Time and spatial Filtering, Statistics,…
plt: Visualization and plotting functions
rnc: Creanting files for ROMS (Grid, Input frc files from extracted data)
rnt: Working with ROMS input/output files

[Functionname] is the name of the fucntion

Few examples are shown in section 3

 

Visualization examples

Ex-1: Simple lon-lat map

>> SSTa

SSTa = 

 lon: [197x94 double]
 lat: [197x94 double]
 mask: [197x94 double]
 datenum: [1x768 double]
 desc: 'Celcius'
 clm: [197x94x12 double]
 ano: [197x94x768 double]
 trend: [197x94 double]

>> ctplt_map(SSTa.clm(:,:,1),SSTa)
>> title('Mean December SST ')

MeanSST

Ex-2: lon-lat field on a globe

>> ctplt_globe(SSTa.ano(:,:,192),SSTa,[-120,15])
>> caxis([-3 3])
>> gradsmap4
>> title 'SST anomaly for Dec 1997 [°C]'

sstonglobe

 

Ex-3: Plot ensemble mean and spread  

 

>> size(time), ans = 137 1 
>> size(TPi_std), 137 30
>> ctplt_ens(time,TPi_std)
>> datetick

plot_ens

 

Ex-4: Multiple (sub)plots with unique color bar

Ex-5: Correlations table plot

>> ctplt_tableplot(rand(6,9))

tableplot1

>> ctplt_tableplot(rand(2,3),{'Mod A','Mod B','Mod C'},{'Res 1','Res 2'})

tableplot2

 

Analysis examples

Ex-1: Power spectrum 

>> size(time), ans = 1942 1 
>> size(N34), ans = 1942 1
>> bands=[(1/(3*12)),(1/(8*12)),1/(30*12)];
>> [f,PS,Rlag1,rs,rs_f95,VB,nn_a]=ctana_spectrum(n34,5,1,bands);
% The function can make the plot below as output
plot_spectrum
 Ex-2: Running power spectrum
% This analysis is similar to a WAVELET 
>> size(time), ans = 1942 1 
>> size(N34), ans = 1942 1
>> [F,PS] = ctana_runspectrum(time, n34, 30*12, 1, 1);
>> size(F), ans = 180 34
>> size(PS), ans = 180 34
% The function generate the plot below as output if requested
runspectrum
 Ex-3: Compute and plot  CP/EP ENSO pattern and indices
%% Load data
ctext_2d_is_configured=0;
if ctext_2d_is_configured
    SST=ctext_2d('NOAA','ersstv3','SST',[1980 2010]);
else
    load  SST
end

%% Compute ENSO statistcs
ENSO=ctana_enso(SST);

%% PLOT ENSO
figure('pos',[247 158 861 531])
subplot(2,2,1)
ctplt_map(ENSO.CPp,ENSOl)
title 'CP-ENSO pattern',set(gca,'fontsize',16)
subplot(2,2,2)
ctplt_map(ENSO.EPp,ENSOl)
title 'EP-ENSO pattern',set(gca,'fontsize',16)
subplot(2,2,[3:4])
plot(ENSO.datenum,ENSO.NINOidx(:,5),'r','linewidth',2)
hold on
plot(ENSO.datenum,ENSO.NINOidx(:,3),'g','linewidth',2)
datetick, grid on, title(['NINO indices'])
legend({'NINO3.4','NINO3'}) , ylim([-2.3 2.3])
set(gca,'fontsize',16)

Try it yourself:  matlabicon Plot_ENSO.m    logomatrixmatlab_2 ERSSTv3_1980-2010.mat

                  Download latest version compression-while-saving

 

Matlab Directories

Matlab Files found in these Directories

ConvertXYT_into_ZT ctana_doEof2 ctana_submeso_filter ctplt_subplot1
ConvertXYT_into_ZT_v2 ctana_dtrend2d ctmisc_mean_grid_spacing ctplt_tableplot
ConvertZT_into_XYT ctana_enso ctplt_box daynoleap2datenum
Template_function ctana_explcorr ctplt_cbsubplot1 getpmap
cprintf ctana_explcorr2 ctplt_coast getpos
ctana_EPCPenso ctana_fourier2d ctplt_coastp gradsmap4
ctana_PMM_CEOF ctana_get_ts ctplt_contourfill logimap
ctana_PMM_MCA ctana_leadlag ctplt_ens medit_coast
ctana_RemoveIndex ctana_mom2seas ctplt_explcorr minmax
ctana_RemoveSeas ctana_mom2seasN ctplt_fill2c n2s
ctana_RemoveSeas2 ctana_red_signi ctplt_globe pcolorjw
ctana_YYYYMMDD2datenum ctana_reduceres ctplt_leadlag runmean
ctana_corr2d ctana_runmean ctplt_map subplot1
ctana_corrcoef ctana_runspectrum ctplt_map2  
ctana_correlation ctana_runstd ctplt_pmap  
ctana_date_datenum ctana_scorr ctplt_pmap2  
ctana_doEof ctana_spectrum ctplt_spread  

Generated on Sun 23-Apr-2017 21:52:06 by m2html © 2005