diff --git a/include/NEMO.h b/include/NEMO.h index e1c87b1..e907499 100644 --- a/include/NEMO.h +++ b/include/NEMO.h @@ -101,7 +101,7 @@ class NEMOData } auto unit = f.A(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); @@ -352,7 +352,7 @@ class NEMOData ppar->yb = static_cast(Floor((lat1 - latb) / latstep)); ppar->ye = static_cast(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"}; ppar->xb = static_cast(Floor((lon1 - lonb) / lonstep)); @@ -396,8 +396,8 @@ class NEMOData // clang-format on } - real Lon(size_t ix) const { return isOk() ? (-180.0 + ix / 12.0) : -1000.0; } - real Lat(size_t iy) const { return isOk() ? (-80.0 + iy / 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() ? (latb + iy * latstep) : -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; } MDateTime Time(size_t i) const diff --git a/src/actiontsc.cpp b/src/actiontsc.cpp index f4b408a..ba9eaf2 100644 --- a/src/actiontsc.cpp +++ b/src/actiontsc.cpp @@ -62,7 +62,10 @@ MString Data::ActionTsc(const CLArgs& args) BaseData data; if(tindexes.size() == 1) + { + ind = tindexes[0]; data = std::visit(read, *this); + } else { Averager out; @@ -93,6 +96,8 @@ MString Data::ActionTsc(const CLArgs& args) fw.Write(data.Lat(i)); fw.Write(data(i) == data.Fillval() ? NAN : data(i)); } + fw.Finalize(); + fw.Close(); return ""; }