wavy.filtermod

Module Contents

Functions

filter_main(vardict_in[, varalias])

Governing function of filtermod

vardict_unique(vardict)

filter_slider(vardict, varalias, **kwargs)

rm_nan_from_vardict(varalias, vardict)

start_stop(a, trigger_val)

apply_land_mask(vardict, **kwargs)

Mask out parts covering land

apply_distance_to_coast_mask(vardict, **kwargs)

discards all values closer to shoreline than threshold

extract_geom_meta(country)

extract from each geometry the name of the country

get_coastline_shape_file([pathtofile])

Get the global coastline

distance_to_shore(lon, lat, coastline)

Compute distance to shore.

apply_limits(varalias, vardict)

square_data(varalias, vardict)

root_data(varalias, vardict)

apply_priorOp(varalias, vardict[, method])

apply_postOp(varalias, vardict[, method])

apply_cleaner(varalias, vardict[, method])

apply_smoother(varalias, vardict[, output_dates, ...])

Applies a smoother to the data

smoothing(varalias, vardict, output_grid, output_dates)

lanczos_weights(window, cutoff)

Calculate weights for a low pass Lanczos filter

smoother_lanczos(y, window, cutoff)

smoother_blockMean(dt, y, output_dates, date_incr[, mode])

smoother_blockCircMean(dt, y, output_dates, date_incr)

smoother_linearGAM(x, y, X, **kwargs)

smoother_expectileGAM(x, y, X, **kwargs)

smoother_GP(x, y, X, **kwargs)

smoother_NIGP(x, y, X, **kwargs)

cleaner_expectileGAM(x, y, **kwargs)

cleaner_linearGAM(x, y, **kwargs)

cleaner_GP(x, y, **kwargs)

Attributes

ROAR

variable_info

wavy.filtermod.ROAR
wavy.filtermod.variable_info
wavy.filtermod.filter_main(vardict_in, varalias='Hs', **kwargs)

Governing function of filtermod

Tasks:
  • check if prior/post transforms are needed

  • check if cleaning is needed

  • check if filter is needed

  • check if land mask is needed
    • if so apply cleaning/filters to subsets i.e. each chunk will be fed into filter_data and consolidated when finished with all chunks

Args:

vardict

Returns:

vardict

wavy.filtermod.vardict_unique(vardict)
wavy.filtermod.filter_slider(vardict, varalias, **kwargs)
wavy.filtermod.rm_nan_from_vardict(varalias, vardict)
wavy.filtermod.start_stop(a, trigger_val)
wavy.filtermod.apply_land_mask(vardict, **kwargs)

Mask out parts covering land

Args:

vardicy (dict)

Returns:

vardict, sea_mask

wavy.filtermod.apply_distance_to_coast_mask(vardict, **kwargs)

discards all values closer to shoreline than threshold between statement can be:

inclusive (“both”), exclusive (“neither”), left/right

wavy.filtermod.extract_geom_meta(country)

extract from each geometry the name of the country and the geom_point data. The output will be a list of tuples and the country name as the last element.

wavy.filtermod.get_coastline_shape_file(pathtofile=None, **kwargs)

Get the global coastline

wavy.filtermod.distance_to_shore(lon, lat, coastline)

Compute distance to shore.

Args:

lon, lat -> pd.dataFrame coastline -> shp

Returns:

numpy array of distances and country names

wavy.filtermod.apply_limits(varalias, vardict)
wavy.filtermod.square_data(varalias, vardict)
wavy.filtermod.root_data(varalias, vardict)
wavy.filtermod.apply_priorOp(varalias, vardict, method=None)
wavy.filtermod.apply_postOp(varalias, vardict, method=None)
wavy.filtermod.apply_cleaner(varalias, vardict, method='linearGAM', **kwargs)
wavy.filtermod.apply_smoother(varalias, vardict, output_dates=None, method=None, date_incr=None, **kwargs)

Applies a smoother to the data **kwargs includes method specific input for chosen method Methods are:

blockMean GP GAM Lanczos …

Caution: for some smoothers much more of time series has

to be included.

wavy.filtermod.smoothing(varalias, vardict, output_grid, output_dates, method='linearGAM', date_incr=None, **kwargs)
wavy.filtermod.lanczos_weights(window, cutoff)

Calculate weights for a low pass Lanczos filter

args:

window: (integer) the length of the filter window cutoff: (float) the cutoff frequency in inverse time steps

returns: weights

example: https://scitools.org.uk/iris/docs/v1.2/examples/

graphics/SOI_filtering.html

wavy.filtermod.smoother_lanczos(y, window, cutoff)
wavy.filtermod.smoother_blockMean(dt, y, output_dates, date_incr, mode='l')
wavy.filtermod.smoother_blockCircMean(dt, y, output_dates, date_incr, mode='l')
wavy.filtermod.smoother_linearGAM(x, y, X, **kwargs)
wavy.filtermod.smoother_expectileGAM(x, y, X, **kwargs)
wavy.filtermod.smoother_GP(x, y, X, **kwargs)
wavy.filtermod.smoother_NIGP(x, y, X, **kwargs)
wavy.filtermod.cleaner_expectileGAM(x, y, **kwargs)
wavy.filtermod.cleaner_linearGAM(x, y, **kwargs)
wavy.filtermod.cleaner_GP(x, y, **kwargs)