TECA
The Toolkit for Extreme Climate Analysis
teca_cf_layout_manager Class Reference

Puts data on disk using NetCDF CF2 conventions. More...

#include <teca_cf_layout_manager.h>

Collaboration diagram for teca_cf_layout_manager:
[legend]

Classes

struct  var_def_t
 

Public Member Functions

int create (const std::string &file_name, const std::string &date_format, const teca_metadata &md_in, int mode_flags, int use_unlimited_dim, int stride)
 creates the NetCDF file. This is an MPI collective call. More...
 
int define (const teca_metadata &md, unsigned long *whole_extent, const std::vector< std::string > &point_arrays, const std::vector< std::string > &info_arrays, int collective_buffer, int compression_level, bool move_vars_to_root)
 
int write (long index, const const_p_teca_array_collection &point_arrays, const const_p_teca_array_collection &info_arrays)
 writes the collection of arrays to the NetCDF file in the correct spot. More...
 
int write (const unsigned long extent[6], const unsigned long temporal_extent[2], const const_p_teca_array_collection &point_arrays, const const_p_teca_array_collection &info_arrays, int stride)
 
int close ()
 
bool opened ()
 
bool defined ()
 
bool completed ()
 
int flush ()
 
int to_stream (std::ostream &os)
 

Static Public Member Functions

static p_teca_cf_layout_manager New (MPI_Comm comm, long file_id, long first_index, long n_indices)
 

Protected Member Functions

 teca_cf_layout_manager (MPI_Comm fcomm, long fid, long first_id, long n_ids)
 
 teca_cf_layout_manager (const teca_cf_layout_manager &)=delete
 
 teca_cf_layout_manager (const teca_cf_layout_manager &&)=delete
 
void operator= (const teca_cf_layout_manager &)=delete
 
void operator= (const teca_cf_layout_manager &&)=delete
 

Protected Attributes

MPI_Comm comm
 
long file_id
 
std::string file_name
 
teca_netcdf_util::netcdf_handle handle
 
long first_index
 
long n_indices
 
long n_written
 
int mode_flags
 
int use_unlimited_dim
 
int n_dims
 
size_t dims [4]
 
int mesh_axis [4]
 
unsigned long whole_extent [6]
 
std::map< std::string, var_def_tvar_def
 
std::string t_variable
 
p_teca_variant_array t
 

Detailed Description

Puts data on disk using NetCDF CF2 conventions.

Member Function Documentation

◆ create()

int teca_cf_layout_manager::create ( const std::string &  file_name,
const std::string &  date_format,
const teca_metadata md_in,
int  mode_flags,
int  use_unlimited_dim,
int  stride 
)

creates the NetCDF file. This is an MPI collective call.

◆ define()

int teca_cf_layout_manager::define ( const teca_metadata md,
unsigned long *  whole_extent,
const std::vector< std::string > &  point_arrays,
const std::vector< std::string > &  info_arrays,
int  collective_buffer,
int  compression_level,
bool  move_vars_to_root 
)

defines the NetCDF file layout. This is an MPI collective call. The metadata object must contain global view of coordinates, whole_extent, and for each array to be written there must be type code in the corresponding array attributes.

Parameters
[in]mda metadata object compatible with that provided by the teca_cf_reader
[in]whole_extentthe extent of data that will be written to disk, including runtime specified subsetting.
[in]point_arraysa list of point centered array names to write
[in]info_arraysa list of point centered array names to write
[in]collective_bufferset to zero to disable collective buffering
[in]compression_levelset greater than 1 to enable compression. this is incomatible with MPI parallel I/O and cannot be used in a parallel setting.
[in]move_vars_to_rootmove variable in groups to root of file (and do not create groups)
Returns
zero if successful

◆ write() [1/2]

int teca_cf_layout_manager::write ( const unsigned long  extent[6],
const unsigned long  temporal_extent[2],
const const_p_teca_array_collection &  point_arrays,
const const_p_teca_array_collection &  info_arrays,
int  stride 
)

Writes the collection of arrays defined over a spatio-temporal extent to the NetCDF file in the correct location in the file.

Parameters
[in]extentthe spatial extent of the arrays
[in]temporal_extentthe temporal extent of the arrays
[in]point_arraysa collection of point centered data arrays to write
[in]info_arraysa collection of non-geometrically oriented arrays to write
Returns
zero if successful

◆ write() [2/2]

int teca_cf_layout_manager::write ( long  index,
const const_p_teca_array_collection &  point_arrays,
const const_p_teca_array_collection &  info_arrays 
)

writes the collection of arrays to the NetCDF file in the correct spot.


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