Development¶
Online Source Code Documentation¶
TECA’s C++ sources are documented via Doxygen at the TECA Doxygen site.
Class Indices¶
Tip
The following tables contain a listing of some commonly used TECA classes. The TECA Doxygen site is a more complete reference.
Algorithms¶
TECA’s suite of algorithms that can be inserted in functional pipelines. (For more details, click on the class name)
Class |
Description |
---|---|
An algorithm that computes the areas of labeled regions. |
|
Applies a mask to a given list of variables. |
|
Moves data from one mesh to anotehr using remapping weights generated by TempestRemap. |
|
The TECA BARD atmospheric river detector. |
|
An algorithm that constructs and serves up the parameter table needed to run the Bayesian AR detector. |
|
An algorithm that computes a binary segmentation. |
|
Transfers data between spatially overlapping meshes of potentially different resolutions. |
|
An algorithm that generates a teca_cartesian_mesh of the requested spatial and temporal dimensions with optional user defined fields. |
|
applies a subset given in world coordinates to the upstream request |
|
An algorithm that applies a mask based on connected component area. |
|
compute statistics about connected components |
|
an algorithm that computes connected component labeling |
|
compute the element wise difference between to datasets |
|
a programmable algorithm specialized for simple array based computations |
|
compute descriptive statistics over a set of arrays. |
|
Generates a mask indicating where mesh points with a vertical pressure coordinate lie above the surface of the Earth. The mask is set to 1 where data is above the Earth’s surface and 0 otherwise. |
|
An algorithm that evaluates an expression stores the result in a new variable. |
|
An algorithm that transforms from face to cell centering. |
|
Caches N datasets such that repeated requests for the same dataset are served from the cache. |
|
An algorithm that computes integrated vapor transport (IVT) |
|
An algorithm that computes integrated water vapor (IWV) |
|
An algorithm that computes L2 norm. |
|
An algorithm that computes the Laplacian from a vector field. |
|
Inverted Gaussian damper for scalar fields. |
|
an algorithm that masks a range of values |
|
An algorithm to ensure that Cartesian mesh coordinates follow conventions. |
|
An algorithm that renames variables. |
|
an algorithm that averages data in time |
|
An algorithm that transforms NetCDF CF-2 time variable into an absolute date. |
|
A reduction on tabular data over time steps. |
|
An algorithm that identifies rows in the table that are inside the list of regions provided. |
|
An algorithm that removes rows from a table where a given expression evaluates to true. |
|
an algorithm that sorts a table in ascending order |
|
An algorithm that serializes a table to a C++ stream object. |
|
GFDL tropical storms detection algorithm. |
|
an algorithm that classifies storms using Saphire-Simpson scale |
|
GFDL tropical storms trajectory tracking algorithm. |
|
computes wind radius at the specified coordinates |
|
an algorithm that unpacks NetCDF packed values |
|
an algorithm that computes a mask identifying valid values |
|
An algorithm that transforms the vertical cooridinates of a mesh. |
|
The base class for vertical reducitons. |
|
An algorithm that computes vorticity from a vector field. |
I/O¶
TECA’s I/O components to read datasets efficiently. (For more details, click on the class name)
Class |
Description |
---|---|
A reader for collections of arrays stored in NetCDF format. |
|
A reader for data stored in binary cartesian_mesh format. |
|
An algorithm that writes Cartesian meshes in VTK format. |
|
Maps time steps to files in fixed sized blocks. |
|
NetCDF CF2 files time step mapper. |
|
Puts data on disk using NetCDF CF2 conventions. |
|
A reader for Cartesian mesh based data stored in NetCDF CF format. |
|
A dataset used to read NetCDF CF2 time and metadata in parallel. |
|
Gathers the time axis and metadata from a parallel read of a set of NetCDF CF2 files. |
|
An algorithm to read time axis and its attributes in parallel. |
|
Defines the interface for mapping time steps to files. |
|
A writer for Cartesian meshes in NetCDF CF2 format. |
|
A reader for data stored in NetCDF CF format in multiple files. |
|
Generates a valid value mask defined by regions in the given ESRI shape file. |
|
a reader for data stored in binary table format |
|
An algorithm that writes tabular data in a binary or CSV (comma separated value) format that is easily ingested by most spreadsheet apps. Each page of a database is written to a file. |
|
A reader for data stored in WRF ARW format. |
Core¶
TECA’s core components. (For more details, click on the class name)
Class |
Description |
---|---|
The interface to TECA pipeline architecture. |
|
Base class and default implementation for executives. |
|
An exception that maybe thrown when a conversion between two data types fails. |
|
Serialize objects into a binary stream. |
|
Interface for TECA datasets. |
|
An algorithm that takes a reference to dataset produced by the upstream algorithm it is connected to. |
|
An algorithm that serves up user provided data and metadata. |
|
An executive that generates requests using a upstream or user defined index. |
|
Base class for MPI + threads map reduce reduction over an index. |
|
MemoryProfiler - A sampling memory use profiler. |
|
A generic container for meta data in the form of name=value pairs. |
|
A RAII class to ease MPI initalization and finalization. |
|
A helper class for debug and error messages. |
|
A class containing methods managing memory and time profiling. |
|
An algorithm implemented with user provided callbacks. |
|
Callbacks implement a user defined reduction over time steps. |
|
A class to manage a fixed size pool of threads that dispatch I/O work. |
|
This is the base class defining a threaded algorithm. |
|
An threaded algorithm implemented with user provided callbacks. |
|
A thread safe queue. |
|
A helper class that times it’s life. |
|
A universally uniquer identifier. |
|
A type agnostic container for array based data. |
|
The concrete implementation of our type agnostic container for contiguous arrays. |
Data¶
TECA’s data structures. (For more details, click on the class name)
Class |
Description |
---|---|
A representation of mesh based data on an Arkawa C Grid. |
|
A collection of named arrays. |
|
An object representing data on a stretched Cartesian mesh. |
|
Data on a physically uniform curvilinear mesh. |
|
A collection of named tables. |
|
A base class for geometric data. |
|
An indirect priority queue that supports random access modification of priority. |
|
A collection of columnar data with row based accessors and communication and I/O support. |
|
A collection of named tables. |
|
Data on a uniform cartesian mesh. |
Testing¶
TECA comes with an extensive regression test suite which can be used to validate your build. The tests can be executed from the build directory with the ctest command.
ctest --output-on-failure
Note that PYTHONPATH, LD_LIBRARY_PATH and DYLD_LIBRARY_PATH will need to be set to include the build’s lib directory and PATH will need to be set to include “.”.
Timing and Profiling¶
TECA contains built in profiling mechanism which captures the run time of each stage of a pipeline’s execution and a sampling memory profiler.
The profiler records the times of user defined events and sample memory at a user specified interval. The resulting data is written in parallel to a CSV file in rank order. Times are stored in one file and memory use samples in another. Each memory use sample includes the time it was taken, so that memory use can be mapped back to corresponding events.
Warning
In some cases TECA’s built in profiling can negatively impact run time performance as the number of threads is increased. For that reason one should not use it in performance studies. However, it is well suited to debugging and diagnosing scaling issues and understanding control flow.
Compilation¶
The profiler is not built by default and must be compiled in by adding -DTECA_ENABLE_PROFILER=ON to the CMake command line. Be sure to build in release mode with -DCMAKE_BUILD_TYPE=Release and also add -DNDEBUG to the CMAKE_CXX_FLAGS_RELEASE. Once compiled the built in profilier may be enabled at run time via environment variables described below or directly using its API.
Runtime controls¶
The profiler is activated by the following environment variables. Environmental variables are parsed in teca_profiler::initialize. This should be automatic in most cases as it’s called from teca_mpi_manager which is used by parallel TECA applications and tests.
Variable |
Description |
PROFILER_ENABLE |
a binary mask that enables logging. 0x01 – event profiling enabled. 0x02 – memory profiling enabled. |
PROFILER_LOG_FILE |
path to write timer log to |
MEMPROF_LOG_FILE |
path to write memory profiler log to |
MEMPROF_INTERVAL |
float number of seconds between memory recordings |
Visualization¶
The command line application teca_profile_explorer can be used to analyze the log files. The application requires a timer profile file and a list of MPI ranks to analyze be passed on the command line. Optionally a memory profile file can be passed as well. For instance, the following command was used to generate figure Fig. 16.
./bin/teca_profile_explorer -e bin/test/test_bayesian_ar_detect \
-m bin/test/test_bayesian_ar_detect_mem -r 0
When run the teca_profile_explorer creast an interactive window displaying a Gantt chart for each MPI rank. The chart is organized with a row for each thread. Threads with more events are displayed higher up. For each thread, and every logged event, a colored rectangle is rendered. There can be 10’s - 100’s of unique events per thread thus it is impractical to display a legend. However, clicking on an event rectangle in the plot will result in all the data associated with the event being printed in the terminal. If a memory profile is passed on the command line the memory profile is normalized to the height of the plot and shown on top of the event profile. The maximum memory use is added to the title of the plot. Example output is shown in Fig. 16.
Creating PyPi Packages¶
The typical sequence for pushing and testing to PyPi is as follows. Be sure to add an rc number to the version in setup.py when testing since these are unique and cannot be reused.
python3 setup.py build_ext
python3 setup.py install
python3 setup.py sdist
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
pip3 install --index-url https://test.pypi.org/simple/ teca