Skip to content

Commit

Permalink
Revert in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvielamythepaut committed Nov 22, 2023
1 parent 7c1910a commit 5950f35
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 35 deletions.
10 changes: 6 additions & 4 deletions src/basic/FortranMagics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* nor does it submit to any jurisdiction.
*/

/*! \file FortranMagics.cc
/*! \file ics.cc
\brief Implementation of the Template class FortranMagics.
Magics Team - ECMWF 2007
Expand Down Expand Up @@ -435,7 +435,9 @@ void FortranMagics::pobs() {
if (!action_ || obsinput_todo_ ) {
action_ = new VisualAction();
ObsDecoder* obs = new ObsDecoder();
cout << "OBS" << endl;
if (obs->defined()) {
cout << "defined" << endl;
action_->data(obs);
top()->push_back(action_);

Expand All @@ -446,9 +448,9 @@ void FortranMagics::pobs() {
top()->push_back(action_);
}
}
action_ = new VisualAction();
action_->data(new ObsJSon());
top()->push_back(action_);
// action_ = new VisualAction();
// action_->data(new ObsJSon());
// top()->push_back(action_);
action_->visdef(new ObsPlotting());

}
Expand Down
16 changes: 10 additions & 6 deletions src/decoders/GribDecoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -760,20 +760,21 @@ void GribDecoder::openField() {

void GribDecoder::openFirstComponent() {
current_position_ = position_1_;

if (second_file_name_ == "grib_input_file_name") {
current_position_ = ( position_2_ == -1 ) ? 2 : position_2_;

if (first_file_name_ == "grib_input_file_name") {
current_file_name_= file_name_;
}
else {
current_position_ = ( position_2_ == -1 ) ? 1 : position_2_;
current_file_name_= second_file_name_;
current_file_name_= first_file_name_;
}

MagLog::debug() << "received-> " << current_position_ << " from file " << current_file_name_ <<endl;
field_ = open(NULL, false);

}

void GribDecoder::openSecondComponent() {
MagLog::debug() << "received-> " << position_2_ << " from file " << second_file_name_ <<endl;


if (second_file_name_ == "grib_input_file_name") {
current_position_ = ( position_2_ == -1 ) ? 2 : position_2_;
Expand Down Expand Up @@ -1676,6 +1677,7 @@ string GribDecoder::representation() {
// Now warning, no caching
string proj = getstring("projTargetString", false, false);
// Here if proj contains latlong we ignore the setting .

if (proj.find("longlat") != std::string::npos)
proj = "";

Expand Down Expand Up @@ -2495,7 +2497,9 @@ void GribDecoder::uComponent() {
string name;
grib_handle* handle = uHandle(name);


grib_get_size(handle, "values", &nb);

xValues_ = new double[nb];
grib_get_double_array(handle, "values", xValues_, &nb);
}
Expand Down
2 changes: 1 addition & 1 deletion src/decoders/GribRegularInterpretor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ void GribProjInterpretor::interpretAsMatrix(GribDecoder& grib) const {
if (MagicsGlobal::strict()) {
throw;
}
throw MagicsException("GribRegularInterpretor - Not enough memory");
throw MagicsException("GribProjInterpretor - Not enough memory");
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/visualisers/GradientsColourTechnique.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,15 @@ void GradientsColourTechnique::set(LevelSelection& out, LevelSelection& in, Colo
double to = stops[stop];
int istep = (steps_.empty()) ? 10 : *step;

in.push_back(from);

out.push_back(from);

double inc = (to - from) / (istep);

for (int i = 1; i < istep; i++) {
in.push_back(from + (i * inc));

out.push_back(from + (i * inc));

}

if (!steps_.empty()) {
Expand All @@ -162,6 +163,7 @@ void GradientsColourTechnique::set(LevelSelection& out, LevelSelection& in, Colo
}
in.push_back(stops.back());
out.push_back(stops.back());

}

/*!
Expand Down
44 changes: 23 additions & 21 deletions src/visualisers/IntervalSelectionType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,47 +40,49 @@ void IntervalSelectionType::print(ostream& out) const {
out << "]";
}


#define MINSET(v) !same(v, -1.0e+21)
#define MAXSET(v) !same(v, +1.0e+21)
void IntervalSelectionType::calculate(double min, double max, bool shading) {
clear();
std::set<double> levels;


double lmax, lmin;
if (shading) {
if (max_shade_ < min_shade_)
MagLog::warning() << "contour_shade_max_level (" << max_shade_ << ") < contour_shade_min_level ("
<< min_shade_ << "): Please check your code" << endl;
if (same(max_, 1.0e+21)) {
max_ = max_shade_;
}
if (same(min_, -1.0e+21)) {
min_ = min_shade_;
}
}

double min_level=min;
double max_level=max;

lmax = same(max_, 1.0e+21) ? max : max_;
lmin = same(min_, -1.0e+21) ? min : min_;
if ( MINSET(min_) )
min_level = min_;

if ( MAXSET(max_) )
max_level = max_;

if ( shading && MINSET(min_shade_) )
min_level = min_shade_;

if ( shading && MAXSET(max_shade_) )
max_level = max_shade_;


levels.insert(lmin);
levels.insert(lmax);

levels.insert(min_level);
levels.insert(max_level);


double level = reference_;
double newref;

int i = 1;
while (level < lmax && !same(level, lmax)) {
if (level > lmin)
while (level < max_level && !same(level, max_level)) {
if (level > min_level)
levels.insert(level);
level = reference_ + (i * interval_);
i++;
}
level = reference_;
i = 1;
while (level > lmin && !same(level, lmin)) {
if (level < lmax)
while (level > min_level && !same(level, min_level)) {
if (level < max_level)
levels.insert(level);
level = reference_ - (i * interval_);
i++;
Expand Down

0 comments on commit 5950f35

Please sign in to comment.