diff --git a/CMakeLists.txt b/CMakeLists.txt index d77c2ec8..ab110b0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..5704b893 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +4.14.1 \ No newline at end of file diff --git a/src/attributes/EpsGraphAttributes.cc b/src/attributes/EpsGraphAttributes.cc index dfb1563b..e6666cc7 100644 --- a/src/attributes/EpsGraphAttributes.cc +++ b/src/attributes/EpsGraphAttributes.cc @@ -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")), @@ -99,7 +99,7 @@ void EpsGraphAttributes::set(const std::map& 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); @@ -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_; @@ -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_; @@ -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\":"; diff --git a/src/attributes/EpsGraphAttributes.h b/src/attributes/EpsGraphAttributes.h index 4b5edc5c..c51a4323 100644 --- a/src/attributes/EpsGraphAttributes.h +++ b/src/attributes/EpsGraphAttributes.h @@ -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_; diff --git a/src/attributes/EpsGraphWrapper.cc b/src/attributes/EpsGraphWrapper.cc index 0d29f71c..f21b51b3 100644 --- a/src/attributes/EpsGraphWrapper.cc +++ b/src/attributes/EpsGraphWrapper.cc @@ -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()(control_value); + epsgraph_->eps_control_ = MagTranslator()(eps_control_value); } if (request.countValues("EPS_CONTROL_LINE_THICKNESS") ) { diff --git a/src/attributes/EpsWaveAttributes.cc b/src/attributes/EpsWaveAttributes.cc index a8b326ff..77fa2086 100644 --- a/src/attributes/EpsWaveAttributes.cc +++ b/src/attributes/EpsWaveAttributes.cc @@ -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")) { @@ -46,6 +47,7 @@ void EpsWaveAttributes::set(const std::map& params) prefix[i++] = "eps_rose_wave"; setAttribute(prefix, "eps_rose_wave_colour", colour_, params); + setAttribute(prefix, "eps_control", eps_control_, params); } @@ -53,6 +55,7 @@ void EpsWaveAttributes::set(const std::map& params) void EpsWaveAttributes::copy(const EpsWaveAttributes& other) { colour_ = other.colour_; + eps_control_ = other.eps_control_; } @@ -92,6 +95,7 @@ void EpsWaveAttributes::print(ostream& out) const { out << "Attributes["; out << " colour = " << colour_; + out << " eps_control = " << eps_control_; out << "]" << "\n"; } @@ -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 eps_rose_wave_colour("eps_rose_wave_colour", stringarray()); +static MagicsParameter eps_control("eps_control", "on"); diff --git a/src/attributes/EpsWaveAttributes.h b/src/attributes/EpsWaveAttributes.h index 2fa412ad..6a63a29a 100644 --- a/src/attributes/EpsWaveAttributes.h +++ b/src/attributes/EpsWaveAttributes.h @@ -51,6 +51,7 @@ class EpsWaveAttributes // -- members: string tag_; stringarray colour_; + bool eps_control_; private: diff --git a/src/attributes/EpsWaveWrapper.cc b/src/attributes/EpsWaveWrapper.cc index c4a145e6..7e14c28d 100644 --- a/src/attributes/EpsWaveWrapper.cc +++ b/src/attributes/EpsWaveWrapper.cc @@ -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()(eps_control_value); + + } } diff --git a/src/attributes/TextVisitorAttributes.cc b/src/attributes/TextVisitorAttributes.cc index e1f7aed7..6cf849b2 100644 --- a/src/attributes/TextVisitorAttributes.cc +++ b/src/attributes/TextVisitorAttributes.cc @@ -277,6 +277,8 @@ bool TextVisitorAttributes::accept(const string& node) if ( magCompare(node, "text") ) return true; + if ( magCompare(node, "ztext") ) + return true; return false; } @@ -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 ) diff --git a/src/basic/XmlMagics.cc b/src/basic/XmlMagics.cc index 9a452df5..1b1263d6 100644 --- a/src/basic/XmlMagics.cc +++ b/src/basic/XmlMagics.cc @@ -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; diff --git a/src/params/EpsGraph.xml b/src/params/EpsGraph.xml index 6388879d..9177b016 100644 --- a/src/params/EpsGraph.xml +++ b/src/params/EpsGraph.xml @@ -187,12 +187,12 @@ does it submit to any jurisdiction. name="eps_deterministic_legend_text"> Text to be used in the legend - - plot the deterministic Forecast + plot the control Forecast Rose wind darker colour + + plot the control Forecast + diff --git a/src/params/TextVisitor.xml b/src/params/TextVisitor.xml index 54ee230a..a860b6ae 100644 --- a/src/params/TextVisitor.xml +++ b/src/params/TextVisitor.xml @@ -7,11 +7,12 @@ granted to it by virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. --> - diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index ddba2ae9..44f1c65d 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -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); @@ -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 diff --git a/src/visualisers/EpsGraph.h b/src/visualisers/EpsGraph.h index 849dded9..0d7854fe 100644 --- a/src/visualisers/EpsGraph.h +++ b/src/visualisers/EpsGraph.h @@ -34,6 +34,7 @@ #include "EpsPlumeAttributes.h" #include "EpsShadeAttributes.h" #include "EpsWindAttributes.h" +#include "EpsWaveAttributes.h" #include "BasicGraphicsObject.h" @@ -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&) {} // EpsWindAttributes::set(map); } - void set(const XmlNode&) {} // EpsWindAttributes::set(node); } + void set(const map& 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; diff --git a/src/visualisers/IsoPlot.cc b/src/visualisers/IsoPlot.cc index bca07225..016f728d 100644 --- a/src/visualisers/IsoPlot.cc +++ b/src/visualisers/IsoPlot.cc @@ -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()); diff --git a/src/visualisers/IsoShading.h b/src/visualisers/IsoShading.h index 64931e41..641c2afd 100644 --- a/src/visualisers/IsoShading.h +++ b/src/visualisers/IsoShading.h @@ -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). @@ -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& range, const Transformation& transformation, int width, int height, float resolution, const string& technique) override { diff --git a/src/web/WrepJSon.cc b/src/web/WrepJSon.cc index e1bd8274..3627a34c 100644 --- a/src/web/WrepJSon.cc +++ b/src/web/WrepJSon.cc @@ -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_);