OGS
|
Definition in file NetCdfConverter.cpp.
#include <tclap/CmdLine.h>
#include <cctype>
#include <iostream>
#include <limits>
#include <memory>
#include <netcdf>
#include <numeric>
#include <sstream>
#include <string>
#include <utility>
#include "BaseLib/FileTools.h"
#include "BaseLib/Logging.h"
#include "BaseLib/MPI.h"
#include "GeoLib/IO/AsciiRasterInterface.h"
#include "GeoLib/Raster.h"
#include "InfoLib/GitInfo.h"
#include "MeshLib/IO/VtkIO/VtuInterface.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Utils/addPropertyToMesh.h"
#include "MeshToolsLib/MeshGenerators/RasterToMesh.h"
Go to the source code of this file.
Enumerations | |
enum class | OutputType { INVALID , IMAGES , SINGLEMESH , MULTIMESH } |
Functions | |
static void | checkExit (std::string const &str) |
static void | showErrorMessage (std::size_t const error_id, std::size_t const max=0) |
static std::size_t | parseInput (std::string const &request_str, std::size_t const max_val, bool const has_info=false) |
static NcVar | getDimVar (NcFile const &dataset, NcVar const &var, std::size_t const dim) |
static std::pair< double, double > | getDimLength (NcVar const &var, std::size_t const dim) |
static std::vector< std::string > | getArrays (NcFile const &dataset) |
static void | showArrays (NcFile const &dataset) |
static void | showArraysDims (NcVar const &var) |
static std::pair< double, double > | getBoundaries (NcVar const &var) |
static MathLib::Point3d | getOrigin (NcFile const &dataset, NcVar const &var, std::vector< std::size_t > const &dim_idx_map, std::size_t const time_offset) |
static void | flipRaster (std::vector< double > &data, std::size_t const layers, std::size_t const width, std::size_t const height) |
static bool | canConvert (NcVar const &var) |
static std::string | arraySelectionLoop (NcFile const &dataset) |
static bool | dimensionSelectionLoop (NcVar const &var, std::vector< std::size_t > &dim_idx_map) |
static std::pair< std::size_t, std::size_t > | timestepSelectionLoop (NcVar const &var, std::size_t const dim_idx) |
static MeshLib::MeshElemType | elemSelectionLoop (std::size_t const dim) |
static OutputType | multFilesSelectionLoop (std::pair< std::size_t, std::size_t > const &time_bounds) |
static std::string | getIterationString (std::size_t i, std::size_t max) |
static double | getResolution (NcFile const &dataset, NcVar const &var) |
static GeoLib::RasterHeader | createRasterHeader (NcFile const &dataset, NcVar const &var, std::vector< std::size_t > const &dim_idx_map, std::vector< std::size_t > const &length, std::size_t const time_offset) |
static std::vector< std::size_t > | getLength (NcVar const &var, std::size_t const time_offset) |
static std::vector< double > | getData (NcVar const &var, std::size_t const total_length, std::size_t const time_step, std::vector< std::size_t > const &length) |
static bool | assignDimParams (NcVar const &var, std::vector< std::size_t > &dim_idx_map, TCLAP::ValueArg< std::size_t > &arg_dim_time, TCLAP::ValueArg< std::size_t > &arg_dim1, TCLAP::ValueArg< std::size_t > &arg_dim2, TCLAP::ValueArg< std::size_t > &arg_dim3) |
static std::pair< std::size_t, std::size_t > | assignTimeBounds (NcVar const &var, TCLAP::ValueArg< std::size_t > &arg_time_start, TCLAP::ValueArg< std::size_t > &arg_time_end) |
static MeshLib::MeshElemType | assignElemType (TCLAP::ValueArg< std::string > &arg_elem_type) |
static bool | convert (NcFile const &dataset, NcVar const &var, std::string const &output_name, std::vector< std::size_t > const &dim_idx_map, std::size_t const time_offset, std::pair< std::size_t, std::size_t > const &time_bounds, OutputType const output, MeshLib::MeshElemType const elem_type) |
int | main (int argc, char *argv[]) |
Variables | |
static const double | no_data_output = -9999 |
static double | no_data_input = -9999 |
|
strong |
Enumerator | |
---|---|
INVALID | |
IMAGES | |
SINGLEMESH | |
MULTIMESH |
Definition at line 39 of file NetCdfConverter.cpp.
|
static |
Definition at line 215 of file NetCdfConverter.cpp.
References arraySelectionLoop(), canConvert(), getArrays(), parseInput(), and showArrays().
Referenced by arraySelectionLoop(), and main().
|
static |
Definition at line 457 of file NetCdfConverter.cpp.
References ERR().
Referenced by main().
|
static |
Definition at line 533 of file NetCdfConverter.cpp.
References MeshLib::HEXAHEDRON, MeshLib::INVALID, MeshLib::PRISM, MeshLib::QUAD, and MeshLib::TRIANGLE.
Referenced by main().
|
static |
Definition at line 501 of file NetCdfConverter.cpp.
References ERR(), and getBoundaries().
Referenced by main().
|
static |
Definition at line 206 of file NetCdfConverter.cpp.
References ERR().
Referenced by arraySelectionLoop().
|
static |
Definition at line 47 of file NetCdfConverter.cpp.
Referenced by elemSelectionLoop(), and parseInput().
|
static |
Definition at line 548 of file NetCdfConverter.cpp.
References MeshLib::addPropertyToMesh(), MeshLib::Cell, MeshToolsLib::RasterToMesh::convert(), createRasterHeader(), MeshLib::DATAVECTOR, BaseLib::dropFileExtension(), flipRaster(), getBoundaries(), getData(), getDimLength(), getDimVar(), BaseLib::getFileExtension(), getIterationString(), getLength(), MULTIMESH, GeoLib::RasterHeader::n_cols, GeoLib::RasterHeader::n_depth, GeoLib::RasterHeader::n_rows, SINGLEMESH, FileIO::AsciiRasterInterface::writeRasterAsASC(), and MeshLib::IO::VtuInterface::writeToFile().
Referenced by main().
|
static |
Definition at line 408 of file NetCdfConverter.cpp.
References getOrigin(), getResolution(), and no_data_output.
Referenced by convert().
|
static |
Definition at line 229 of file NetCdfConverter.cpp.
References parseInput(), showArraysDims(), and showErrorMessage().
Referenced by main().
|
static |
Definition at line 316 of file NetCdfConverter.cpp.
References checkExit(), MeshLib::HEXAHEDRON, MeshLib::INVALID, MeshLib::LINE, MeshLib::PRISM, MeshLib::QUAD, and MeshLib::TRIANGLE.
Referenced by main().
|
static |
Definition at line 185 of file NetCdfConverter.cpp.
Referenced by convert().
|
static |
Definition at line 115 of file NetCdfConverter.cpp.
Referenced by arraySelectionLoop().
|
static |
Definition at line 155 of file NetCdfConverter.cpp.
Referenced by assignTimeBounds(), convert(), getOrigin(), and getResolution().
|
static |
Definition at line 439 of file NetCdfConverter.cpp.
References no_data_output.
Referenced by convert().
|
static |
Definition at line 109 of file NetCdfConverter.cpp.
Referenced by convert(), getOrigin(), and getResolution().
|
static |
Definition at line 102 of file NetCdfConverter.cpp.
Referenced by convert(), getOrigin(), getResolution(), and main().
|
static |
Definition at line 385 of file NetCdfConverter.cpp.
Referenced by convert().
|
static |
Definition at line 427 of file NetCdfConverter.cpp.
Referenced by convert().
|
static |
Definition at line 168 of file NetCdfConverter.cpp.
References getBoundaries(), getDimLength(), getDimVar(), and MathLib::ORIGIN.
Referenced by createRasterHeader().
|
static |
Definition at line 392 of file NetCdfConverter.cpp.
References getBoundaries(), getDimLength(), getDimVar(), and OGS_FATAL.
Referenced by createRasterHeader().
int main | ( | int | argc, |
char * | argv[] ) |
Definition at line 646 of file NetCdfConverter.cpp.
References arraySelectionLoop(), assignDimParams(), assignElemType(), assignTimeBounds(), convert(), dimensionSelectionLoop(), elemSelectionLoop(), ERR(), getDimVar(), IMAGES, MeshLib::INVALID, INVALID, multFilesSelectionLoop(), MULTIMESH, no_data_input, GitInfoLib::GitInfo::ogs_version, SINGLEMESH, and timestepSelectionLoop().
|
static |
Definition at line 356 of file NetCdfConverter.cpp.
References IMAGES, INVALID, MULTIMESH, parseInput(), and SINGLEMESH.
Referenced by main().
|
static |
Definition at line 72 of file NetCdfConverter.cpp.
References checkExit(), and showErrorMessage().
Referenced by arraySelectionLoop(), dimensionSelectionLoop(), multFilesSelectionLoop(), and timestepSelectionLoop().
|
static |
Definition at line 127 of file NetCdfConverter.cpp.
Referenced by arraySelectionLoop().
|
static |
Definition at line 144 of file NetCdfConverter.cpp.
Referenced by dimensionSelectionLoop().
|
static |
Definition at line 53 of file NetCdfConverter.cpp.
References ERR().
Referenced by dimensionSelectionLoop(), and parseInput().
|
static |
Definition at line 296 of file NetCdfConverter.cpp.
References parseInput().
Referenced by main().
|
static |
Definition at line 37 of file NetCdfConverter.cpp.
Referenced by main().
|
static |
Definition at line 36 of file NetCdfConverter.cpp.
Referenced by createRasterHeader(), and getData().