TECA
The Toolkit for Extreme Climate Analysis
teca_time_axis_convolution Class Reference

An algorithm that applies a convolution along the time axis. More...

#include <teca_time_axis_convolution.h>

Inheritance diagram for teca_time_axis_convolution:
Collaboration diagram for teca_time_axis_convolution:

Public Member Functions

std::shared_ptr< teca_time_axis_convolutionshared_from_this ()
 
std::shared_ptr< teca_time_axis_convolution const > shared_from_this () const
 
 teca_time_axis_convolution (const teca_time_axis_convolution &src)=delete
 
 teca_time_axis_convolution (teca_time_axis_convolution &&src)=delete
 
teca_time_axis_convolutionoperator= (const teca_time_axis_convolution &src)=delete
 
teca_time_axis_convolutionoperator= (teca_time_axis_convolution &&src)=delete
 
const char * get_class_name () const override
 
use_high_pass

When set the internally generated weights will be converted to a high_pass filter during weight generation. This option has no affect on user provided kernel weights.

void set_use_high_pass (const int &v)
 
const int & get_use_high_pass () const
 
kernel_width

The number of samples to use when generating kernel weights. This option has no affect on user provided kernel weights.

void set_kernel_width (const unsigned int &v)
 
const unsigned int & get_kernel_width () const
 
kernel_weights

Set the kernel weights explicitly. The number of weights defines the stencil width and must be odd for a centered stencil.

size_t get_number_of_kernel_weights ()
 
void append_kernel_weight (const double &v)
 
void set_kernel_weight (size_t i, const double &v)
 
void set_kernel_weights (const std::vector< double > &v)
 
void set_kernel_weights (const std::initializer_list< double > &&l)
 
const double & get_kernel_weight (size_t i) const
 
const std::vector< double > & get_kernel_weights () const
 
void clear_kernel_weights ()
 
int set_constant_kernel_weights (unsigned int width)
 generate constant convolution kernel weights with the given filter width More...
 
int set_gaussian_kernel_weights (unsigned int width, int high_pass=0, double a=1.0, double B=0.0, double c=0.55)
 
int set_kernel_weights (const std::string &name, unsigned int width, int high_pass)
 
kernel_name

set the name of the user provided kernel, or the kernel to generate.

void set_kernel_name (const std::string &v)
 
const std::string & get_kernel_name () const
 
variable_postfix

a string to be appended to the name of each output variable setting this to an empty string will result in the damped array replacing the input array in the output. default is an empty string ""

void set_variable_postfix (const std::string &v)
 
const std::string & get_variable_postfix () const
 
- Public Member Functions inherited from teca_algorithm
 teca_algorithm (const teca_algorithm &src)=delete
 
 teca_algorithm (teca_algorithm &&src)=delete
 
teca_algorithmoperator= (const teca_algorithm &src)=delete
 
teca_algorithmoperator= (teca_algorithm &&src)=delete
 
void set_communicator (MPI_Comm comm)
 
MPI_Comm get_communicator ()
 get the active communicator More...
 
virtual teca_algorithm_output_port get_output_port (unsigned int port=0)
 
void set_input_connection (const teca_algorithm_output_port &port)
 set an input to this algorithm More...
 
virtual void set_input_connection (unsigned int id, const teca_algorithm_output_port &port)
 set an input to this algorithm More...
 
virtual void remove_input_connection (unsigned int id)
 remove input connections More...
 
void clear_input_connections ()
 remove all input connections More...
 
const_p_teca_dataset get_output_data (unsigned int port=0)
 
void pop_cache (unsigned int port=0, int top=0)
 
void set_cache_size (unsigned int n)
 set the cache size. the default is 1. (threadsafe) More...
 
virtual int update ()
 execute the pipeline from this instance up. More...
 
virtual int update (unsigned int port)
 execute the pipeline from this instance up. More...
 
virtual teca_metadata update_metadata (unsigned int port=0)
 get meta data considering this instance up. More...
 
void set_executive (p_teca_algorithm_executive exe)
 set the executive More...
 
p_teca_algorithm_executive get_executive ()
 get the executive More...
 
virtual void to_stream (std::ostream &s) const
 
virtual void from_stream (std::istream &s)
 deserialize from the stream. More...
 
void set_verbose (const int &v)
 
const int & get_verbose () const
 

Static Public Member Functions

static p_teca_time_axis_convolution New ()
 

stencil_type

Select which time steps are convolved. The default stencil is backward.

enum  { backward, centered, forward }
 
void set_stencil_type (const int &v)
 
const int & get_stencil_type () const
 
void set_stencil_type_to_forward ()
 convolve with time steps after the active step More...
 
void set_stencil_type_to_backward ()
 convolve with time steps before the active step More...
 
void set_stencil_type_to_centered ()
 convolve with time steps centered on the active step More...
 
int set_stencil_type (const std::string &type)
 set the stencil type from a string More...
 
std::string get_stencil_type_name ()
 get the stencil as a string More...
 

Additional Inherited Members

- Protected Member Functions inherited from teca_algorithm
void set_number_of_input_connections (unsigned int n)
 
void set_number_of_output_ports (unsigned int n)
 
virtual void set_modified ()
 
void set_modified (unsigned int port)
 an overload to set_modified by port More...
 
virtual teca_metadata get_cache_key (unsigned int port, const teca_metadata &request) const
 
virtual teca_metadata get_output_metadata (teca_algorithm_output_port &current)
 
virtual const_p_teca_dataset request_data (teca_algorithm_output_port &port, const teca_metadata &request)
 
virtual int validate_cache (teca_algorithm_output_port &current)
 
virtual void clear_modified (teca_algorithm_output_port current)
 
const_p_teca_dataset get_output_data (unsigned int port, const teca_metadata &request)
 
int cache_output_data (unsigned int port, const teca_metadata &request, const_p_teca_dataset &data)
 
void clear_cache (unsigned int port)
 clear the cache on the given output port More...
 
unsigned int get_number_of_input_connections ()
 get the number of input connections More...
 
teca_algorithm_output_portget_input_connection (unsigned int i)
 
void clear_modified (unsigned int port)
 clear the modified flag on the i'th output More...
 
int get_modified (unsigned int port) const
 return the output port's modified flag value More...
 
- Protected Attributes inherited from teca_algorithm
int verbose
 

Detailed Description

An algorithm that applies a convolution along the time axis.

Supports constant, Gaussian, and explicitly provided convolution kernels of arbitrary width applied over forward, backward, or centered stencils.

A number of options are provided for specifying kernel weights.

  • User provided kernels can be explicitly specified via the combination of ::set_kernel_weights and ::set_kernel_name.
  • The kernel can be generated at run time by providing a kernel name, width, and flag selecting either a high or low pass filter via the combination of ::set_kernel_name, ::set_kernel_width, and ::set_use_high_pass. In this case default kernel parameters are used.
  • The kernel can be generated with explicitly provided kernel parameters.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
centered 

convolve with time steps before the active step

forward 

convolve with time steps centered on the active step

convolve with time steps after the active step

Member Function Documentation

◆ append_kernel_weight()

void teca_time_axis_convolution::append_kernel_weight ( const double &  v)
inline

append to the kernel_weight algorithm vector property

◆ clear_kernel_weights()

void teca_time_axis_convolution::clear_kernel_weights ( )
inline

clear the kernel_weight algorithm vector property

◆ get_class_name()

const char* teca_time_axis_convolution::get_class_name ( ) const
inlineoverridevirtual

returns the name of the class

Implements teca_algorithm.

◆ get_kernel_name()

const std::string& teca_time_axis_convolution::get_kernel_name ( ) const
inline

Get the value of the kernel_name algorithm property

◆ get_kernel_weight()

const double& teca_time_axis_convolution::get_kernel_weight ( size_t  i) const
inline

get the i-th element of the kernel_weight algorithm vector property

◆ get_kernel_weights()

const std::vector< double >& teca_time_axis_convolution::get_kernel_weights ( ) const
inline

get the kernel_weight algorithm vector property

◆ get_kernel_width()

const unsigned int& teca_time_axis_convolution::get_kernel_width ( ) const
inline

Get the value of the kernel_width algorithm property

◆ get_number_of_kernel_weights()

size_t teca_time_axis_convolution::get_number_of_kernel_weights ( )
inline

get the size of the kernel_weight algorithm vector property

◆ get_stencil_type()

const int& teca_time_axis_convolution::get_stencil_type ( ) const
inline

Get the value of the stencil_type algorithm property

◆ get_stencil_type_name()

std::string teca_time_axis_convolution::get_stencil_type_name ( )

get the stencil as a string

◆ get_use_high_pass()

const int& teca_time_axis_convolution::get_use_high_pass ( ) const
inline

Get the value of the use_high_pass algorithm property

◆ get_variable_postfix()

const std::string& teca_time_axis_convolution::get_variable_postfix ( ) const
inline

Get the value of the variable_postfix algorithm property

◆ New()

static p_teca_time_axis_convolution teca_time_axis_convolution::New ( )
inlinestatic

Returns an instance of teca_time_axis_convolution

◆ set_constant_kernel_weights()

int teca_time_axis_convolution::set_constant_kernel_weights ( unsigned int  width)

generate constant convolution kernel weights with the given filter width

◆ set_gaussian_kernel_weights()

int teca_time_axis_convolution::set_gaussian_kernel_weights ( unsigned int  width,
int  high_pass = 0,
double  a = 1.0,
double  B = 0.0,
double  c = 0.55 
)

generate Gaussian convolution kernel weights with the given filter width.

Parameters
[in]widththe number of samples in the generated kernel
[in]high_passtransform the weights for use in a high pass filter.
[in]apeak height of the Gaussian
[in]Bcenter of the Gaussian (note coordinates range from -1 to 1.
[in]cwidth of the Gaussian

◆ set_kernel_name()

void teca_time_axis_convolution::set_kernel_name ( const std::string &  v)
inline

Set the value of the kernel_name algorithm property

◆ set_kernel_weight()

void teca_time_axis_convolution::set_kernel_weight ( size_t  i,
const double &  v 
)
inline

set the i-th element of the kernel_weight algorithm vector property

◆ set_kernel_weights() [1/3]

void teca_time_axis_convolution::set_kernel_weights ( const std::initializer_list< double > &&  l)
inline

set the kernel_weight algorithm vector property

◆ set_kernel_weights() [2/3]

int teca_time_axis_convolution::set_kernel_weights ( const std::string &  name,
unsigned int  width,
int  high_pass 
)

set the kernel weights from a string name the kernel type. Default kernel weight generator parameters are used.

Parameters
[in]namethe name of the kernel to generate. (gaussian, or constant)
[in]widththe width of the kernel.
[in]high_passconvert the weights for use as a high pass filter.

◆ set_kernel_weights() [3/3]

void teca_time_axis_convolution::set_kernel_weights ( const std::vector< double > &  v)
inline

set the kernel_weight algorithm vector property

◆ set_kernel_width()

void teca_time_axis_convolution::set_kernel_width ( const unsigned int &  v)
inline

Set the value of the kernel_width algorithm property

◆ set_stencil_type() [1/2]

void teca_time_axis_convolution::set_stencil_type ( const int &  v)
inline

Set the value of the stencil_type algorithm property

◆ set_stencil_type() [2/2]

int teca_time_axis_convolution::set_stencil_type ( const std::string &  type)

set the stencil type from a string

◆ set_stencil_type_to_backward()

void teca_time_axis_convolution::set_stencil_type_to_backward ( )
inline

convolve with time steps before the active step

◆ set_stencil_type_to_centered()

void teca_time_axis_convolution::set_stencil_type_to_centered ( )
inline

convolve with time steps centered on the active step

◆ set_stencil_type_to_forward()

void teca_time_axis_convolution::set_stencil_type_to_forward ( )
inline

convolve with time steps after the active step

◆ set_use_high_pass()

void teca_time_axis_convolution::set_use_high_pass ( const int &  v)
inline

Set the value of the use_high_pass algorithm property

◆ set_variable_postfix()

void teca_time_axis_convolution::set_variable_postfix ( const std::string &  v)
inline

Set the value of the variable_postfix algorithm property

◆ shared_from_this() [1/2]

std::shared_ptr< teca_time_axis_convolution > teca_time_axis_convolution::shared_from_this ( )
inline

Enables the static constructor

◆ shared_from_this() [2/2]

std::shared_ptr< teca_time_axis_convolution const> teca_time_axis_convolution::shared_from_this ( ) const
inline

Enables the static constructor


The documentation for this class was generated from the following file: