Skip to content

Commit

Permalink
Revert out_of_bound parameter family
Browse files Browse the repository at this point in the history
t Please enter the commit message for your changes. Lines starting
  • Loading branch information
sylvielamythepaut committed Nov 16, 2023
1 parent 9162de8 commit 85401f7
Show file tree
Hide file tree
Showing 124 changed files with 3,211 additions and 707 deletions.
18 changes: 18 additions & 0 deletions src/api/MagicsCalls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,20 @@ const char* MagicsCalls::metainput() {
const char* MagicsCalls::metanetcdf() {
return FortranMagics::instance().metanetcdf();
}
const char* MagicsCalls::long_parameters() {
static string result;
ostringstream os;
os << "{";
os << "\"grib_field_position\": \"grib_field_large_position\",";
os << "\"grib_wind_position_1\": \"grib_wind_large_position_1\",";
os << "\"grib_wind_position_2\": \"grib_wind_large_position_2\",";
os << "\"grib_wind_position_colour\": \"grib_wind_large_position_colour\"";
os << "}";
result = os.str();
return result.c_str();


}
const char* MagicsCalls::keep_compatibility() {
NOTIMP;
}
Expand Down Expand Up @@ -385,6 +398,11 @@ void MagicsCalls::seti(const std::string& name, int value) {
ParameterManager::set(name, value);
}

void MagicsCalls::setli(const std::string& name, unsigned long long value) {
// if (CompatibilityHelper::check(name, value))
// return;
ParameterManager::set(name, value);
}

void MagicsCalls::set1i(const std::string& name, const std::vector<int>& data) {
set1i(name, data.data(), data.size());
Expand Down
2 changes: 2 additions & 0 deletions src/api/MagicsCalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class MagicsCalls {
static const char* metainput();
static const char* metanetcdf();
static const char* keep_compatibility();
static const char* long_parameters();

// =================================================================
static void axis();
Expand Down Expand Up @@ -82,6 +83,7 @@ class MagicsCalls {
static void set1c(const std::string& name, const std::vector<std::string>& data);

static void seti(const std::string& name, int value);
static void setli(const std::string& name, unsigned long long value);
static void set1i(const std::string& name, const int* data, const int dim1);
static void set1i(const std::string& name, const std::vector<int>& data);
static void set2i(const std::string& name, const int* data, const int dim1, const int dim2);
Expand Down
6 changes: 5 additions & 1 deletion src/api/MagicsCallsPython.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ PYTHON_VOID(tile)
PYTHON_VOID(unmute) // TODO: review name
PYTHON_VOID(wind)
PYTHON_VOID(wrepjson)

PYTHON_CHAR(long_parameters)
PYTHON_CHAR(knowndrivers) // TODO: review name
PYTHON_CHAR(metagrib) // TODO: review name
PYTHON_CHAR(metainput) // TODO: review name
Expand Down Expand Up @@ -193,6 +193,10 @@ MAGICS_EXPORT const char* py_seti(const char* name, const int value) {
return python_void("seti", [name, value] { MagicsCalls::seti(name, value); });
}

MAGICS_EXPORT const char* py_setli(const char* name, const unsigned long long value) {
return python_void("setli", [name, value] { MagicsCalls::setli(name, value); });
}

MAGICS_EXPORT const char* py_set1r(const char* name, const double* data, const int dim1) {
return python_void("set1r", [name, data, dim1] { MagicsCalls::set1r(name, data, dim1); });
}
Expand Down
2 changes: 2 additions & 0 deletions src/api/py_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MAGICS_EXPORT const char* py_import();
MAGICS_EXPORT const char* py_input();
MAGICS_EXPORT const char* py_keep_compatibility();
MAGICS_EXPORT const char* py_knowndrivers();
MAGICS_EXPORT const char* py_long_parameters();
MAGICS_EXPORT const char* py_legend();
MAGICS_EXPORT const char* py_line();
MAGICS_EXPORT const char* py_mapgen();
Expand Down Expand Up @@ -50,6 +51,7 @@ MAGICS_EXPORT const char* py_reset(const char* name);
MAGICS_EXPORT const char* py_setc(const char* name, const char* value);
MAGICS_EXPORT const char* py_setr(const char* name, const double value);
MAGICS_EXPORT const char* py_seti(const char* name, const int value);
MAGICS_EXPORT const char* py_setli(const char* name, const unsigned long long value);
MAGICS_EXPORT const char* py_set1r(const char* name, const double* data, const int dim1);
MAGICS_EXPORT const char* py_set2r(const char* name, const double* data, const int dim1, const int dim2);
MAGICS_EXPORT const char* py_set1i(const char* name, const int* data, const int dim1);
Expand Down
39 changes: 37 additions & 2 deletions src/attributes/AxisAttributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ AxisAttributes::AxisAttributes():
tip_(ParameterManager::getBool("axis_tip_title")),
tip_text_(ParameterManager::getString("axis_tip_title_text")),
tip_height_(ParameterManager::getDouble("axis_tip_title_height")),
tip_quality_(ParameterManager::getString("axis_tip_title_quality"))
tip_quality_(ParameterManager::getString("axis_tip_title_quality")),
highlighted_values_(ParameterManager::getDoubleArray("axis_highlighted_values")),
highlighted_values_thickness_(ParameterManager::getInt("axis_highlighted_values_thickness"))
,
method_(MagTranslator<string, AxisMethod>().magics("axis_type")),
line_colour_(MagTranslator<string, Colour>().magics("axis_line_colour")),
line_style_(MagTranslator<string, LineStyle>().magics("axis_line_style")),
grid_colour_(MagTranslator<string, Colour>().magics("axis_grid_colour")),
grid_background_colour_(MagTranslator<string, Colour>().magics("axis_grid_background_colour")),
grid_style_(MagTranslator<string, LineStyle>().magics("axis_grid_line_style")),
minor_grid_colour_(MagTranslator<string, Colour>().magics("axis_minor_grid_colour")),
minor_grid_style_(MagTranslator<string, LineStyle>().magics("axis_minor_grid_line_style")),
Expand All @@ -81,7 +84,9 @@ AxisAttributes::AxisAttributes():
tick_colour_(MagTranslator<string, Colour>().magics("axis_tick_colour")),
label_colour_(MagTranslator<string, Colour>().magics("axis_tick_label_colour")),
minor_tick_colour_(MagTranslator<string, Colour>().magics("axis_minor_tick_colour")),
tip_colour_(MagTranslator<string, Colour>().magics("axis_tip_title_colour"))
tip_colour_(MagTranslator<string, Colour>().magics("axis_tip_title_colour")),
highlighted_values_colour_(MagTranslator<string, Colour>().magics("axis_highlighted_values_colour")),
highlighted_values_style_(MagTranslator<string, LineStyle>().magics("axis_highlighted_values_style"))

{
}
Expand Down Expand Up @@ -141,11 +146,14 @@ void AxisAttributes::set(const std::map<string, string>& params)
setAttribute(prefix, "axis_tip_title_text", tip_text_, params);
setAttribute(prefix, "axis_tip_title_height", tip_height_, params);
setAttribute(prefix, "axis_tip_title_quality", tip_quality_, params);
setAttribute(prefix, "axis_highlighted_values", highlighted_values_, params);
setAttribute(prefix, "axis_highlighted_values_thickness", highlighted_values_thickness_, params);

setMember(prefix, "axis_type", method_, params);
setMember(prefix, "axis_line_colour", line_colour_, params);
setAttribute(prefix, "axis_line_style", line_style_, params);
setMember(prefix, "axis_grid_colour", grid_colour_, params);
setMember(prefix, "axis_grid_background_colour", grid_background_colour_, params);
setAttribute(prefix, "axis_grid_line_style", grid_style_, params);
setMember(prefix, "axis_minor_grid_colour", minor_grid_colour_, params);
setAttribute(prefix, "axis_minor_grid_line_style", minor_grid_style_, params);
Expand All @@ -156,6 +164,8 @@ void AxisAttributes::set(const std::map<string, string>& params)
setMember(prefix, "axis_tick_label_colour", label_colour_, params);
setMember(prefix, "axis_minor_tick_colour", minor_tick_colour_, params);
setMember(prefix, "axis_tip_title_colour", tip_colour_, params);
setMember(prefix, "axis_highlighted_values_colour", highlighted_values_colour_, params);
setAttribute(prefix, "axis_highlighted_values_style", highlighted_values_style_, params);

}

Expand Down Expand Up @@ -203,10 +213,13 @@ void AxisAttributes::copy(const AxisAttributes& other)
tip_text_ = other.tip_text_;
tip_height_ = other.tip_height_;
tip_quality_ = other.tip_quality_;
highlighted_values_ = other.highlighted_values_;
highlighted_values_thickness_ = other.highlighted_values_thickness_;
method_ = unique_ptr<AxisMethod>(other.method_->clone());
line_colour_ = unique_ptr<Colour>(other.line_colour_->clone());
line_style_ = other.line_style_;
grid_colour_ = unique_ptr<Colour>(other.grid_colour_->clone());
grid_background_colour_ = unique_ptr<Colour>(other.grid_background_colour_->clone());
grid_style_ = other.grid_style_;
minor_grid_colour_ = unique_ptr<Colour>(other.minor_grid_colour_->clone());
minor_grid_style_ = other.minor_grid_style_;
Expand All @@ -217,6 +230,8 @@ void AxisAttributes::copy(const AxisAttributes& other)
label_colour_ = unique_ptr<Colour>(other.label_colour_->clone());
minor_tick_colour_ = unique_ptr<Colour>(other.minor_tick_colour_->clone());
tip_colour_ = unique_ptr<Colour>(other.tip_colour_->clone());
highlighted_values_colour_ = unique_ptr<Colour>(other.highlighted_values_colour_->clone());
highlighted_values_style_ = other.highlighted_values_style_;

}

Expand Down Expand Up @@ -301,10 +316,13 @@ void AxisAttributes::print(ostream& out) const
out << " tip_text = " << tip_text_;
out << " tip_height = " << tip_height_;
out << " tip_quality = " << tip_quality_;
out << " highlighted_values = " << highlighted_values_;
out << " highlighted_values_thickness = " << highlighted_values_thickness_;
out << " method = " << *method_;
out << " line_colour = " << *line_colour_;
out << " line_style = " << line_style_;
out << " grid_colour = " << *grid_colour_;
out << " grid_background_colour = " << *grid_background_colour_;
out << " grid_style = " << grid_style_;
out << " minor_grid_colour = " << *minor_grid_colour_;
out << " minor_grid_style = " << minor_grid_style_;
Expand All @@ -315,6 +333,8 @@ void AxisAttributes::print(ostream& out) const
out << " label_colour = " << *label_colour_;
out << " minor_tick_colour = " << *minor_tick_colour_;
out << " tip_colour = " << *tip_colour_;
out << " highlighted_values_colour = " << *highlighted_values_colour_;
out << " highlighted_values_style = " << highlighted_values_style_;

out << "]" << "\n";
}
Expand Down Expand Up @@ -406,6 +426,10 @@ void AxisAttributes::toxml(ostream& out) const
niceprint(out,tip_height_);
out << ", \"axis_tip_title_quality\":";
niceprint(out,tip_quality_);
out << ", \"axis_highlighted_values\":";
niceprint(out,highlighted_values_);
out << ", \"axis_highlighted_values_thickness\":";
niceprint(out,highlighted_values_thickness_);
out << ", \"axis_type\":";
method_->toxml(out);
out << ", \"axis_line_colour\":";
Expand All @@ -414,6 +438,8 @@ void AxisAttributes::toxml(ostream& out) const
niceprint(out, line_style_);
out << ", \"axis_grid_colour\":";
niceprint(out, *grid_colour_);
out << ", \"axis_grid_background_colour\":";
niceprint(out, *grid_background_colour_);
out << ", \"axis_grid_line_style\":";
niceprint(out, grid_style_);
out << ", \"axis_minor_grid_colour\":";
Expand All @@ -434,6 +460,10 @@ void AxisAttributes::toxml(ostream& out) const
niceprint(out, *minor_tick_colour_);
out << ", \"axis_tip_title_colour\":";
niceprint(out, *tip_colour_);
out << ", \"axis_highlighted_values_colour\":";
niceprint(out, *highlighted_values_colour_);
out << ", \"axis_highlighted_values_style\":";
niceprint(out, highlighted_values_style_);

}

Expand Down Expand Up @@ -479,10 +509,13 @@ static MagicsParameter<string> axis_tip_title("axis_tip_title", "off");
static MagicsParameter<string> axis_tip_title_text("axis_tip_title_text", "");
static MagicsParameter<double> axis_tip_title_height("axis_tip_title_height", 0.4);
static MagicsParameter<string> axis_tip_title_quality("axis_tip_title_quality", "medium");
static MagicsParameter<doublearray> axis_highlighted_values("axis_highlighted_values", floatarray());
static MagicsParameter<int> axis_highlighted_values_thickness("axis_highlighted_values_thickness", 1);
static MagicsParameter<string> axis_type("axis_type", "regular");
static MagicsParameter<string> axis_line_colour("axis_line_colour", "automatic");
static MagicsParameter<string> axis_line_style("axis_line_style", "solid");
static MagicsParameter<string> axis_grid_colour("axis_grid_colour", "black");
static MagicsParameter<string> axis_grid_background_colour("axis_grid_background_colour", "none");
static MagicsParameter<string> axis_grid_line_style("axis_grid_line_style", "solid");
static MagicsParameter<string> axis_minor_grid_colour("axis_minor_grid_colour", "black");
static MagicsParameter<string> axis_minor_grid_line_style("axis_minor_grid_line_style", "solid");
Expand All @@ -493,6 +526,8 @@ static MagicsParameter<string> axis_tick_colour("axis_tick_colour", "automatic")
static MagicsParameter<string> axis_tick_label_colour("axis_tick_label_colour", "automatic");
static MagicsParameter<string> axis_minor_tick_colour("axis_minor_tick_colour", "automatic");
static MagicsParameter<string> axis_tip_title_colour("axis_tip_title_colour", "automatic");
static MagicsParameter<string> axis_highlighted_values_colour("axis_highlighted_values_colour", "black");
static MagicsParameter<string> axis_highlighted_values_style("axis_highlighted_values_style", "solid");
#include "AxisMethod.h"
#include "DateAxis.h"
static SimpleObjectMaker<AxisMethod , AxisMethod> regular_AxisMethod("regular");
Expand Down
5 changes: 5 additions & 0 deletions src/attributes/AxisAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ class AxisAttributes
string tip_text_;
double tip_height_;
string tip_quality_;
doublearray highlighted_values_;
int highlighted_values_thickness_;
unique_ptr<AxisMethod> method_;
unique_ptr<Colour> line_colour_;
LineStyle line_style_;
unique_ptr<Colour> grid_colour_;
unique_ptr<Colour> grid_background_colour_;
LineStyle grid_style_;
unique_ptr<Colour> minor_grid_colour_;
LineStyle minor_grid_style_;
Expand All @@ -108,6 +111,8 @@ class AxisAttributes
unique_ptr<Colour> label_colour_;
unique_ptr<Colour> minor_tick_colour_;
unique_ptr<Colour> tip_colour_;
unique_ptr<Colour> highlighted_values_colour_;
LineStyle highlighted_values_style_;


private:
Expand Down
28 changes: 28 additions & 0 deletions src/attributes/AxisWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ void AxisWrapper::set(const MagRequest& request)
string tip_quality_value = request("AXIS_TIP_TITLE_QUALITY");
axis_->tip_quality_ = tip_quality_value;
}
doublearray highlighted_values_value;
for (int i = 0; i < request.countValues("AXIS_HIGHLIGHTED_VALUES"); i++)
highlighted_values_value.push_back((double)request("AXIS_HIGHLIGHTED_VALUES", i));
if ( !highlighted_values_value.empty() )
axis_->highlighted_values_ = highlighted_values_value;
if (request.countValues("AXIS_HIGHLIGHTED_VALUES_THICKNESS") ) {
int highlighted_values_thickness_value = request("AXIS_HIGHLIGHTED_VALUES_THICKNESS");
axis_->highlighted_values_thickness_ = highlighted_values_thickness_value;
}


string method_value = request.countValues("AXIS_TYPE") ? (string) request("AXIS_TYPE") : "regular";
Expand Down Expand Up @@ -280,6 +289,11 @@ void AxisWrapper::set(const MagRequest& request)
axis_->grid_colour_ = unique_ptr<Colour>(MagTranslator<string, Colour>()(grid_colour_value));
}

if (request.countValues("AXIS_GRID_BACKGROUND_COLOUR") ) {
string grid_background_colour_value = request("AXIS_GRID_BACKGROUND_COLOUR");
axis_->grid_background_colour_ = unique_ptr<Colour>(MagTranslator<string, Colour>()(grid_background_colour_value));
}


if (request.countValues("AXIS_GRID_LINE_STYLE") ) {
string grid_style_value = request("AXIS_GRID_LINE_STYLE");
Expand Down Expand Up @@ -333,6 +347,17 @@ void AxisWrapper::set(const MagRequest& request)
axis_->tip_colour_ = unique_ptr<Colour>(MagTranslator<string, Colour>()(tip_colour_value));
}

if (request.countValues("AXIS_HIGHLIGHTED_VALUES_COLOUR") ) {
string highlighted_values_colour_value = request("AXIS_HIGHLIGHTED_VALUES_COLOUR");
axis_->highlighted_values_colour_ = unique_ptr<Colour>(MagTranslator<string, Colour>()(highlighted_values_colour_value));
}


if (request.countValues("AXIS_HIGHLIGHTED_VALUES_STYLE") ) {
string highlighted_values_style_value = request("AXIS_HIGHLIGHTED_VALUES_STYLE");
axis_->highlighted_values_style_ = MagTranslator<string, LineStyle>()(highlighted_values_style_value);
}


}

Expand Down Expand Up @@ -381,3 +406,6 @@ static SimpleObjectMaker<HyperAxisMethodWrapper, AxisMethodWrapper> Axis_axis_ty






Loading

0 comments on commit 85401f7

Please sign in to comment.