Dr Thomas E. Cropper
  • About
  • Publications
  • Climate Data
    • North Atlantic Oscillation
    • Code
  • Useful Links
  • Blog
    • Online Blog Contributions
  • About
  • Publications
  • Climate Data
    • North Atlantic Oscillation
    • Code
  • Useful Links
  • Blog
    • Online Blog Contributions

Theil-Sen & Mann-Kendall Trend/Significance Test

This MATLAB code builds on existing packages "TheilSen" and "Mann_Kendall_Modified" to produce Theil-Sen trend estimates and Mann-Kendall significance estimates for 1 to n time-series. Just make sure the TheilSen.m and Mann_Kendall_Modified.m files are in your working directory/on the path, then run the tsmk.m script with whatever data you want to use stored in the variable 'data' (or just change tsmk.m line 1 so that it reads in your data).

Have your data in the format column 1 = time, column 2 to n = data, without headers. For the output, "slopes" = the trend rate, "trendlines" = the trendlines, "trend_significance" = the significance of the trendline (Hamed and Rao, 1998 method). You can alter 

The code also provides modified confidence intervals based on the Foster and Rahmstorf (2011) paper method.
​
A version which works on 3d netcdf data is available upon request.


tsmk2.m
File Size: 3 kb
File Type: m
Download File


Tension Spline

 This R code applies a spline to monthly and generates a daily series from it. The daily series generated is such that the average of the monthly values will equal the monthly input. This was used in Cropper et al. 2015 to normalise the daily North Atlantic Oscillation index. Thanks to Halldór Björnsson from the Icelandic Met Office for providing the original code. 

To use, define the variable 'mondata' as a vector of length 12, where the values correspond to the monthly values. The code generates an image of the spline and a csv file to the working directory with the daily data in.
tensionspline.r
File Size: 1 kb
File Type: r
Download File

Powered by
✕