diff --git a/src/decoders/GribRegularInterpretor.cc b/src/decoders/GribRegularInterpretor.cc index 87ab4ac6..822e1fa6 100644 --- a/src/decoders/GribRegularInterpretor.cc +++ b/src/decoders/GribRegularInterpretor.cc @@ -566,6 +566,7 @@ void GribRegularInterpretor::interpretAsMatrix(GribDecoder& grib) const { if (jPointsAreConsecutive) { vector* d = new vector(nb); // temporary array + d->resize(nb); double* d1 = &d->front(); // temporary array pointer double* d2 = &u->front(); // final array @@ -581,12 +582,14 @@ void GribRegularInterpretor::interpretAsMatrix(GribDecoder& grib) const { else // otherwise, just copy the array of values as they are { if (v != NULL) { + v->resize(nb); grib_get_double_array(grib.uHandle(), "values", &u->front(), &aux); grib_get_double_array(grib.uHandle(), "values", &u->data_.front(), &aux); grib_get_double_array(grib.vHandle(), "values", &v->front(), &aux); grib_get_double_array(grib.vHandle(), "values", &v->data_.front(), &aux); if (c) { c->data_.resize(nb); + c->resize(nb); grib_get_double_array(grib.cHandle(), "values", &c->front(), &aux); grib_get_double_array(grib.cHandle(), "values", &c->data_.front(), &aux); } @@ -1546,6 +1549,7 @@ void GribRotatedInterpretor::interpretAsMatrix(GribDecoder& grib) const { else // otherwise, just copy the array of values as they are { if (v != NULL) { + v->resize(aux); grib_get_double_array(grib.uHandle(), "values", &u->front(), &aux); grib_get_double_array(grib.uHandle(), "values", &u->data_.front(), &aux); grib_get_double_array(grib.vHandle(), "values", &v->front(), &aux); diff --git a/src/visualisers/IsoPlot.cc b/src/visualisers/IsoPlot.cc index bca07225..4de7fb4f 100644 --- a/src/visualisers/IsoPlot.cc +++ b/src/visualisers/IsoPlot.cc @@ -1677,7 +1677,7 @@ CellArray::CellArray(MatrixHandler& data, IntervalMap& range, const Transfo double missing = data.missing(); - int i = 0; + auto i = points_.begin(); MagLog::dev() << "min = " << data.min() << " max = " << data.max() << endl; for (vector >::iterator xy = xypoints.begin(); xy != xypoints.end(); ++xy) { @@ -1701,7 +1701,7 @@ CellArray::CellArray(MatrixHandler& data, IntervalMap& range, const Transfo else { // cout << "MISSING VALUE-->" << geo->second << ", " << geo->first << endl; } - points_[i] = value; + points_.insert(i, value); i++; ++geo; }