A DataPool class to read NetCDF files.
More...
#include <DataPoolNetCDF.hpp>
|
| DataPoolNetCDF (std::string id, ParameterSpace &ps, std::string sliceCacheDir=std::string()) |
|
| DataPoolNetCDF (ParameterSpace &ps, std::string sliceCacheDir=std::string()) |
|
void | registerDataFile (std::string filename, std::string dimensionInFile) |
| registerDataFile More...
|
|
std::map< std::string, std::string > | getRegisteredDataFiles () |
| get registered data files More...
|
|
void | clearRegisteredFiles () |
| Clear list of registered data files. More...
|
|
ParameterSpace & | getParameterSpace () |
| Get parameter space that controls this data pool. More...
|
|
std::string | createDataSlice (std::string field, std::string sliceDimension) |
| Extract a slice of data. More...
|
|
std::string | createDataSlice (std::string field, std::vector< std::string > sliceDimensions) |
| Extract a slice of data. More...
|
|
std::vector< std::string > | getCurrentFiles () |
| get list of full path to current files in datapool More...
|
|
size_t | readDataSlice (std::string field, std::string sliceDimension, void *data, size_t maxLen) |
| readDataSlice More...
|
|
std::string | getCacheDirectory () |
| Get directory for data slices. More...
|
|
void | setCacheDirectory (std::string cacheDirectory, al::Socket *src=nullptr) |
| set directory to be used to store slices More...
|
|
std::vector< std::string > | listFields (bool verifyConsistency=false) |
| list fields in datapool More...
|
|
const DataPoolType | getType () |
| type of the data pool. Set on constructor, can't change. More...
|
|
std::string | getId () |
| get this object's id More...
|
|
void | setId (std::string id) |
| set this object's id More...
|
|
std::string | getDocumentation () const |
|
void | setDocumentation (const std::string &documentation) |
|
|
std::function< std::vector< std::string >std::vector< std::string >)> | getAllPaths |
|
std::function< void(al::Socket *src)> | modified = [](al::Socket * ) {} |
|
|
std::vector< std::string > | listFieldInFile (std::string file) override |
|
bool | getFieldFromFile (std::string field, std::string file, size_t dimensionInFileIndex, void *data) override |
|
bool | getFieldFromFile (std::string field, std::string file, void *data, size_t length) override |
|
std::string | getFileType (std::string file) |
|
A DataPool class to read NetCDF files.
Definition at line 42 of file DataPoolNetCDF.hpp.
◆ DataPoolNetCDF() [1/2]
tinc::DataPoolNetCDF::DataPoolNetCDF |
( |
std::string |
id, |
|
|
ParameterSpace & |
ps, |
|
|
std::string |
sliceCacheDir = std::string() |
|
) |
| |
|
inline |
◆ DataPoolNetCDF() [2/2]
tinc::DataPoolNetCDF::DataPoolNetCDF |
( |
ParameterSpace & |
ps, |
|
|
std::string |
sliceCacheDir = std::string() |
|
) |
| |
|
inline |
◆ clearRegisteredFiles()
void tinc::DataPool::clearRegisteredFiles |
( |
| ) |
|
|
inherited |
Clear list of registered data files.
◆ createDataSlice() [1/2]
std::string tinc::DataPool::createDataSlice |
( |
std::string |
field, |
|
|
std::string |
sliceDimension |
|
) |
| |
|
inherited |
Extract a slice of data.
- Parameters
-
field | name of the field to extract |
sliceDimension | dimension that can change across the slice |
- Returns
- filename of the extracted slice
The slice will be created as a NetCDF4 file with a single variable called "data" that spans a dimension "values". The result will be a one dimensional slice containing the values of the "field" across all values for "sliceDimension" that must be registered in the parameter space.
◆ createDataSlice() [2/2]
std::string tinc::DataPool::createDataSlice |
( |
std::string |
field, |
|
|
std::vector< std::string > |
sliceDimensions |
|
) |
| |
|
inherited |
Extract a slice of data.
- Parameters
-
field | name of the field to extract |
sliceDimensions | dimensions that can change across the slice |
- Returns
- filename of the extracted slice
The output is a multidimensional slice of the data for the "field" values. The number of dimensions of the result is the size of sliceDimensions
◆ getCacheDirectory()
std::string tinc::DataPool::getCacheDirectory |
( |
| ) |
|
|
inlineinherited |
Get directory for data slices.
- Returns
- cache directory
Definition at line 142 of file DataPool.hpp.
◆ getCurrentFiles()
std::vector<std::string> tinc::DataPool::getCurrentFiles |
( |
| ) |
|
|
inherited |
get list of full path to current files in datapool
- Returns
- list of files
Both root path and current run path are prepended to the file names.
◆ getDocumentation()
std::string tinc::IdObject::getDocumentation |
( |
| ) |
const |
|
inherited |
◆ getFieldFromFile() [1/2]
bool tinc::DataPoolNetCDF::getFieldFromFile |
( |
std::string |
field, |
|
|
std::string |
file, |
|
|
size_t |
dimensionInFileIndex, |
|
|
void * |
data |
|
) |
| |
|
overrideprotectedvirtual |
◆ getFieldFromFile() [2/2]
bool tinc::DataPoolNetCDF::getFieldFromFile |
( |
std::string |
field, |
|
|
std::string |
file, |
|
|
void * |
data, |
|
|
size_t |
length |
|
) |
| |
|
overrideprotectedvirtual |
◆ getFileType()
std::string tinc::DataPool::getFileType |
( |
std::string |
file | ) |
|
|
protectedinherited |
◆ getId()
std::string tinc::IdObject::getId |
( |
| ) |
|
|
inherited |
◆ getParameterSpace()
Get parameter space that controls this data pool.
- Returns
- the parameter space
Definition at line 91 of file DataPool.hpp.
◆ getRegisteredDataFiles()
std::map<std::string, std::string> tinc::DataPool::getRegisteredDataFiles |
( |
| ) |
|
|
inherited |
get registered data files
- Returns
- key is the filename and vlaue is the name of the dimension that file contains
The dimension name in the output names the dimension whose changes have produced the values in the fields in the file
◆ getType()
type of the data pool. Set on constructor, can't change.
Definition at line 171 of file DataPool.hpp.
◆ listFieldInFile()
std::vector<std::string> tinc::DataPoolNetCDF::listFieldInFile |
( |
std::string |
file | ) |
|
|
overrideprotectedvirtual |
◆ listFields()
std::vector<std::string> tinc::DataPool::listFields |
( |
bool |
verifyConsistency = false | ) |
|
|
inherited |
list fields in datapool
- Parameters
-
verifyConsistency | verify that all files in datapool are consistent |
- Returns
- lis of field names
◆ readDataSlice()
size_t tinc::DataPool::readDataSlice |
( |
std::string |
field, |
|
|
std::string |
sliceDimension, |
|
|
void * |
data, |
|
|
size_t |
maxLen |
|
) |
| |
|
inherited |
readDataSlice
- Parameters
-
field | |
sliceDimension | dimension that can vary in the slice |
data | |
maxLen | |
- Returns
- number of elements written to data pointer
◆ registerDataFile()
void tinc::DataPool::registerDataFile |
( |
std::string |
filename, |
|
|
std::string |
dimensionInFile |
|
) |
| |
|
inherited |
registerDataFile
- Parameters
-
filename | |
dimensionInFile | This filename must be relative to mParameterSpace->generateRelativeRunPath. It should be present in all data paths for the parameter space. |
◆ setCacheDirectory()
void tinc::DataPool::setCacheDirectory |
( |
std::string |
cacheDirectory, |
|
|
al::Socket * |
src = nullptr |
|
) |
| |
|
inherited |
set directory to be used to store slices
- Parameters
-
cacheDirectory | |
src | socket that originated this request (nullptr if local) |
◆ setDocumentation()
void tinc::IdObject::setDocumentation |
( |
const std::string & |
documentation | ) |
|
|
inherited |
◆ setId()
void tinc::IdObject::setId |
( |
std::string |
id | ) |
|
|
inherited |
◆ getAllPaths
std::function<std::vector<std::string>std::vector<std::string>)> tinc::DataPool::getAllPaths |
|
inherited |
Initial value:= [&](std::vector<std::string> fixedDimensions =
std::vector<std::string>()) {
}
std::vector< std::string > runningPaths(std::vector< std::string > fixedDimensions=std::vector< std::string >())
Returns all the paths that are used by the whole parameter space.
Replace this function when the parameter space runningPaths() function is not adequate.
Definition at line 163 of file DataPool.hpp.
◆ mDocumentation
std::string tinc::IdObject::mDocumentation |
|
protectedinherited |
◆ mId
std::string tinc::IdObject::mId |
|
protectedinherited |
◆ modified
std::function<void(al::Socket *src)> tinc::IdObject::modified = [](al::Socket * ) {} |
|
inherited |
◆ mType
DataPoolType tinc::DataPool::mType {DataPoolType::DATAPOOL_USER} |
|
protectedinherited |
The documentation for this class was generated from the following file: