25#include <linux/limits.h>
33#ifndef NC_ASSEMBLER_HH_
34 #define NC_ASSEMBLER_HH_
36 #define RED "\033[0;31m"
37 #define YELLOW "\033[0;33m"
38 #define BOLD "\033[1m"
39 #define UNDERLINE "\033[4m"
40 #define RESET "\033[0m"
42 #define DEBUG (std::cout << YELLOW << "FILE: " << __FILE__ << ":" << __LINE__ << ", FUNCTION: " << __PRETTY_FUNCTION__ << RESET << std::endl)
46 #define ERROR(ec) check_error(ec, __FILE__, __LINE__, __PRETTY_FUNCTION__)
49using var_type = std::variant<signed char, char, short, int, float, double, unsigned char, unsigned short, unsigned int, long long, unsigned long long, char *>;
53 int32_t i_output_id = -1;
54 char ac_dim_name[NC_MAX_NAME + 1] = {0};
61 char ac_var_name[NC_MAX_NAME + 1] = {0};
64 int32_t ai_dimids[NC_MAX_VAR_DIMS] = {0};
66 size_t ai_dims_size[NC_MAX_VAR_DIMS] = {0};
67 size_t i_data_size = 0;
68 int32_t i_dim_id = -1;
69 int32_t i_output_id = -1;
75 int32_t i_file_id = 0;
76 int32_t i_nb_dimensions = 0;
77 int32_t i_nb_variables = 0;
78 int32_t i_nb_attributes = 0;
79 int32_t i_first_unlimited_dimensions_id = 0;
80 std::vector<dimension_information_t> vs_dims;
81 std::vector<variable_information_t> vs_variables;
86 std::vector<file_information_t> _vs_input_files;
203void check_error(
int in_i_error,
const char *in_ac_file,
204 const int in_i_line,
const char *in_ac_func);
Definition nc_assembler.hh:84
size_t * get_start_from_input(size_t in_i_file, variable_information_t &in_s_input_var, variable_information_t &in_s_output_var, size_t *in_ai_input_start)
Get the output start index from the start index of an input variable.
Definition variables.cc:126
void add_globals_attributes(void)
Add the global attributes to the output file and copy globals attributes from first input file.
Definition attributes.cc:469
void add_data_to_dim_variable(size_t in_i_file, variable_information_t &in_s_input_var, variable_information_t &in_s_output_var)
Add data to a dimension variable from an input dimension variable.
Definition variables.cc:201
void copy_attributes(int32_t in_i_input_file, variable_information_t &in_s_ref_var, variable_information_t &in_s_fill_var)
Copy the attributes from the input file to the output file.
Definition attributes.cc:427
void add_data_to_variable(size_t in_i_file, variable_information_t &in_s_input_var, variable_information_t &in_s_output_var)
Add data to a variable from an input variable.
Definition variables.cc:343
~assembler()
The assembler class destructor.
Definition main.cc:71
void copy_variables(void)
Copy the variables.
Definition variables.cc:439
variable_information_t get_variable_from_dim_id(file_information_t &in_s_file, size_t in_i_dim_id)
Get the variable from the dimension id.
Definition dimensions.cc:40
void sort_variable(variable_information_t &in_s_current_var)
Sort a variable.
Definition sort.cc:319
void copy_dimensions(void)
Copy the dimensions from the input files to the output file.
Definition dimensions.cc:56
assembler(int argc, char **argv)
The assembler class constructor.
Definition main.cc:51
size_t get_dimension_size(file_information_t &in_s_file_info, size_t in_i_dim_id)
Get the dimension size.
Definition dimensions.cc:21
void open_file(file_information_t &in_s_file_info, int in_i_mode)
Open a NetCDF or a GRIB file.
Definition file.cc:21
void get_info(file_information_t &in_s_file_info)
Get the file information.
Definition file.cc:96
void create_file(file_information_t &in_s_file_info, int in_i_mode)
Create a NetCDF file.
Definition file.cc:81
void close_file(file_information_t &in_s_file_info)
Close a NetCDF file.
Definition file.cc:113
void check_error(int in_i_error, const char *in_ac_file, const int in_i_line, const char *in_ac_func)
Check if there is an error.
Definition main.cc:23