Browse Source

Fixed some errors

interpolate
Michael Uleysky 2 years ago
parent
commit
0a3e66b506
  1. 8
      include/NEMO.h
  2. 5
      src/actiontsc.cpp

8
include/NEMO.h

@ -101,7 +101,7 @@ class NEMOData
} }
auto unit = f.A<MString>(name, "units"); auto unit = f.A<MString>(name, "units");
if(unit && unit.Get() == "m s-1") unitmul = 100.0; if(unit && (unit.Get() == "m s-1" || unit.Get() == "m/s")) unitmul = 100.0;
Data data((p->xb < p->xe) ? (p->xe - p->xb + 1) : (nx + p->xe - p->xb + 1), p->ye - p->yb + 1, Lon(p->xb), Lat(p->yb), lonstep, latstep); Data data((p->xb < p->xe) ? (p->xe - p->xb + 1) : (nx + p->xe - p->xb + 1), p->ye - p->yb + 1, Lon(p->xb), Lat(p->yb), lonstep, latstep);
@ -352,7 +352,7 @@ class NEMOData
ppar->yb = static_cast<size_t>(Floor((lat1 - latb) / latstep)); ppar->yb = static_cast<size_t>(Floor((lat1 - latb) / latstep));
ppar->ye = static_cast<size_t>(Ceil((lat2 - latb) / latstep)); ppar->ye = static_cast<size_t>(Ceil((lat2 - latb) / latstep));
if(ppar->ye > 2040) ppar->ye = 2040; if(ppar->ye > ny - 1) ppar->ye = ny - 1;
if(ppar->yb >= ppar->ye) return {nullptr, "Latb must be lesser then late"}; if(ppar->yb >= ppar->ye) return {nullptr, "Latb must be lesser then late"};
ppar->xb = static_cast<size_t>(Floor((lon1 - lonb) / lonstep)); ppar->xb = static_cast<size_t>(Floor((lon1 - lonb) / lonstep));
@ -396,8 +396,8 @@ class NEMOData
// clang-format on // clang-format on
} }
real Lon(size_t ix) const { return isOk() ? (-180.0 + ix / 12.0) : -1000.0; } real Lon(size_t ix) const { return isOk() ? (lonb + ix * lonstep) : -1000.0; }
real Lat(size_t iy) const { return isOk() ? (-80.0 + iy / 12.0) : -1000.0; } real Lat(size_t iy) const { return isOk() ? (latb + iy * latstep) : -1000.0; }
real Depth(size_t l) const { return isOk() ? depths[l] : -1000.0; } real Depth(size_t l) const { return isOk() ? depths[l] : -1000.0; }
time_t Timestep() const { return isOk() ? (times[1] - times[0]) : 0; } time_t Timestep() const { return isOk() ? (times[1] - times[0]) : 0; }
MDateTime Time(size_t i) const MDateTime Time(size_t i) const

5
src/actiontsc.cpp

@ -62,7 +62,10 @@ MString Data::ActionTsc(const CLArgs& args)
BaseData data; BaseData data;
if(tindexes.size() == 1) if(tindexes.size() == 1)
{
ind = tindexes[0];
data = std::visit(read, *this); data = std::visit(read, *this);
}
else else
{ {
Averager<BaseData> out; Averager<BaseData> out;
@ -93,6 +96,8 @@ MString Data::ActionTsc(const CLArgs& args)
fw.Write(data.Lat(i)); fw.Write(data.Lat(i));
fw.Write(data(i) == data.Fillval() ? NAN : data(i)); fw.Write(data(i) == data.Fillval() ? NAN : data(i));
} }
fw.Finalize();
fw.Close();
return ""; return "";
} }

Loading…
Cancel
Save