Sea Level Science (sls)

sls - A Matlab package for Sea Level Science


Updated 3 Jun 2023

From GitHub

View License on GitHub

sls - A Matlab Package for Sea Level Science

View sls on File Exchange

Package in constant development and subject to minimal testing - proceed with caution

See 'sls_example_usage' for a brief introduction to some of the functions

Syntax is sls.function() for base functions or for functions that are grouped (see below) e.g., sls.calc_tide(), sls.bodc.load()

Current functions:


remove_msl - removes mean sea level trends from sea level data

calc_tide - year by year or whole timeseries tidal harmonic analysis and tidal 
            reconstruction from inputted sea level data onto a 15 minute 
            temporal timeseries
calc_ncon_tide - tidal reconstruction from sea level data using the n-main 
                 consitutents gained from a tidal harmonic analysis of the
                 year with best data (coverage/amount)
high_low_water - calculates the high and low waters from given water level
                 or tide data.
tidal_phase -  calculates tidal phase, aka time to either nearest high or 
               low water for every timestep
rPOT - gains peaks over threshold (POT) values, using 'R largest' method
       with a storm window
POT_counts - counts peaks over threshold (POT) values, per specified 
             time period
skew_surge - calculates skew surge by using the high waters of a sinusoidal 
             tidal curve and calculating the difference in tidal (predicted) 
             high water and the actual high water around each sinusoidal peak
thresh_cross_del - for every group of consecutive values over a threshold, 
                   all but the max in the group are deleted (made nan)
time_above_thresh -  calculates time above threshold in hours with multiple 
time_between_exceedance_groups - for every group of consecutive values over 
                                 a threshold, get the time between each group


bodc.load - load UK National Tide Gauge Network data from files downloaded 
            from the British Oceanographic Data Centre (BODC)
bodc.flag_removal - remove flagged data from BODC

bodc.tide_gauge_info - get information about a specific tide gauge 
                       (name, ordnance datum, latitude, longitude)


cco.load_wav - load Channel Coast Observatory (CCO) qc wave data

cco.wav_flag_removal - removes flagged CCO qc wave data

cco.load_wl - load CCO qc water level data

cco.wl_flag_removal - removes flagged CCO qc water level data (replaces with nan)


plt.timeseries - plots variables and their associated times

plt.add_line - plots line variable to a open plot

plt.add_timeseries - plots variables and their associated times on a new plot 
                     or to a open plot on the next tile
plt.bin_xticklabels - creates binned xticklabels from n - n+1 variable: 
                      e.g., 2013, 2014, 2015 into 2013-2014, 2014-2015
plt.coverage_greyed - gives grey shading colours/alphas representative of the 
                      percentage of non-nan data over user-defined time periods 
                      within a timeseries
plt.font - changes font options (weight, size, and name) for a currently opened plot

plt.nxtile - calls nexttile() using a row,col positional input as opposed to a scalar

plt.rPOT - plots all exceedance events from rPOT

plt.time_between_exceedances - plots the time between each group of consecutive values 
                               over a threshold, with options to highlight the magnitude 
                               of each exceedance
plt.twogroup_stacked_hist - plots a histogram of a binned variable that is also stacked 
                            by a different grouping

Cite As

Luke Jenkins (2023). Sea Level Science (sls) (, GitHub. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

See release notes for this release on GitHub:


To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.