Skip to content

Commit

Permalink
Pull request #209: release 4.14.0
Browse files Browse the repository at this point in the history
Merge in MAG/magics from develop to master

* commit 'b8f792639f160cbab5a7ac2ff2ebb49cd4fc6c49':
  Magics-Metview : Fixing GribWrapper
  Magics-Metview : For now ignore setting of large offsets
  Fixing isusue with Metview Wrapper [MAGP-1357]
  Magics : grib_file_address_mode="byte_offset" not working for large files [MAGP-1357] Advanced wind plotting hangs when no values found above min speed[MAGP-1355]
  ECC-1552-projString : ignore projString if the filed is on latlon.
  Netcdf : fix compilation issues
  Visvility graph : adding wrepjson_y_axis_value to allow more that one parameters  on the same graph.
  Axis: axis_grid_background_colour  ( none) background colour for axis.
  Netcdf Plotting : fix bug in the interpretation of the date in hivmoller plots type
  Work on visibility epsgrams.
  EpsPlumes: add labels for the background
  Improve handling of epsplumes background
  Add error handling on epsplumes background
  Adding the possibility to add a background the the EpsPlumes.
  Update version number to 4.14.0
  • Loading branch information
sylvielamythepaut committed Apr 20, 2023
2 parents 68aa989 + b8f7926 commit f033a86
Show file tree
Hide file tree
Showing 40 changed files with 504 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake")
find_package( ecbuild 3.4 REQUIRED )

project( magics VERSION 4.13.0 LANGUAGES CXX )
project( magics VERSION 4.14.0 LANGUAGES CXX )

# make sure that the header files are installed into include/magics
# note that this needs to be done before ecbuild_declare_project()
Expand Down
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
7 changes: 7 additions & 0 deletions src/attributes/AxisAttributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ AxisAttributes::AxisAttributes():
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 Down Expand Up @@ -152,6 +153,7 @@ void AxisAttributes::set(const std::map<string, string>& 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 Down Expand Up @@ -217,6 +219,7 @@ void AxisAttributes::copy(const AxisAttributes& other)
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 Down Expand Up @@ -319,6 +322,7 @@ void AxisAttributes::print(ostream& out) const
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 Down Expand Up @@ -434,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 Down Expand Up @@ -509,6 +515,7 @@ 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 Down
1 change: 1 addition & 0 deletions src/attributes/AxisAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class AxisAttributes
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 Down
6 changes: 6 additions & 0 deletions src/attributes/AxisWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,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 @@ -403,3 +408,4 @@ static SimpleObjectMaker<HyperAxisMethodWrapper, AxisMethodWrapper> Axis_axis_ty




53 changes: 51 additions & 2 deletions src/attributes/EpsPlumeAttributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ EpsPlumeAttributes::EpsPlumeAttributes():
median_line_thickness_(ParameterManager::getInt("eps_plume_median_line_thickness")),
shading_(ParameterManager::getBool("eps_plume_shading")),
shading_levels_(ParameterManager::getDoubleArray("eps_plume_shading_level_list")),
shading_colours_(ParameterManager::getStringArray("eps_plume_shading_colour_list"))
shading_colours_(ParameterManager::getStringArray("eps_plume_shading_colour_list")),
background_level_list_(ParameterManager::getDoubleArray("eps_plume_background_level_list")),
background_colour_list_(ParameterManager::getStringArray("eps_plume_background_colour_list")),
background_label_list_(ParameterManager::getStringArray("eps_plume_background_label_list")),
background_label_font_(ParameterManager::getString("eps_plume_background_label_font")),
background_label_font_size_(ParameterManager::getDouble("eps_plume_background_label_font_size")),
background_label_font_style_(ParameterManager::getString("eps_plume_background_label_font_style"))
,
line_colour_(MagTranslator<string, Colour>().magics("eps_plume_line_colour")),
line_style_(MagTranslator<string, LineStyle>().magics("eps_plume_line_style")),
Expand All @@ -46,7 +52,8 @@ EpsPlumeAttributes::EpsPlumeAttributes():
control_line_colour_(MagTranslator<string, Colour>().magics("eps_plume_control_line_colour")),
control_line_style_(MagTranslator<string, LineStyle>().magics("eps_plume_control_line_style")),
median_line_colour_(MagTranslator<string, Colour>().magics("eps_plume_median_line_colour")),
median_line_style_(MagTranslator<string, LineStyle>().magics("eps_plume_median_line_style"))
median_line_style_(MagTranslator<string, LineStyle>().magics("eps_plume_median_line_style")),
background_label_font_colour_(MagTranslator<string, Colour>().magics("eps_plume_background_label_font_colour"))

{
}
Expand Down Expand Up @@ -78,6 +85,12 @@ void EpsPlumeAttributes::set(const std::map<string, string>& params)
setAttribute(prefix, "eps_plume_shading", shading_, params);
setAttribute(prefix, "eps_plume_shading_level_list", shading_levels_, params);
setAttribute(prefix, "eps_plume_shading_colour_list", shading_colours_, params);
setAttribute(prefix, "eps_plume_background_level_list", background_level_list_, params);
setAttribute(prefix, "eps_plume_background_colour_list", background_colour_list_, params);
setAttribute(prefix, "eps_plume_background_label_list", background_label_list_, params);
setAttribute(prefix, "eps_plume_background_label_font", background_label_font_, params);
setAttribute(prefix, "eps_plume_background_label_font_size", background_label_font_size_, params);
setAttribute(prefix, "eps_plume_background_label_font_style", background_label_font_style_, params);

setMember(prefix, "eps_plume_line_colour", line_colour_, params);
setAttribute(prefix, "eps_plume_line_style", line_style_, params);
Expand All @@ -87,6 +100,7 @@ void EpsPlumeAttributes::set(const std::map<string, string>& params)
setAttribute(prefix, "eps_plume_control_line_style", control_line_style_, params);
setMember(prefix, "eps_plume_median_line_colour", median_line_colour_, params);
setAttribute(prefix, "eps_plume_median_line_style", median_line_style_, params);
setMember(prefix, "eps_plume_background_label_font_colour", background_label_font_colour_, params);

}

Expand All @@ -105,6 +119,12 @@ void EpsPlumeAttributes::copy(const EpsPlumeAttributes& other)
shading_ = other.shading_;
shading_levels_ = other.shading_levels_;
shading_colours_ = other.shading_colours_;
background_level_list_ = other.background_level_list_;
background_colour_list_ = other.background_colour_list_;
background_label_list_ = other.background_label_list_;
background_label_font_ = other.background_label_font_;
background_label_font_size_ = other.background_label_font_size_;
background_label_font_style_ = other.background_label_font_style_;
line_colour_ = unique_ptr<Colour>(other.line_colour_->clone());
line_style_ = other.line_style_;
forecast_line_colour_ = unique_ptr<Colour>(other.forecast_line_colour_->clone());
Expand All @@ -113,6 +133,7 @@ void EpsPlumeAttributes::copy(const EpsPlumeAttributes& other)
control_line_style_ = other.control_line_style_;
median_line_colour_ = unique_ptr<Colour>(other.median_line_colour_->clone());
median_line_style_ = other.median_line_style_;
background_label_font_colour_ = unique_ptr<Colour>(other.background_label_font_colour_->clone());

}

Expand Down Expand Up @@ -164,6 +185,12 @@ void EpsPlumeAttributes::print(ostream& out) const
out << " shading = " << shading_;
out << " shading_levels = " << shading_levels_;
out << " shading_colours = " << shading_colours_;
out << " background_level_list = " << background_level_list_;
out << " background_colour_list = " << background_colour_list_;
out << " background_label_list = " << background_label_list_;
out << " background_label_font = " << background_label_font_;
out << " background_label_font_size = " << background_label_font_size_;
out << " background_label_font_style = " << background_label_font_style_;
out << " line_colour = " << *line_colour_;
out << " line_style = " << line_style_;
out << " forecast_line_colour = " << *forecast_line_colour_;
Expand All @@ -172,6 +199,7 @@ void EpsPlumeAttributes::print(ostream& out) const
out << " control_line_style = " << control_line_style_;
out << " median_line_colour = " << *median_line_colour_;
out << " median_line_style = " << median_line_style_;
out << " background_label_font_colour = " << *background_label_font_colour_;

out << "]" << "\n";
}
Expand Down Expand Up @@ -205,6 +233,18 @@ void EpsPlumeAttributes::toxml(ostream& out) const
niceprint(out,shading_levels_);
out << ", \"eps_plume_shading_colour_list\":";
niceprint(out,shading_colours_);
out << ", \"eps_plume_background_level_list\":";
niceprint(out,background_level_list_);
out << ", \"eps_plume_background_colour_list\":";
niceprint(out,background_colour_list_);
out << ", \"eps_plume_background_label_list\":";
niceprint(out,background_label_list_);
out << ", \"eps_plume_background_label_font\":";
niceprint(out,background_label_font_);
out << ", \"eps_plume_background_label_font_size\":";
niceprint(out,background_label_font_size_);
out << ", \"eps_plume_background_label_font_style\":";
niceprint(out,background_label_font_style_);
out << ", \"eps_plume_line_colour\":";
niceprint(out, *line_colour_);
out << ", \"eps_plume_line_style\":";
Expand All @@ -221,6 +261,8 @@ void EpsPlumeAttributes::toxml(ostream& out) const
niceprint(out, *median_line_colour_);
out << ", \"eps_plume_median_line_style\":";
niceprint(out, median_line_style_);
out << ", \"eps_plume_background_label_font_colour\":";
niceprint(out, *background_label_font_colour_);

}

Expand All @@ -237,6 +279,12 @@ static MagicsParameter<int> eps_plume_median_line_thickness("eps_plume_median_li
static MagicsParameter<string> eps_plume_shading("eps_plume_shading", "off");
static MagicsParameter<doublearray> eps_plume_shading_level_list("eps_plume_shading_level_list", floatarray());
static MagicsParameter<stringarray> eps_plume_shading_colour_list("eps_plume_shading_colour_list", stringarray());
static MagicsParameter<doublearray> eps_plume_background_level_list("eps_plume_background_level_list", floatarray());
static MagicsParameter<stringarray> eps_plume_background_colour_list("eps_plume_background_colour_list", stringarray());
static MagicsParameter<stringarray> eps_plume_background_label_list("eps_plume_background_label_list", stringarray());
static MagicsParameter<string> eps_plume_background_label_font("eps_plume_background_label_font", "sansserif");
static MagicsParameter<double> eps_plume_background_label_font_size("eps_plume_background_label_font_size", 0.25);
static MagicsParameter<string> eps_plume_background_label_font_style("eps_plume_background_label_font_style", "");
static MagicsParameter<string> eps_plume_line_colour("eps_plume_line_colour", "magenta");
static MagicsParameter<string> eps_plume_line_style("eps_plume_line_style", "solid");
static MagicsParameter<string> eps_plume_forecast_line_colour("eps_plume_forecast_line_colour", "cyan");
Expand All @@ -245,3 +293,4 @@ static MagicsParameter<string> eps_plume_control_line_colour("eps_plume_control_
static MagicsParameter<string> eps_plume_control_line_style("eps_plume_control_line_style", "solid");
static MagicsParameter<string> eps_plume_median_line_colour("eps_plume_median_line_colour", "cyan");
static MagicsParameter<string> eps_plume_median_line_style("eps_plume_median_line_style", "solid");
static MagicsParameter<string> eps_plume_background_label_font_colour("eps_plume_background_label_font_colour", "black");
7 changes: 7 additions & 0 deletions src/attributes/EpsPlumeAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ class EpsPlumeAttributes
bool shading_;
doublearray shading_levels_;
stringarray shading_colours_;
doublearray background_level_list_;
stringarray background_colour_list_;
stringarray background_label_list_;
string background_label_font_;
double background_label_font_size_;
string background_label_font_style_;
unique_ptr<Colour> line_colour_;
LineStyle line_style_;
unique_ptr<Colour> forecast_line_colour_;
Expand All @@ -72,6 +78,7 @@ class EpsPlumeAttributes
LineStyle control_line_style_;
unique_ptr<Colour> median_line_colour_;
LineStyle median_line_style_;
unique_ptr<Colour> background_label_font_colour_;


private:
Expand Down
Loading

0 comments on commit f033a86

Please sign in to comment.