diff --git a/ChangeLog b/ChangeLog index cd4a172b84456204a62d4a6b75666b91e1c6aaad..c67c24eaac573ae74ddc8e0967d1fbdbb95f5c2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2025-03-28 Uwe Schulzweida + + * Yseascomp: added Docu + 2025-03-27 Uwe Schulzweida * sortlevel: added NetCDF support diff --git a/OPERATORS b/OPERATORS index 876c5031c77b2cb206852d8b26c6dca10c848a54..0bb482ec1d33bb74151a71daa49f48731da52d81 100644 --- a/OPERATORS +++ b/OPERATORS @@ -150,6 +150,12 @@ Operator catalog: Ymoncomp ymonlt Compares if time series with LessThan Ymoncomp ymonge Compares if time series with GreaterEqual Ymoncomp ymongt Compares if time series with GreaterThan + Yseascomp yseaseq Compare time series with Equal + Yseascomp yseasne Compare time series with NotEqual + Yseascomp yseasle Compare time series with LessEqual + Yseascomp yseaslt Compares if time series with LessThan + Yseascomp yseasge Compares if time series with GreaterEqual + Yseascomp yseasgt Compares if time series with GreaterThan ------------------------------------------------------------- Modification ------------------------------------------------------------- diff --git a/doc/tex/Modules b/doc/tex/Modules index 7029e1caf715d3c6dccfa38579f2815e2dc7043a..4251f0570b1641aa4a85bac895e8b0e9b228e6b1 100644 --- a/doc/tex/Modules +++ b/doc/tex/Modules @@ -41,6 +41,7 @@ MapReduce Conditional selection Comp Comparison Compc Comparison Ymoncomp Comparison +Yseascomp Comparison Setattribute Modification Setpartab Modification Set Modification diff --git a/doc/tex/mod/Ymoncomp b/doc/tex/mod/Ymoncomp index 7600e4f129a15bd3a81de6526f3dc4c907c17a89..d16d87e216c46cc292bea3b198d1e57ba0c30ffd 100644 --- a/doc/tex/mod/Ymoncomp +++ b/doc/tex/mod/Ymoncomp @@ -8,9 +8,9 @@ @Operators = ymoneq ymonne ymonle ymonlt ymonge ymongt @BeginDescription -This module performs compaisons of a time series and one timestep with the same month of year. +This module performs comparisons of a time series and one timestep with the same month of year. For each field in @file{infile1} the corresponding field of the timestep in @file{infile2} with the same month of year is used. -The resulting field is a mask containing 1 if the comparison is true and 0 if not. +The resulting field is a mask containing 1 if the comparison is true and 0 if not. The type of comparison depends on the chosen operator. The input files need to have the same structure with the same variables. Usually @file{infile2} is generated by an operator of the module @mod{YMONSTAT}. diff --git a/doc/tex/mod/Yseascomp b/doc/tex/mod/Yseascomp new file mode 100644 index 0000000000000000000000000000000000000000..7a63418aed047fafb63ad5efe4241c4b3c5c5cfc --- /dev/null +++ b/doc/tex/mod/Yseascomp @@ -0,0 +1,72 @@ +@BeginModule +@NewPage +@Name = Yseascomp +@Title = Multi-year seasonal comparison +@Section = Comparison +@Class = Comparison +@Arguments = infile1 infile2 outfile +@Operators = yseaseq yseasne yseasle yseaslt yseasge yseasgt + +@BeginDescription +This module performs comparisons of a time series and one timestep with the same season of year. +For each field in @file{infile1} the corresponding field of the timestep in @file{infile2} with the same season of year is used. +The resulting field is a mask containing 1 if the comparison is true and 0 if not. +The type of comparison depends on the chosen operator. +The input files need to have the same structure with the same variables. +Usually @file{infile2} is generated by an operator of the module @mod{YseasSTAT}. +@EndDescription +@EndModule + + +@BeginOperator_yseaseq +@Title = Compare time series with Equal + +@BeginDescription +Compares whether a time series is equal to a multi-year seasonal time series. +@EndDescription +@EndOperator + + +@BeginOperator_yseasne +@Title = Compare time series with NotEqual + +@BeginDescription +Compares whether a time series is not equal to a multi-year seasonal time series. +@EndDescription +@EndOperator + + +@BeginOperator_yseasle +@Title = Compare time series with LessEqual + +@BeginDescription +Compares whether a time series is less than or equal to a multi-year seasonal time series. +@EndDescription +@EndOperator + + +@BeginOperator_yseaslt +@Title = Compares if time series with LessThan + +@BeginDescription +Compares whether a time series is less than a multi-year seasonal time series. +@EndDescription +@EndOperator + + +@BeginOperator_yseasge +@Title = Compares if time series with GreaterEqual + +@BeginDescription +Compares whether a time series is greater than or equal to a multi-year seasonal time series. +@EndDescription +@EndOperator + + +@BeginOperator_yseasgt +@Title = Compares if time series with GreaterThan + +@BeginDescription +Compares whether a time series is greater than a multi-year seasonal time series. +@EndDescription +@EndOperator diff --git a/src/CMOR.cc b/src/CMOR.cc index cdb3fc70b8f638695d416afc5a5290952fc2e9d3..e2d80b105bfe684175627a8ec5cc3af20a8fc29e 100644 --- a/src/CMOR.cc +++ b/src/CMOR.cc @@ -23,7 +23,7 @@ #include "cdo_cdi_wrapper.h" #include "varray.h" -#ifndef HAVE_LIBCMOR //------------------------------------------------------------ +#ifndef HAVE_LIBCMOR //------------------------------------------------------------ class CMOR : public Process { public: @@ -39,13 +39,25 @@ public: inline static RegisterEntry<CMOR> registration = RegisterEntry<CMOR>(module); /* clang-format off */ - void init() override { cdo_abort("CMOR support not compiled in!"); } - void run() override { cdo_abort("CMOR support not compiled in!"); } - void close() override { cdo_abort("CMOR support not compiled in!"); } + void + init() override + { + cdo_abort("CMOR support not compiled in!"); + } + void + run() override + { + cdo_abort("CMOR support not compiled in!"); + } + void + close() override + { + cdo_abort("CMOR support not compiled in!"); + } /* clang-format on */ }; -#else //--------------------------------------------------------------------------- +#else //--------------------------------------------------------------------------- #include <cassert> #include <unistd.h> @@ -5278,19 +5290,19 @@ empty_array(struct mapping vars[], char ***chunk_files) } static char ** -get_chunk_des_files(KVList *kvl, struct mapping vars[], char *miptab_freqptr, int nreq, int vlistID, char *charname, - char *project_id) +get_chunk_des_files(KVList *kvl, struct mapping vars[], std::string const &miptab_freqptr, int nreq, int vlistID, char *charname, + std::string const &project_id) { char **chunk_des_files = (char **) std::malloc((nreq + 1) * sizeof(char *)); chunk_des_files[nreq] = nullptr; char trunk[CMOR_MAX_STRING]; - if (std::strcmp(project_id, "CMIP6") == 0) + if (project_id == "CMIP6") std::snprintf(trunk, CMOR_MAX_STRING, "%s_", kv_get_a_val(kvl, "source_id", "").c_str()); else std::snprintf(trunk, CMOR_MAX_STRING, "%s_", kv_get_a_val(kvl, "model_id", "").c_str()); const char *description_atts[] = { "experiment_id", "member", "sub_experiment_id", nullptr }; - strcpy(trunk, miptab_freqptr); + strcpy(trunk, miptab_freqptr.c_str()); for (int i = 0; description_atts[i]; ++i) { std::strcat(trunk, "_"); @@ -5318,8 +5330,8 @@ get_chunk_des_files(KVList *kvl, struct mapping vars[], char *miptab_freqptr, in } static char ** -get_chunk_files(KVList *kvl, struct mapping vars[], int vlistID, int ifreq, int time_axis, int calendar, char *miptab_freqptr, - char *project_id, int *mergeIDs, int psID) +get_chunk_files(KVList *kvl, struct mapping vars[], int vlistID, int ifreq, int time_axis, int calendar, + std::string const &miptab_freqptr, std::string const &project_id, int *mergeIDs, int psID) { int i = 0; for (i = 0; vars[i].cmor_varID != CMOR_UNDEFID; ++i); @@ -5404,7 +5416,7 @@ get_chunk_files(KVList *kvl, struct mapping vars[], int vlistID, int ifreq, int static void write_variables(KVList *kvl, CdoStreamID streamID, struct mapping vars[], int miptab_freq, int time_axis, int calendar, - std::string miptab_freqptr, std::string project_id, int *mergeIDs) + std::string const &miptab_freqptr, std::string const &project_id, int *mergeIDs) { int cmf = 0; int vlistID = cdo_stream_inq_vlist(streamID); @@ -5451,8 +5463,7 @@ write_variables(KVList *kvl, CdoStreamID streamID, struct mapping vars[], int mi if (Options::cdoVerbose) cdo_print("10.2. Start to get chunk files."); char **chunk_files = nullptr; if (ifreq > 0 && ifreq != 7) - chunk_files = get_chunk_files(kvl, vars, vlistID, ifreq, time_axis, calendar, (char *) miptab_freqptr.c_str(), - (char *) project_id.c_str(), mergeIDs, psID); + chunk_files = get_chunk_files(kvl, vars, vlistID, ifreq, time_axis, calendar, miptab_freqptr, project_id, mergeIDs, psID); else { int number = 0; @@ -5648,7 +5659,7 @@ write_variables(KVList *kvl, CdoStreamID streamID, struct mapping vars[], int mi char **chunkdf = nullptr; if (mergeIDs[0] != CMOR_UNDEFID) i = 1; if (kv_get_a_val(kvl, "d", "y") == "y") - chunkdf = get_chunk_des_files(kvl, vars, (char *) miptab_freqptr.c_str(), i, vlistID, charname, (char *) project_id.c_str()); + chunkdf = get_chunk_des_files(kvl, vars, miptab_freqptr, i, vlistID, charname, project_id); char file_name[CMOR_MAX_STRING]; for (i = 0; vars[i].cmor_varID != CMOR_UNDEFID; ++i) @@ -6342,7 +6353,6 @@ cmor_load_and_set_table(KVList *kvl, std::string const ¶m0, std::string cons return table_id; } - class CMOR : public Process { public: @@ -6375,7 +6385,6 @@ public: init() override { int nparams = cdo_operator_argc(); - if (nparams < 1) cdo_abort("ERROR (infile: '%s')! No parameter found. Need at least a MIP-table.", cdo_get_stream_name(0)); auto params = cdo_get_oper_argv(); @@ -6419,7 +6428,6 @@ public: void run() override { - if (Options::cdoVerbose) cdo_print("4. Start to check attributes."); /* Short keys from rtu, mt, gi must be included similar to global atts */ add_globalhybrids(&kvl, vlistID); @@ -6456,6 +6464,5 @@ public: destruct_var_mapping(vars); /* std::free(miptableInput); */ } - }; -#endif //HAVE_LIBCMOR +#endif // HAVE_LIBCMOR diff --git a/src/Ymoncomp.cc b/src/Ymoncomp.cc index 17b925dab8c1b5178ada90fe40684667cd9db1b7..db3b43350cbdabb79effcc9a7278996de0bec1c6 100644 --- a/src/Ymoncomp.cc +++ b/src/Ymoncomp.cc @@ -29,34 +29,36 @@ #include "process_int.h" #include "field_functions.h" -static auto func_comp = [](auto hasMissvals, auto n, auto mv1, auto mv2, auto &v1, auto const &v2, auto binary_operator) { - if (hasMissvals) - { - if (std::isnan(mv1) || std::isnan(mv2)) - for (size_t i = 0; i < n; ++i) - v1[i] = (fp_is_equal(v1[i], mv1) || fp_is_equal(v2[i], mv2)) ? mv1 : binary_operator(v1[i], v2[i]); - else - for (size_t i = 0; i < n; ++i) v1[i] = (is_equal(v1[i], mv1) || is_equal(v2[i], mv2)) ? mv1 : binary_operator(v1[i], v2[i]); - } - else - { - for (size_t i = 0; i < n; ++i) v1[i] = binary_operator(v1[i], v2[i]); - } -}; - template <typename T1, typename T2> static void -comp_function(Varray<T1> &v1, const Varray<T2> &v2, double missval1, double missval2, size_t ngp, int operFunc, bool hasMissvals) +comp_function(Varray<T1> &v1, Varray<T2> const &v2, double missval1, double missval2, size_t n, int operFunc, bool hasMissvals) { T1 mv1 = missval1; T2 mv2 = missval2; + + auto func_comp = [&](auto binary_operator) { + if (hasMissvals) + { + if (std::isnan(mv1) || std::isnan(mv2)) + for (size_t i = 0; i < n; ++i) + v1[i] = (fp_is_equal(v1[i], mv1) || fp_is_equal(v2[i], mv2)) ? mv1 : binary_operator(v1[i], v2[i]); + else + for (size_t i = 0; i < n; ++i) + v1[i] = (is_equal(v1[i], mv1) || is_equal(v2[i], mv2)) ? mv1 : binary_operator(v1[i], v2[i]); + } + else + { + for (size_t i = 0; i < n; ++i) v1[i] = binary_operator(v1[i], v2[i]); + } + }; + // clang-format off - if (operFunc == FieldFunc_EQ) func_comp(hasMissvals, ngp, mv1, mv2, v1, v2, binary_op_EQ); - else if (operFunc == FieldFunc_NE) func_comp(hasMissvals, ngp, mv1, mv2, v1, v2, binary_op_NE); - else if (operFunc == FieldFunc_LE) func_comp(hasMissvals, ngp, mv1, mv2, v1, v2, binary_op_LE); - else if (operFunc == FieldFunc_LT) func_comp(hasMissvals, ngp, mv1, mv2, v1, v2, binary_op_LT); - else if (operFunc == FieldFunc_GE) func_comp(hasMissvals, ngp, mv1, mv2, v1, v2, binary_op_GE); - else if (operFunc == FieldFunc_GT) func_comp(hasMissvals, ngp, mv1, mv2, v1, v2, binary_op_GT); + if (operFunc == FieldFunc_EQ) func_comp(binary_op_EQ); + else if (operFunc == FieldFunc_NE) func_comp(binary_op_NE); + else if (operFunc == FieldFunc_LE) func_comp(binary_op_LE); + else if (operFunc == FieldFunc_LT) func_comp(binary_op_LT); + else if (operFunc == FieldFunc_GE) func_comp(binary_op_GE); + else if (operFunc == FieldFunc_GT) func_comp(binary_op_GT); else cdo_abort("Operator not implemented!"); // clang-format on } @@ -65,11 +67,8 @@ static void comp_function(Field &f1, Field const &f2, int operFunc) { auto hasMissvals = (f1.numMissVals > 0 || f2.numMissVals > 0); - - auto func = [&](auto &v1, auto const &v2, double mv1, double mv2, size_t size) { - comp_function(v1, v2, mv1, mv2, size, operFunc, hasMissvals); - }; - field_operation2(func, f1, f2, f1.missval, f2.missval, f1.size); + auto func = [&](auto &v1, auto const &v2) { comp_function(v1, v2, f1.missval, f2.missval, f1.size, operFunc, hasMissvals); }; + field_operation2(func, f1, f2); } constexpr int MaxMonths = 12; @@ -105,12 +104,12 @@ public: { "ymonlt", FieldFunc_LT, MONTHLY, YmoncompHelp }, { "ymonge", FieldFunc_GE, MONTHLY, YmoncompHelp }, { "ymongt", FieldFunc_GT, MONTHLY, YmoncompHelp }, - { "yseaseq", FieldFunc_EQ, SEASONAL, nullptr }, - { "yseasne", FieldFunc_NE, SEASONAL, nullptr }, - { "yseasle", FieldFunc_LE, SEASONAL, nullptr }, - { "yseaslt", FieldFunc_LT, SEASONAL, nullptr }, - { "yseasge", FieldFunc_GE, SEASONAL, nullptr }, - { "yseasgt", FieldFunc_GT, SEASONAL, nullptr } }, + { "yseaseq", FieldFunc_EQ, SEASONAL, YseascompHelp }, + { "yseasne", FieldFunc_NE, SEASONAL, YseascompHelp }, + { "yseasle", FieldFunc_LE, SEASONAL, YseascompHelp }, + { "yseaslt", FieldFunc_LT, SEASONAL, YseascompHelp }, + { "yseasge", FieldFunc_GE, SEASONAL, YseascompHelp }, + { "yseasgt", FieldFunc_GT, SEASONAL, YseascompHelp } }, .aliases = {}, .mode = EXPOSED, // Module mode: 0:intern 1:extern .number = CDI_REAL, // Allowed number type @@ -249,10 +248,7 @@ public: void run() override { - if (opertype == SEASONAL) - run_seasonal(); - else - run_monthly(); + (opertype == SEASONAL) ? run_seasonal() : run_monthly(); } void diff --git a/src/afterburner.h b/src/afterburner.h index fc2ca98ed9842d511893984811b0eb99b90bcf18..1ab3b4758a8421c10068c9ebb936305d4c2f7660 100644 --- a/src/afterburner.h +++ b/src/afterburner.h @@ -11,6 +11,7 @@ #include <cstdarg> #include "process_int.h" +#include "cdo_output.h" #include "transform.h" #include "workerthread.h" #include "varray.h" diff --git a/src/cdo_getopt.h b/src/cdo_getopt.h index 3108cda6a0ad7f04a25871b719adfc56cb2122a9..44c7a8500c26e3bf127c9ad5fa4b88b74fe192af 100644 --- a/src/cdo_getopt.h +++ b/src/cdo_getopt.h @@ -6,7 +6,6 @@ #endif #include <map> -#include <set> #include <vector> #include <string> #include <functional> @@ -29,7 +28,6 @@ struct cdo_option_argument struct cdo_option_2 { - std::function<void(std::string argument)> effect = [](std::string) { printf("ERROR"); exit(0); @@ -129,6 +127,7 @@ struct cdo_option_2 { return argument.value; } + void execute() { @@ -193,8 +192,7 @@ public: static bool print_settings; static bool print_envvars; - static int - parse(std::vector<std::string> p_argv); + static int parse(std::vector<std::string> p_argv); static void get_env_vars(); static std::shared_ptr<cdo_option_2> &option(std::string const &p_name, std::string const &p_short_form = std::string()); static std::shared_ptr<cdo_option_2> &envvar(std::string const &p_name); diff --git a/src/expr.cc b/src/expr.cc index 5d422c108f42591bc684ab1173d42102db2fcf0e..afb66f6faafde70b53982d3d65a61e6476873f98 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -10,8 +10,8 @@ #include <cdi.h> #include "cdo_options.h" -#include "process_int.h" #include "field_functions.h" +#include "cdo_output.h" #include "cdo_omp.h" #include "interpol.h" #include "expr.h" diff --git a/src/grid_define.cc b/src/grid_define.cc index f5bd72f2956362a58c1ec91c22064e26dbc2d0c3..d8b903b25d21bd9b686f931bcebcc909c209d1b6 100644 --- a/src/grid_define.cc +++ b/src/grid_define.cc @@ -9,7 +9,8 @@ #include <cdi.h> -#include "process_int.h" +#include "cdo_output.h" +#include "cdo_cdi_wrapper.h" #include <mpim_grid.h> /* diff --git a/src/grid_print.cc b/src/grid_print.cc index a0ff9f1f6f7de904499553e5c6e75f7359d427e1..33d779e324f1ceda2219945ab9e00a868c29a39f 100644 --- a/src/grid_print.cc +++ b/src/grid_print.cc @@ -8,8 +8,11 @@ #include <cdi.h> #include "cdi_uuid.h" +#include <cstring> + #include "cdo_options.h" -#include "process_int.h" +#include "cdo_cdi_wrapper.h" +#include "compare.h" #include "util_string.h" constexpr int MaxLen = 120; diff --git a/src/griddes.cc b/src/griddes.cc index 35f792c34323b233fc924af6384678b15411de1c..853e9359644af87e358a35259feca1a01b4ecd4b 100644 --- a/src/griddes.cc +++ b/src/griddes.cc @@ -13,8 +13,9 @@ #include <cdi.h> #include "cdi_uuid.h" -#include "cdo_options.h" -#include "process_int.h" +#include "cdo_output.h" +#include "cdo_varlist.h" +#include "compare.h" #include "util_string.h" #include "griddes.h" #include "util_wildcards.h" diff --git a/src/institution.cc b/src/institution.cc index 99bfc0e02fb3de5ce1f2fc85028dee5a7f2ce613..3cfef6ed2b7258f9bf27a466e77f675e0958e60b 100644 --- a/src/institution.cc +++ b/src/institution.cc @@ -9,8 +9,8 @@ #include <cdi.h> -#include "process_int.h" #include "cdo_default_values.h" +#include "cdo_output.h" static int read_institution(std::string const &filename) diff --git a/src/interpol.cc b/src/interpol.cc index 93c20f6e396e78777a0429c026a5aae8638de279..fc290a90025dc94aaa91726d1c8cd944f91e4628 100644 --- a/src/interpol.cc +++ b/src/interpol.cc @@ -6,17 +6,15 @@ */ #include <atomic> -#include <algorithm> #include <cdi.h> -#include "process_int.h" #include <mpim_grid.h> -#include "cdo_options.h" +#include "cdo_output.h" #include "interpol.h" +#include "field.h" #include "progress.h" #include "cdo_omp.h" -#include "matrix_view.h" /** * Find the interval i-1 .. i in which an element x fits and return i, the diff --git a/src/merge_axis.cc b/src/merge_axis.cc index e7b6affe196eca75ee18c0b3113aa2e9b63a10e7..34d82f2fd72df0f3e121b9ceb7b2f02b3c9b366e 100644 --- a/src/merge_axis.cc +++ b/src/merge_axis.cc @@ -7,10 +7,11 @@ #include <cdi.h> +#include <unistd.h> + #include "process_int.h" #include "varray.h" -#include <unistd.h> #include <mpim_grid.h> #include "pmlist.h" diff --git a/src/operator_help.cc b/src/operator_help.cc index a5984f8d09ce8677824bca50e85dcea935c59bb0..090fbeb980ff62cf266a4442adf722dac39f3d03 100644 --- a/src/operator_help.cc +++ b/src/operator_help.cc @@ -1234,9 +1234,9 @@ const CdoHelp YmoncompHelp = { " <operator> infile1 infile2 outfile", "", "DESCRIPTION", - " This module performs compaisons of a time series and one timestep with the same month of year.", + " This module performs comparisons of a time series and one timestep with the same month of year.", " For each field in infile1 the corresponding field of the timestep in infile2 with the same month of year is used.", - " The resulting field is a mask containing 1 if the comparison is true and 0 if not. ", + " The resulting field is a mask containing 1 if the comparison is true and 0 if not.", " The type of comparison depends on the chosen operator.", " The input files need to have the same structure with the same variables.", " Usually infile2 is generated by an operator of the module YMONSTAT.", @@ -1256,6 +1256,37 @@ const CdoHelp YmoncompHelp = { " Compares whether a time series is greater than a multi-year monthly time series.", }; +const CdoHelp YseascompHelp = { + "NAME", + " yseaseq, yseasne, yseasle, yseaslt, yseasge, yseasgt - ", + " Multi-year seasonal comparison", + "", + "SYNOPSIS", + " <operator> infile1 infile2 outfile", + "", + "DESCRIPTION", + " This module performs comparisons of a time series and one timestep with the same season of year.", + " For each field in infile1 the corresponding field of the timestep in infile2 with the same season of year is used.", + " The resulting field is a mask containing 1 if the comparison is true and 0 if not.", + " The type of comparison depends on the chosen operator.", + " The input files need to have the same structure with the same variables.", + " Usually infile2 is generated by an operator of the module YseasSTAT.", + "", + "OPERATORS", + " yseaseq Compare time series with Equal", + " Compares whether a time series is equal to a multi-year seasonal time series.", + " yseasne Compare time series with NotEqual", + " Compares whether a time series is not equal to a multi-year seasonal time series.", + " yseasle Compare time series with LessEqual", + " Compares whether a time series is less than or equal to a multi-year seasonal time series.", + " yseaslt Compares if time series with LessThan", + " Compares whether a time series is less than a multi-year seasonal time series.", + " yseasge Compares if time series with GreaterEqual", + " Compares whether a time series is greater than or equal to a multi-year seasonal time series.", + " yseasgt Compares if time series with GreaterThan", + " Compares whether a time series is greater than a multi-year seasonal time series.", +}; + const CdoHelp SetattributeHelp = { "NAME", " setattribute, delattribute - Set attributes", @@ -4588,8 +4619,8 @@ const CdoHelp RemapdisHelp = { " In this case the mapfiles will be named <outfile><xxx>.nc. xxx will have five digits with the number of the mapfile.", "", "PARAMETER", - " grid STRING Target grid description file or name", - " neighbors INTEGER Number of nearest neighbors [default: 4]", + " grid STRING Target grid description file or name", + " neighbors INTEGER Number of nearest neighbors [default: 4]", " map3d BOOL Generate all mapfiles of the first 3D field", "", "ENVIRONMENT", diff --git a/src/operator_help.h b/src/operator_help.h index b79e3695872a3f29f952506f96ae7a6dd15a9b26..47e115f6f9f96a648d61b598f42b4593fa42f8a2 100644 --- a/src/operator_help.h +++ b/src/operator_help.h @@ -51,6 +51,7 @@ extern const CdoHelp MapReduceHelp; extern const CdoHelp CompHelp; extern const CdoHelp CompcHelp; extern const CdoHelp YmoncompHelp; +extern const CdoHelp YseascompHelp; extern const CdoHelp SetattributeHelp; extern const CdoHelp SetpartabHelp; extern const CdoHelp SetHelp; diff --git a/src/printinfo.cc b/src/printinfo.cc index 1965812e9ae57c47fab638d2a5684f3f7d874525..93e0851bdf3e98532fdd661f3e906f8ac0504b45 100644 --- a/src/printinfo.cc +++ b/src/printinfo.cc @@ -1,5 +1,6 @@ #include <cdi.h> +#include "process_int.h" #include <mpim_grid.h> #include "cdo_options.h" #include "util_string.h" diff --git a/src/printinfo.h b/src/printinfo.h index 6a7d72acf5b53cf1327d5dc9ad929cccbe827631..f76d13f119073ae3993fd8fa5595266d1cff33db 100644 --- a/src/printinfo.h +++ b/src/printinfo.h @@ -1,10 +1,8 @@ #ifndef PRINTINFO_H #define PRINTINFO_H -#include <stdio.h> -#include <inttypes.h> - -#include "process_int.h" +#include <string> +#include <cdoStream.h> std::string date_to_string(CdiDate date); std::string time_to_string(CdiTime time); diff --git a/src/process.h b/src/process.h index bfc6c840fa173c5b6abe2bfd065c666ac76607b7..61985281fb64c3e3ef75d42f4d8d4d7ed93ff589 100644 --- a/src/process.h +++ b/src/process.h @@ -12,12 +12,7 @@ #include "cdo_module.h" #include <vector> -#include <iostream> #include <string> -#include <set> - -constexpr int MAX_PROCESS = 65536; -constexpr int MAX_OPERATOR = 128; enum struct ProcessStatus { @@ -28,12 +23,14 @@ enum struct ProcessStatus TooManyStreams = -4, TooFewStreams = -5, }; + enum struct ProcessWriteMode { FILEIO = 0, MEMORY = 1 }; + void *execute(void *process); class Process @@ -69,7 +66,7 @@ public: /* Member Functions */ Process(int p_ID, std::string const &p_operatorName, const std::vector<std::string> &p_arguments, const CdoModule &p_module); - virtual ~Process() {Debug(PROCESS,"destruction of %s",operatorName);} + virtual ~Process() { Debug(PROCESS, "destruction of %s", operatorName); } pthread_t start_thread(); virtual void init() = 0; diff --git a/src/processManager.cc b/src/processManager.cc index c5cf2a9f816ff2bb722efc7d5f8bbb9cabbe4b58..02d59960bcec9bc5df91350c1f4c559dcc917300 100644 --- a/src/processManager.cc +++ b/src/processManager.cc @@ -10,13 +10,12 @@ #include "cdo_timer.h" #include "cdo_output.h" #include "cdo_options.h" -#include "fileStream.h" #include "factory.h" #include "util_string.h" -#include <stack> #include <mutex> -#include <ranges> + +constexpr int MAX_PROCESS = 65536; static std::mutex processMutex; diff --git a/src/process_int.h b/src/process_int.h index f6b1811b48878614829b265a8299d8b2ac1393b0..0bcffd347b92c4900ae6452d1ae6563bc4949501 100644 --- a/src/process_int.h +++ b/src/process_int.h @@ -8,7 +8,6 @@ #ifndef PROCESS_INT_H #define PROCESS_INT_H -#include "cdo_cdi_wrapper.h" #include "process.h" #include "factory.h" diff --git a/src/remap_bicubic.cc b/src/remap_bicubic.cc index f5769021035f0cf459d4a09c607625de6748c82c..546952cccb5b71f1568883d18bef930fe694bfd4 100644 --- a/src/remap_bicubic.cc +++ b/src/remap_bicubic.cc @@ -8,14 +8,14 @@ #include <atomic> #include "cpp_lib.h" -#include "process_int.h" +#include "cdo_options.h" +#include "cdo_output.h" #include "cdo_timer.h" +#include "cdo_omp.h" #include <mpim_grid.h> -#include "cdo_options.h" #include "remap.h" #include "remap_store_link.h" #include "progress.h" -#include "cdo_omp.h" // bicubic interpolation diff --git a/src/remap_bilinear.cc b/src/remap_bilinear.cc index 4985eadc45c111ffaab41b786809ed3a16165785..0e58d1a9bb4d06296511b86e2ec7aca6a94a67d2 100644 --- a/src/remap_bilinear.cc +++ b/src/remap_bilinear.cc @@ -8,13 +8,13 @@ #include <atomic> #include "cpp_lib.h" -#include "process_int.h" +#include "cdo_options.h" +#include "cdo_output.h" #include "cdo_timer.h" +#include "cdo_omp.h" #include "remap.h" #include "remap_store_link.h" -#include "cdo_options.h" #include "progress.h" -#include "cdo_omp.h" #include "grid_healpix.h" // bilinear interpolation diff --git a/src/remap_conserv.cc b/src/remap_conserv.cc index 379656b7b539f971d96595cf5fe408815998c87a..9cd3fddb5cd2abe6dbaff4489659b358f8e87ebc 100644 --- a/src/remap_conserv.cc +++ b/src/remap_conserv.cc @@ -8,14 +8,14 @@ #include <atomic> #include "cpp_lib.h" -#include "process_int.h" #include "cdo_timer.h" +#include "cdo_options.h" +#include "cdo_output.h" +#include "cdo_omp.h" #include "remap.h" #include "remap_method_conserv.h" #include "remap_store_link.h" -#include "cdo_options.h" #include "progress.h" -#include "cdo_omp.h" #include <mpim_grid.h> // 1st order conservative interpolation diff --git a/src/remap_knn.cc b/src/remap_knn.cc index f82cb88fab8f095f35311c845f4cedf3d8f46d21..ce750aa6485f199d4694539f7ead596b691c535a 100644 --- a/src/remap_knn.cc +++ b/src/remap_knn.cc @@ -7,9 +7,9 @@ #include <atomic> -#include "process_int.h" #include "cdo_timer.h" #include "cdo_options.h" +#include "cdo_output.h" #include "remap.h" #include "remap_store_link.h" #include "progress.h" diff --git a/src/remap_vars.cc b/src/remap_vars.cc index 0cc2ad3c82eee47398addafa793e5541ecb1cfca..5c8ebf8d064d86def8113aabc528283e3d5e9751 100644 --- a/src/remap_vars.cc +++ b/src/remap_vars.cc @@ -6,9 +6,9 @@ */ #include "field.h" -#include "process_int.h" #include "cdo_timer.h" #include "cdo_options.h" +#include "cdo_output.h" #include "cdo_omp.h" #include "remap_vars.h" diff --git a/src/remaplib.cc b/src/remaplib.cc index af4fe30df143a3ff8428b1bd6fd20c364fe0ec43..3950dcd4115bd32c02fe2585ff395f9f72c51cdf 100644 --- a/src/remaplib.cc +++ b/src/remaplib.cc @@ -9,8 +9,8 @@ #include "cdo_options.h" #include "cdo_timer.h" +#include "cdo_output.h" #include "cdo_omp.h" -#include "process_int.h" #include <mpim_grid.h> #include "gridreference.h" #include "remap.h"