TECA
The Toolkit for Extreme Climate Analysis
teca_coordinate_util Namespace Reference

Codes dealing with operations on coordinate systems. More...

Classes

struct  equal_tt
 traits classes used to get default tolerances for comparing numbers of a given precision. More...
 
struct  equal_tt< float >
 
struct  equal_tt< double >
 
struct  equal_tt< long double >
 
struct  equal_error
 
struct  leq
 Less than or equal to predicate. More...
 
struct  geq
 Greater than or equal to predicate. More...
 
struct  lt
 Less than predicate. More...
 
struct  gt
 Greater than predicate. More...
 
struct  ascend_bracket
 comparator implementing bracket for ascending input arrays More...
 
struct  descend_bracket
 comparator implementing bracket for descending input arrays More...
 
struct  interpolate_t< 0 >
 Zero'th order interpolant specialization. More...
 
struct  interpolate_t< 1 >
 First order interpolant specialization. More...
 
class  teca_validate_arrays
 compares a set of arrays against a reference array More...
 
class  teca_coordinate_axis_validator
 Check that cooridnate arrays from different sources match a refrence array. More...
 

Typedefs

using spatial_extent_t = std::array< unsigned long, 6 >
 
using temporal_extent_t = std::array< unsigned long, 2 >
 

Functions

template<typename T >
bool equal (T a, T b, T relTol=equal_tt< T >::relTol(), T absTol=equal_tt< T >::absTol(), typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<typename T >
bool equal (T a, T b, T relTol=0, T absTol=0, typename std::enable_if< std::is_integral< T >::value >::type *=0)
 Compare two integral numbers. More...
 
template<typename T >
bool equal (T a, T b, std::string &diagnostic, T relTol=equal_tt< T >::relTol(), T absTol=equal_tt< T >::absTol(), typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<typename T >
bool equal (T a, T b, std::string &diagnostic, T relTol=0, T absTol=0, typename std::enable_if< std::is_integral< T >::value >::type *=0)
 
TECA_EXPORT bool equal (const const_p_teca_variant_array &array1, const const_p_teca_variant_array &array2, double absTol, double relTol, int &errorNo, std::string &errorStr)
 
template<typename data_t , typename bracket_t = ascend_bracket<data_t>>
TECA_EXPORT int index_of (const data_t *data, unsigned long l, unsigned long r, data_t val, bool lower, unsigned long &id)
 
template<typename T >
TECA_EXPORT int index_of (const T *data, size_t l, size_t r, T val, unsigned long &id)
 
TECA_EXPORT int bounds_to_extent (const double *bounds, const const_p_teca_variant_array &x, const const_p_teca_variant_array &y, const const_p_teca_variant_array &z, unsigned long *extent)
 
TECA_EXPORT int bounds_to_extent (const double *bounds, const const_p_teca_variant_array &x, unsigned long *extent)
 
TECA_EXPORT int bounds_to_extent (const double *bounds, const teca_metadata &md, unsigned long *extent)
 
template<typename coord_t >
TECA_EXPORT int bounds_to_extent (const double *bounds, const coord_t *px, unsigned long nx, unsigned long *extent)
 
template<typename T >
TECA_EXPORT int index_of (const const_p_teca_cartesian_mesh &mesh, T x, T y, T z, unsigned long &i, unsigned long &j, unsigned long &k)
 
TECA_EXPORT int time_step_of (const const_p_teca_variant_array &time, bool lower, bool clamp, const std::string &calendar, const std::string &units, const std::string &date, unsigned long &step)
 
TECA_EXPORT int time_to_string (double val, const std::string &calendar, const std::string &units, const std::string &format, std::string &date)
 
template<typename int_t >
TECA_EXPORT void get_table_offsets (const int_t *index, unsigned long n_rows, unsigned long &n_entities, std::vector< unsigned long > &counts, std::vector< unsigned long > &offsets, std::vector< unsigned long > &ids)
 
template<typename CT , typename DT >
TECA_EXPORT int interpolate_nearest (CT cx, CT cy, CT cz, const CT *p_x, const CT *p_y, const CT *p_z, const DT *p_data, unsigned long ihi, unsigned long jhi, unsigned long khi, unsigned long nx, unsigned long nxy, DT &val)
 
template<typename coord_t , typename data_t >
TECA_EXPORT int interpolate_nearest (coord_t cx, coord_t cy, const coord_t *p_x, const coord_t *p_y, const data_t *p_data, unsigned long ihi, unsigned long jhi, unsigned long nx, data_t &val)
 
template<typename CT , typename DT >
TECA_EXPORT int interpolate_linear (CT cx, CT cy, CT cz, const CT *p_x, const CT *p_y, const CT *p_z, const DT *p_data, unsigned long ihi, unsigned long jhi, unsigned long khi, unsigned long nx, unsigned long nxy, DT &val)
 
template<typename CT , typename DT >
TECA_EXPORT int interpolate_linear (CT cx, CT cy, const CT *p_x, const CT *p_y, const DT *p_data, unsigned long ihi, unsigned long jhi, unsigned long nx, DT &val)
 
TECA_EXPORT int validate_centering (int centering)
 return 0 if the centering is one of the values defined in teca_array_attributes More...
 
template<typename num_t >
TECA_EXPORT int convert_cell_extent (num_t *extent, int centering)
 convert from a cell extent to a face, edge or point centered extent More...
 
TECA_EXPORT int get_cartesian_mesh_extent (const teca_metadata &md, unsigned long *whole_extent, double *bounds)
 
TECA_EXPORT int get_cartesian_mesh_bounds (const const_p_teca_variant_array x, const const_p_teca_variant_array y, const const_p_teca_variant_array z, double *bounds)
 get the mesh's bounds from the coordinate axis arrays More...
 
template<typename num_t >
TECA_EXPORT int covers_ascending (const num_t *whole, const num_t *part)
 
template<typename num_t >
TECA_EXPORT int covers (const num_t *whole, const num_t *part)
 
template<typename num_t >
TECA_EXPORT int same_orientation (const num_t *whole, const num_t *part)
 
TECA_EXPORT int clamp_dimensions_of_one (unsigned long nx_max, unsigned long ny_max, unsigned long nz_max, unsigned long *extent, bool verbose)
 
TECA_EXPORT int validate_extent (unsigned long nx_max, unsigned long ny_max, unsigned long nz_max, unsigned long *extent, bool verbose)
 
template<typename T , size_t N>
std::vector< T > as_vector (const std::array< T, N > &arr)
 converts a std::array to a std:vector More...
 
template<typename T , size_t N>
std::array< T, N > as_array (const std::vector< T > &vec)
 converts a std::vector to a std::array More...
 
template<typename T >
spatial_extent_t as_spatial_extent (const std::vector< T > &vec)
 
template<typename T >
spatial_extent_t as_temporal_extent (const std::vector< T > &vec)
 
template<typename T >
spatial_extent_t as_spatial_extent (const T arr[6])
 
TECA_EXPORT int split (spatial_extent_t &block_1, spatial_extent_t &block_2, int split_dir, unsigned long min_size)
 
TECA_EXPORT int partition (const spatial_extent_t &extent, unsigned int n_blocks, int split_x, int split_y, int split_z, unsigned long min_size_x, unsigned long min_size_y, unsigned long min_size_z, std::deque< spatial_extent_t > &blocks)
 
TECA_EXPORT int partition (const temporal_extent_t &temporal_extent, long n_temporal_blocks, long temporal_block_size, std::vector< temporal_extent_t > &temporal_blocks)
 
TECA_EXPORT int find_extent_containing_step (long step, const std::vector< std::pair< long, long >> &step_extents, long &index)
 
template<typename coord_t >
TECA_EXPORT coord_t & intersect_tiles (coord_t &int_tile, const coord_t &left_tile, const coord_t &right_tile)
 
template<typename coord_t >
TECA_EXPORT bool empty_tile (const coord_t &tile)
 

Variables

template<int >
struct TECA_EXPORT interpolate_t
 A functor templated on order of accuracy for above Cartesian mesh interpolants. More...
 

Detailed Description

Codes dealing with operations on coordinate systems.

Typedef Documentation

◆ spatial_extent_t

using teca_coordinate_util::spatial_extent_t = typedef std::array<unsigned long, 6>

a copy-assignable type for 3D Cartesian index space extents of the form: [i0, i1, j0, j1, k0, k1]

◆ temporal_extent_t

using teca_coordinate_util::temporal_extent_t = typedef std::array<unsigned long, 2>

a copy-assignable type for temporal index space extents of the form: [t0, t1]

Function Documentation

◆ as_array()

template<typename T , size_t N>
std::array<T,N> teca_coordinate_util::as_array ( const std::vector< T > &  vec)

converts a std::vector to a std::array

◆ as_spatial_extent() [1/2]

template<typename T >
spatial_extent_t teca_coordinate_util::as_spatial_extent ( const std::vector< T > &  vec)

converts a vector holding a Cartesian index space extent of the form [i0, i1, j0, j1, k0, k1] to a spatial_extent_t

◆ as_spatial_extent() [2/2]

template<typename T >
spatial_extent_t teca_coordinate_util::as_spatial_extent ( const T  arr[6])

converts an array holding a Cartesian index space extent of the form [i0, i1, j0, j1, k0, k1] to a spatial_extent_t

◆ as_temporal_extent()

template<typename T >
spatial_extent_t teca_coordinate_util::as_temporal_extent ( const std::vector< T > &  vec)

converts a vector holding a time extent of the form [t0, t1] to a temporal_extent_t

◆ as_vector()

template<typename T , size_t N>
std::vector<T> teca_coordinate_util::as_vector ( const std::array< T, N > &  arr)

converts a std::array to a std:vector

◆ bounds_to_extent() [1/4]

TECA_EXPORT int teca_coordinate_util::bounds_to_extent ( const double *  bounds,
const const_p_teca_variant_array x,
const const_p_teca_variant_array y,
const const_p_teca_variant_array z,
unsigned long *  extent 
)

Convert bounds to extents in three dimensions.

Parameters
[in]boundsthe 3D spatial bounding box [x0, x1, y0, y1, z0, z1]
[in]xthe x-coordinate array
[in]ythe y-coordinate array
[in]zthe z-coordinate array
[out]extentthe resulting 3D extent [i0, i1, j0, j1, k0, k1]
Returns
non-zero if the requested bounds are not in the given coordinate arrays.
Note
the x,y and z coordinate arrays must not be empty.

◆ bounds_to_extent() [2/4]

TECA_EXPORT int teca_coordinate_util::bounds_to_extent ( const double *  bounds,
const const_p_teca_variant_array x,
unsigned long *  extent 
)

Convert bounds to extents in one dimension.

Parameters
[in]boundsthe 1D spatial bounding box [x0, x1]
[in]xthe x-coordinate array
[out]extentthe resulting 1Dextent [i0, i1]
Returns
non-zero if the requested bounds are not in the given coordinate arrays.
Note
the coordinate array must not be empty.

◆ bounds_to_extent() [3/4]

template<typename coord_t >
TECA_EXPORT int teca_coordinate_util::bounds_to_extent ( const double *  bounds,
const coord_t *  px,
unsigned long  nx,
unsigned long *  extent 
)

Convert bounds to extents in one dimension.

Parameters
[in]boundsthe 1D spatial bounding box [x0, x1]
[in]pxpointer to the coordinate array
[in]nxthe size of the coordinate array
[out]extentthe resulting 1D extent [i0, i1]
Returns
non-zero if the requested bounds are not in the given coordinate arrays.

◆ bounds_to_extent() [4/4]

TECA_EXPORT int teca_coordinate_util::bounds_to_extent ( const double *  bounds,
const teca_metadata md,
unsigned long *  extent 
)

Convert bounds to extents in three dimensions.

Parameters
[in]boundsthe 3D spatial bounding box [x0, x1, y0, y1, z0, z1]
[in]mda metadata object containing coordinate information as defined by the teca_cf_reader
[out]extentthe resulting 3D extent [i0, i1, j0, j1, k0, k1]
Returns
non-zero if the requested bounds are not in the given coordinate arrays.
Note
the x,y and z coordinate arrays must not be empty.

◆ clamp_dimensions_of_one()

TECA_EXPORT int teca_coordinate_util::clamp_dimensions_of_one ( unsigned long  nx_max,
unsigned long  ny_max,
unsigned long  nz_max,
unsigned long *  extent,
bool  verbose 
)

where array dimensions specified by nx_max, ny_max, and nz_max are 1, and the extent would be out of bounds, set the extent to [0, 0]. If verbose is set, a warning is reported when the extent was clamped in one or more directions. The return is non zero if any direction was clamped and 0 otherwise.

◆ convert_cell_extent()

template<typename num_t >
TECA_EXPORT int teca_coordinate_util::convert_cell_extent ( num_t *  extent,
int  centering 
)

convert from a cell extent to a face, edge or point centered extent

◆ covers()

template<typename num_t >
TECA_EXPORT int teca_coordinate_util::covers ( const num_t *  whole,
const num_t *  part 
)

Check that one Cartesian region covers the other, taking into account the order of the coordinates. assumes that the regions are specified in the same orientation.

◆ covers_ascending()

template<typename num_t >
TECA_EXPORT int teca_coordinate_util::covers_ascending ( const num_t *  whole,
const num_t *  part 
)

Check that one Cartesian region covers the other coordinates must be in ascending order. assumes that both regions are specified in ascending order.

◆ empty_tile()

template<typename coord_t >
TECA_EXPORT bool teca_coordinate_util::empty_tile ( const coord_t &  tile)

returns true if the 2D Cartesian tile is empty. An empty tile has for any dimension the low coordinate larger than the high coordinate

◆ equal() [1/5]

TECA_EXPORT bool teca_coordinate_util::equal ( const const_p_teca_variant_array array1,
const const_p_teca_variant_array array2,
double  absTol,
double  relTol,
int &  errorNo,
std::string &  errorStr 
)

Compare two variant arrays elementwise for equality. If the arrays fail to compare within the specified tolerance errorNo will contain one of the equal_error enumerations and errorStr will conatin a diagnostic message describing the failure.

◆ equal() [2/5]

template<typename T >
bool teca_coordinate_util::equal ( a,
b,
std::string &  diagnostic,
relTol = 0,
absTol = 0,
typename std::enable_if< std::is_integral< T >::value >::type *  = 0 
)

Compare two integral numbers. This overload may be used in regression tests or other contexts where a diagnostic error message should be reported if the numbers are not equal.

◆ equal() [3/5]

template<typename T >
bool teca_coordinate_util::equal ( a,
b,
std::string &  diagnostic,
relTol = equal_tt<T>::relTol(),
absTol = equal_tt<T>::absTol(),
typename std::enable_if< std::is_floating_point< T >::value >::type *  = 0 
)

Compare two floating point numbers. This overload may be used in regression tests or other contexts where a diagnostic error message should be reported if the numbers are not equal.

◆ equal() [4/5]

template<typename T >
bool teca_coordinate_util::equal ( a,
b,
relTol = 0,
absTol = 0,
typename std::enable_if< std::is_integral< T >::value >::type *  = 0 
)

Compare two integral numbers.

◆ equal() [5/5]

template<typename T >
bool teca_coordinate_util::equal ( a,
b,
relTol = equal_tt<T>::relTol(),
absTol = equal_tt<T>::absTol(),
typename std::enable_if< std::is_floating_point< T >::value >::type *  = 0 
)

Compare two floating point numbers. absTol handles comparing numbers very close to zero. relTol handles comparing larger values.

◆ find_extent_containing_step()

TECA_EXPORT int teca_coordinate_util::find_extent_containing_step ( long  step,
const std::vector< std::pair< long, long >> &  step_extents,
long &  index 
)

Given a time step and a vector of step extents find the index of the extent that contains the step.

Parameters
[in]stepthe step to find
[in]step_extentsan ordered list of time step extents [t0, t1]
[out]indexthe index into the vector pointing to the extent that contains the step.
Returns
non-zero if the step was not contained by any of the extents

◆ get_cartesian_mesh_bounds()

TECA_EXPORT int teca_coordinate_util::get_cartesian_mesh_bounds ( const const_p_teca_variant_array  x,
const const_p_teca_variant_array  y,
const const_p_teca_variant_array  z,
double *  bounds 
)

get the mesh's bounds from the coordinate axis arrays

◆ get_cartesian_mesh_extent()

TECA_EXPORT int teca_coordinate_util::get_cartesian_mesh_extent ( const teca_metadata md,
unsigned long *  whole_extent,
double *  bounds 
)

Given Cartesian mesh metadata extract whole_extent and bounds if bounds metadata is not already present then it is initialized from coordinate arrays. It's an error if whole_extent or coordinate arrays are not present. return zero if successful.

◆ get_table_offsets()

template<typename int_t >
TECA_EXPORT void teca_coordinate_util::get_table_offsets ( const int_t *  index,
unsigned long  n_rows,
unsigned long &  n_entities,
std::vector< unsigned long > &  counts,
std::vector< unsigned long > &  offsets,
std::vector< unsigned long > &  ids 
)

build random access data structures for an indexed table. the index column gives each entity a unique id. the index is used to identify rows that belong in the entity. it is assumed that an entity occupies consecutive rows. the returns are: n_entities, the number of entities found; counts, the number of rows used by each entity; offsets, the starting row of each entity; ids, a new set of ids for the entities starting from 0

◆ index_of() [1/3]

template<typename T >
TECA_EXPORT int teca_coordinate_util::index_of ( const const_p_teca_cartesian_mesh &  mesh,
x,
y,
z,
unsigned long &  i,
unsigned long &  j,
unsigned long &  k 
)

Get the i,j,k cell index of point x,y,z in the given mesh. return 0 if successful.

◆ index_of() [2/3]

template<typename data_t , typename bracket_t = ascend_bracket<data_t>>
TECA_EXPORT int teca_coordinate_util::index_of ( const data_t *  data,
unsigned long  l,
unsigned long  r,
data_t  val,
bool  lower,
unsigned long &  id 
)

binary search that will locate index bounding the value above or below such that data[i] <= val or val <= data[i+1] depending on the value of lower. return 0 if the value is found. the comp0 and comp1 template parameters let us operate on both ascending and descending input. defaults are set for ascending inputs.

◆ index_of() [3/3]

template<typename T >
TECA_EXPORT int teca_coordinate_util::index_of ( const T *  data,
size_t  l,
size_t  r,
val,
unsigned long &  id 
)

binary search that will locate index of the given value. return 0 if the value is found.

◆ interpolate_linear() [1/2]

template<typename CT , typename DT >
TECA_EXPORT int teca_coordinate_util::interpolate_linear ( CT  cx,
CT  cy,
const CT *  p_x,
const CT *  p_y,
const DT *  p_data,
unsigned long  ihi,
unsigned long  jhi,
unsigned long  nx,
DT &  val 
)

1st order (linear) interpolation for nodal data on stretched Cartesian mesh. This overload implements the special case where both source and target data are in a 2D x-y plane using fewer operations than the general 3D implementation. cx, cy, cz is the location to interpolate to p_x, p_y, p_z array arrays containing the source coordinates with extents [0, ihi, 0, jhi, 0, khi] p_data is the field to interpolate from val is the result returns 0 if successful, an error occurs if cx, cy, cz is outside of the source coordinate system

◆ interpolate_linear() [2/2]

template<typename CT , typename DT >
TECA_EXPORT int teca_coordinate_util::interpolate_linear ( CT  cx,
CT  cy,
CT  cz,
const CT *  p_x,
const CT *  p_y,
const CT *  p_z,
const DT *  p_data,
unsigned long  ihi,
unsigned long  jhi,
unsigned long  khi,
unsigned long  nx,
unsigned long  nxy,
DT &  val 
)

1st order (linear) interpolation for nodal data on stretched Cartesian mesh. This overload implements the general 3D case. cx, cy, cz is the location to interpolate to p_x, p_y, p_z array arrays containing the source coordinates with extents [0, ihi, 0, jhi, 0, khi] p_data is the field to interpolate from val is the result returns 0 if successful, an error occurs if cx, cy, cz is outside of the source coordinate system

◆ interpolate_nearest() [1/2]

template<typename coord_t , typename data_t >
TECA_EXPORT int teca_coordinate_util::interpolate_nearest ( coord_t  cx,
coord_t  cy,
const coord_t *  p_x,
const coord_t *  p_y,
const data_t *  p_data,
unsigned long  ihi,
unsigned long  jhi,
unsigned long  nx,
data_t &  val 
)

0th order (nearest neighbor) interpolation for nodal data on a stretched Cartesian mesh. This overload implements the special case where both source and target mesh data are in a 2D x-y plane using fewer operations than the general 3D implementation. cx, cy, cz is the location to interpolate to p_x, p_y, p_z array arrays containing the source coordinates with extents [0, ihi, 0, jhi, 0, khi] p_data is the field to interpolate from val is the result returns 0 if successful, an error occurs if cx, cy, cz is outside of the source coordinate system

◆ interpolate_nearest() [2/2]

template<typename CT , typename DT >
TECA_EXPORT int teca_coordinate_util::interpolate_nearest ( CT  cx,
CT  cy,
CT  cz,
const CT *  p_x,
const CT *  p_y,
const CT *  p_z,
const DT *  p_data,
unsigned long  ihi,
unsigned long  jhi,
unsigned long  khi,
unsigned long  nx,
unsigned long  nxy,
DT &  val 
)

0th order (nearest neighbor) interpolation for nodal data on a stretched Cartesian mesh. This overload implements the general 3D case. cx, cy, cz is the location to interpolate to p_x, p_y, p_z array arrays containing the source coordinates with extents [0, ihi, 0, jhi, 0, khi] p_data is the field to interpolate from val is the result returns 0 if successful, an error occurs if cx, cy, cz is outside of the source coordinate system

◆ intersect_tiles()

template<typename coord_t >
TECA_EXPORT coord_t& teca_coordinate_util::intersect_tiles ( coord_t &  int_tile,
const coord_t &  left_tile,
const coord_t &  right_tile 
)

Computes the intersection of two 2D Cartesian tiles. If the intersection is empty the low coordinate is above the high coordinate. The tiles are specified in the form [i0, i1, j0, j1].

Parameters
[out]int_tilethe intersection
[in]left_tilethe first of the tiles to intersect
[in]right_tilethe second of the tiles to intersect
Returns
a reference to the intersection

◆ partition() [1/2]

TECA_EXPORT int teca_coordinate_util::partition ( const spatial_extent_t extent,
unsigned int  n_blocks,
int  split_x,
int  split_y,
int  split_z,
unsigned long  min_size_x,
unsigned long  min_size_y,
unsigned long  min_size_z,
std::deque< spatial_extent_t > &  blocks 
)

given an input extent, partition it in into a set of n disjoint blocks of approximately the same size covering the input extent.

Parameters
[in]extentthe Cartesian iondex space extent top partition
[in]n_blocksthe desired numberof partitions
[in]split_xif zero skip splitting in the x-direction
[in]split_yif zero skip splitting in the y-direction
[in]split_zif zero skip splitting in the z-direction
[in]min_size_xsets the minimum block size in the x-direction
[in]min_size_ysets the minimum block size in the y-direction
[in]min_size_zsets the minimum block size in the z-direction
[out]blocksthe set of n blocks covering the input extent
Returns
0 if the input extent could be partitioned into the requested number of blocks.

◆ partition() [2/2]

TECA_EXPORT int teca_coordinate_util::partition ( const temporal_extent_t temporal_extent,
long  n_temporal_blocks,
long  temporal_block_size,
std::vector< temporal_extent_t > &  temporal_blocks 
)

Given an inclusive range of time steps [step_0 step_1] partition it into a set of disjoint blocks covering the input range. The partitioning algorithm is controled by either specifying the number of blocks or the block size. Set one of these parameters to the desired value and the other parameter to 0.

Parameters
[in]temporal_extentthe temporal extent to partition
[in]n_temporal_blocksthe desired number of blocks or 0 if specifying the block size. Note: the block size that was used is returned by the block_size argument.
[in]temporal_block_sizethe desired size of the blocks or 0 if specifying the number of blocks.
[out]temporal_blocksthe partitioning

@retruns 0 if the partitioning was successful.

◆ same_orientation()

template<typename num_t >
TECA_EXPORT int teca_coordinate_util::same_orientation ( const num_t *  whole,
const num_t *  part 
)

check that two Cartesian regions have the same orientation ie they are either both specified in ascending or descending order.

◆ split()

TECA_EXPORT int teca_coordinate_util::split ( spatial_extent_t block_1,
spatial_extent_t block_2,
int  split_dir,
unsigned long  min_size 
)

split block 1 into 2 blocks in the d direction. block1 is modified in place and the new block is returned in block 2. return 1 if the split succeeded and 0 if it failed.

◆ time_step_of()

TECA_EXPORT int teca_coordinate_util::time_step_of ( const const_p_teca_variant_array time,
bool  lower,
bool  clamp,
const std::string &  calendar,
const std::string &  units,
const std::string &  date,
unsigned long &  step 
)

given a human readable date string in YYYY-MM-DD hh:mm:ss format and a list of floating point offset times in the specified calendar and units find the closest time step. return 0 if successful see index_of for a description of lower, if clamp is true then when the date falls outside of the time values either the first or last time step is returned.

◆ time_to_string()

TECA_EXPORT int teca_coordinate_util::time_to_string ( double  val,
const std::string &  calendar,
const std::string &  units,
const std::string &  format,
std::string &  date 
)

given a time value (val), associated time units (units), and calendar (calendar), return a human-readable rendering of the date (date) in a strftime-format (format). return 0 if successful.

◆ validate_centering()

TECA_EXPORT int teca_coordinate_util::validate_centering ( int  centering)

return 0 if the centering is one of the values defined in teca_array_attributes

◆ validate_extent()

TECA_EXPORT int teca_coordinate_util::validate_extent ( unsigned long  nx_max,
unsigned long  ny_max,
unsigned long  nz_max,
unsigned long *  extent,
bool  verbose 
)

Return 0 if the passed extent does not exceed array dimensions specified in nx_max, ny_max, and nz_max. If verbose is set, an error is reported via TECA_ERROR when the extent would be out of bounds.

Variable Documentation

◆ interpolate_t

template<int >
struct TECA_EXPORT teca_coordinate_util::interpolate_t

A functor templated on order of accuracy for above Cartesian mesh interpolants.