Skip to content

Commit

Permalink
Pull request #211: Hotfix/4.14.1
Browse files Browse the repository at this point in the history
Merge in MAG/magics from hotfix/4.14.1 to master

* commit 'e77d55bf7fb1c69c7af7679ded86a56185882d82':
  VERSION 4.14.1
  Magics : contour_shade_max/min_level wher used evne idf contour_shade was off . [SD-79687]
  e-suite: Improve formatting of eps_heigth
  e-suite: Improve formatting of eps_heigth
  E-Suite ecCharts : eps_control = off  will not show the control anymore in epswave
  E-Suite ecCharts : allow a second text "ztext" in a page
  E-Suite ecCharts : allow a second text "ztext" in a page
  E-Suite ecCharts : eps_control = off  will not show the control anymore
  E-Suite ecCharts : eps_control = off  will not show the control anymore
  Next Version 4.15.0
  • Loading branch information
sylvielamythepaut committed Jul 10, 2023
2 parents 93446e3 + e77d55b commit b71f6bc
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 29 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ 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.14.0 LANGUAGES CXX )

# In prepaation for hotfix of 4.14.0
project( magics 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
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.14.1
10 changes: 5 additions & 5 deletions src/attributes/EpsGraphAttributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ EpsGraphAttributes::EpsGraphAttributes():
deterministic_(ParameterManager::getBool("eps_deterministic")),
deterministic_thickness_(ParameterManager::getInt("eps_deterministic_line_thickness")),
deterministic_legend_(ParameterManager::getString("eps_deterministic_legend_text")),
control_(ParameterManager::getBool("eps_control")),
eps_control_(ParameterManager::getBool("eps_control")),
control_thickness_(ParameterManager::getInt("eps_control_line_thickness")),
control_legend_(ParameterManager::getString("eps_control_legend_text")),
legend_(ParameterManager::getBool("legend")),
Expand Down Expand Up @@ -99,7 +99,7 @@ void EpsGraphAttributes::set(const std::map<string, string>& params)
setAttribute(prefix, "eps_deterministic", deterministic_, params);
setAttribute(prefix, "eps_deterministic_line_thickness", deterministic_thickness_, params);
setAttribute(prefix, "eps_deterministic_legend_text", deterministic_legend_, params);
setAttribute(prefix, "eps_control", control_, params);
setAttribute(prefix, "eps_control", eps_control_, params);
setAttribute(prefix, "eps_control_line_thickness", control_thickness_, params);
setAttribute(prefix, "eps_control_legend_text", control_legend_, params);
setAttribute(prefix, "legend", legend_, params);
Expand Down Expand Up @@ -141,7 +141,7 @@ void EpsGraphAttributes::copy(const EpsGraphAttributes& other)
deterministic_ = other.deterministic_;
deterministic_thickness_ = other.deterministic_thickness_;
deterministic_legend_ = other.deterministic_legend_;
control_ = other.control_;
eps_control_ = other.eps_control_;
control_thickness_ = other.control_thickness_;
control_legend_ = other.control_legend_;
legend_ = other.legend_;
Expand Down Expand Up @@ -215,7 +215,7 @@ void EpsGraphAttributes::print(ostream& out) const
out << " deterministic = " << deterministic_;
out << " deterministic_thickness = " << deterministic_thickness_;
out << " deterministic_legend = " << deterministic_legend_;
out << " control = " << control_;
out << " eps_control = " << eps_control_;
out << " control_thickness = " << control_thickness_;
out << " control_legend = " << control_legend_;
out << " legend = " << legend_;
Expand Down Expand Up @@ -279,7 +279,7 @@ void EpsGraphAttributes::toxml(ostream& out) const
out << ", \"eps_deterministic_legend_text\":";
niceprint(out,deterministic_legend_);
out << ", \"eps_control\":";
niceprint(out,control_);
niceprint(out,eps_control_);
out << ", \"eps_control_line_thickness\":";
niceprint(out,control_thickness_);
out << ", \"eps_control_legend_text\":";
Expand Down
2 changes: 1 addition & 1 deletion src/attributes/EpsGraphAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class EpsGraphAttributes
bool deterministic_;
int deterministic_thickness_;
string deterministic_legend_;
bool control_;
bool eps_control_;
int control_thickness_;
string control_legend_;
bool legend_;
Expand Down
4 changes: 2 additions & 2 deletions src/attributes/EpsGraphWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ void EpsGraphWrapper::set(const MagRequest& request)
epsgraph_->deterministic_legend_ = deterministic_legend_value;
}
if (request.countValues("EPS_CONTROL") ) {
string control_value = request("EPS_CONTROL");
string eps_control_value = request("EPS_CONTROL");

epsgraph_->control_ = MagTranslator<string, bool>()(control_value);
epsgraph_->eps_control_ = MagTranslator<string, bool>()(eps_control_value);

}
if (request.countValues("EPS_CONTROL_LINE_THICKNESS") ) {
Expand Down
9 changes: 8 additions & 1 deletion src/attributes/EpsWaveAttributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
using namespace magics;

EpsWaveAttributes::EpsWaveAttributes():
colour_(ParameterManager::getStringArray("eps_rose_wave_colour"))
colour_(ParameterManager::getStringArray("eps_rose_wave_colour")),
eps_control_(ParameterManager::getBool("eps_control"))


{
Expand All @@ -46,13 +47,15 @@ void EpsWaveAttributes::set(const std::map<string, string>& params)
prefix[i++] = "eps_rose_wave";

setAttribute(prefix, "eps_rose_wave_colour", colour_, params);
setAttribute(prefix, "eps_control", eps_control_, params);


}

void EpsWaveAttributes::copy(const EpsWaveAttributes& other)
{
colour_ = other.colour_;
eps_control_ = other.eps_control_;

}

Expand Down Expand Up @@ -92,6 +95,7 @@ void EpsWaveAttributes::print(ostream& out) const
{
out << "Attributes[";
out << " colour = " << colour_;
out << " eps_control = " << eps_control_;

out << "]" << "\n";
}
Expand All @@ -101,7 +105,10 @@ void EpsWaveAttributes::toxml(ostream& out) const
out << "\"epswave\"";
out << ", \"eps_rose_wave_colour\":";
niceprint(out,colour_);
out << ", \"eps_control\":";
niceprint(out,eps_control_);

}

static MagicsParameter<stringarray> eps_rose_wave_colour("eps_rose_wave_colour", stringarray());
static MagicsParameter<string> eps_control("eps_control", "on");
1 change: 1 addition & 0 deletions src/attributes/EpsWaveAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class EpsWaveAttributes
// -- members:
string tag_;
stringarray colour_;
bool eps_control_;


private:
Expand Down
6 changes: 6 additions & 0 deletions src/attributes/EpsWaveWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ void EpsWaveWrapper::set(const MagRequest& request)
colour_value.push_back((string)request("EPS_ROSE_WAVE_COLOUR", i));
if ( !colour_value.empty() )
epswave_->colour_ = colour_value;
if (request.countValues("EPS_CONTROL") ) {
string eps_control_value = request("EPS_CONTROL");

epswave_->eps_control_ = MagTranslator<string, bool>()(eps_control_value);

}


}
Expand Down
4 changes: 4 additions & 0 deletions src/attributes/TextVisitorAttributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ bool TextVisitorAttributes::accept(const string& node)

if ( magCompare(node, "text") )
return true;
if ( magCompare(node, "ztext") )
return true;

return false;
}
Expand All @@ -290,6 +292,8 @@ void TextVisitorAttributes::set(const XmlNode& node)

if ( magCompare(node.name(), "text") )
apply = true;
if ( magCompare(node.name(), "ztext") )
apply = true;


if ( apply )
Expand Down
1 change: 1 addition & 0 deletions src/basic/XmlMagics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ XmlMagics::XmlMagics() : root_(0), gribloop_(0), geographical_(true), driversToS
actions_["mgb"] = &XmlMagics::binary;

actions_["text"] = &XmlMagics::text;
actions_["ztext"] = &XmlMagics::text;
actions_["map"] = &XmlMagics::map;
actions_["matrix"] = &XmlMagics::matrix;
actions_["cartesian"] = &XmlMagics::cartesian;
Expand Down
4 changes: 2 additions & 2 deletions src/params/EpsGraph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ does it submit to any jurisdiction.
name="eps_deterministic_legend_text">
<documentation>Text to be used in the legend</documentation>
</parameter>
<parameter member="control"
<parameter member="eps_control"
to="bool"
default="on"
from="string"
name="eps_control">
<documentation>plot the deterministic Forecast</documentation>
<documentation>plot the control Forecast</documentation>
</parameter>
<parameter member="control_colour"
to="Colour"
Expand Down
7 changes: 7 additions & 0 deletions src/params/EpsWave.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ does it submit to any jurisdiction.
name="eps_rose_wave_colour">
<documentation>Rose wind darker colour</documentation>
</parameter>
<parameter member="eps_control"
to="bool"
default="on"
from="string"
name="eps_control">
<documentation>plot the control Forecast</documentation>
</parameter>
</class>
</magics>
3 changes: 2 additions & 1 deletion src/params/TextVisitor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ granted to it by virtue of its status as an intergovernmental organisation nor
does it submit to any jurisdiction.
-->
<magics>
<class xmltag="text"
<class
name="TextVisitor"
xml_data="text_lines"
directory="basic"
prefix="text"
xmltag="text/ztext"
xml_doc_inherits="XmlBasicNode"
action="ptext">
<documentation></documentation>
Expand Down
28 changes: 17 additions & 11 deletions src/visualisers/EpsGraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,10 @@ magics::Polyline* EpsGraph::newForecast() {
}

void EpsGraph::pushControl(magics::Polyline* control, BasicGraphicsObjectContainer& visitor) {
if ( !eps_control_ ) {
control_ = false;
return;
}
const Transformation& transformation = visitor.transformation();
if (!control->empty() && whisker_) {
transformation(*control, visitor);
Expand Down Expand Up @@ -1689,17 +1693,19 @@ void EpsWave::operator()(Data& data, BasicGraphicsObjectContainer& visitor) {
}

// Draw the Control
if (point->find("control") != point->end()) {
magics::Polyline* control = new magics::Polyline();
control->setColour(Colour("red"));
control->setThickness(2);
control->setLineStyle(LineStyle::DASH);

double angle = (*point)["control"] - 180.;

control->push_back(PaperPoint(x, 0));
control->push_back(PaperPoint(x + (l100 * sin(angle * (3.14 / 180.))), l100 * cos(angle * (3.14 / 180.))));
visitor.push_back(control);
if (eps_control_) {
if (point->find("control") != point->end()) {
magics::Polyline* control = new magics::Polyline();
control->setColour(Colour("red"));
control->setThickness(2);
control->setLineStyle(LineStyle::DASH);

double angle = (*point)["control"] - 180.;

control->push_back(PaperPoint(x, 0));
control->push_back(PaperPoint(x + (l100 * sin(angle * (3.14 / 180.))), l100 * cos(angle * (3.14 / 180.))));
visitor.push_back(control);
}
}

// Draw the Forecast
Expand Down
7 changes: 4 additions & 3 deletions src/visualisers/EpsGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "EpsPlumeAttributes.h"
#include "EpsShadeAttributes.h"
#include "EpsWindAttributes.h"
#include "EpsWaveAttributes.h"


#include "BasicGraphicsObject.h"
Expand Down Expand Up @@ -257,13 +258,13 @@ class EpsBar : public Visdef, public EpsCloudAttributes {
}
};

class EpsWave : public Visdef {
class EpsWave : public EpsWaveAttributes, public Visdef {
public:
EpsWave() {}
virtual ~EpsWave() override {}
// Implements the set method ...
void set(const map<string, string>&) {} // EpsWindAttributes::set(map); }
void set(const XmlNode&) {} // EpsWindAttributes::set(node); }
void set(const map<string, string>& map) override { EpsWaveAttributes::set(map); } // EpsWindAttributes::set(map); }
void set(const XmlNode& node) override { EpsWaveAttributes::set(node) ;} // EpsWindAttributes::set(node); }

virtual void operator()(Data&, BasicGraphicsObjectContainer&) override;
virtual void visit(LegendVisitor&) override;
Expand Down
2 changes: 1 addition & 1 deletion src/visualisers/IsoPlot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ bool IsoPlot::prepare(MatrixHandler& data) {
double min = data.min();
double max = data.max();
(*levelSelection_).clear();
(*levelSelection_).calculate(min, max, true);
(*levelSelection_).calculate(min, max, shading_->isShading());
bool need_isolines = (*shading_)(*levelSelection_);
shading_->reset();
(*label_).prepare(*levelSelection_, (*colour_).name());
Expand Down
3 changes: 3 additions & 0 deletions src/visualisers/IsoShading.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class NoIsoShading {
virtual bool needClipping() { return false; }
virtual bool method(ContourMethod*) { return false; }
virtual void reset() {}
virtual bool isShading() { return false; }

protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
Expand Down Expand Up @@ -109,6 +110,8 @@ class IsoShading : public NoIsoShading, public IsoShadingAttributes {
object->copy(*this);
return object;
}

bool isShading() override { return true; }

CellArray* array(MatrixHandler& matrix, IntervalMap<int>& range, const Transformation& transformation, int width,
int height, float resolution, const string& technique) override {
Expand Down
2 changes: 1 addition & 1 deletion src/web/WrepJSon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ void WrepJSon::visit(TextVisitor& text) {
text.update("json", "station_name", station_name_);
if (!expver_.empty() && expver_ != "0001")
text.update("json", "expver", " [" + expver_ + "] ");
text.update("json", "ens_height", tostring(epsz_));
text.update("json", "ens_height", tostring(maground(epsz_)));
}

text.update("json", "product_info", product_info_);
Expand Down

0 comments on commit b71f6bc

Please sign in to comment.