Browse Source

Update michlib, fix errors and warnings

lintest
Michael Uleysky 9 months ago
parent
commit
4627f76a0d
  1. 9
      CMakeLists.txt
  2. 4
      actions/actiongenintfile.h
  3. 6
      actions/actionint.h
  4. 4
      include/actiondep.h
  5. 2
      include/layereddata.h
  6. 2
      michlib
  7. 2
      sources/AVISOLOCAL.h
  8. 2
      sources/BINFILE.h
  9. 10
      sources/VYLET.cpp

9
CMakeLists.txt

@ -39,7 +39,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
include_directories(include sources sources-add GSW-C)
add_compile_options(-Wall)
add_compile_options(-Wall -Wno-deprecated-declarations)
# Dwarf-4 support check
include(CheckCXXCompilerFlag)
@ -54,6 +54,13 @@ if(COMPILER_SUPPORTS_ANALYZER AND STATIC_ANALYZER)
add_compile_options(-fanalyzer)
endif()
# Disable michlib warnings
add_compile_options(-Wno-deprecated-declarations)
CHECK_CXX_COMPILER_FLAG(-Wno-class-memaccess COMPILER_SUPPORTS_CLASSMEMACCESS)
if(COMPILER_SUPPORTS_CLASSMEMACCESS)
add_compile_options(-Wno-class-memaccess)
endif()
add_library(teos STATIC GSW-C/gsw_oceanographic_toolbox.c GSW-C/gsw_saar.c)
set_target_properties(teos PROPERTIES LINKER_LANGUAGE C)

4
actions/actiongenintfile.h

@ -69,7 +69,7 @@ template<class D> MString ActionGenIntFile::DoAction(const CLArgs& args, D& ds)
fw.SetParameter("dx", data.XStep() * 60.0);
fw.SetParameter("dy", data.YStep() * 60.0);
fw.SetParameter("nt", tindexes.size());
fw.SetParameter("dt", (ds.Time(tindexes[1]) - ds.Time(tindexes[0])) / 86400.0);
fw.SetParameter("dt", (ds.Time(tindexes[1]) - ds.Time(tindexes[0])).D());
fw.SetParameter("FillValue", data.Fillval());
fw.UsePrefix("Info");
fw.SetParameter("Mode", mode ? "from ssh" : "normal");
@ -92,7 +92,7 @@ template<class D> MString ActionGenIntFile::DoAction(const CLArgs& args, D& ds)
fw.SetParameter("dotxdotylonlat2v", "(1.852/0.864)*%doty");
fw.SetParameter("BeginDate", ds.Time(tindexes.front()).ToTString());
fw.SetParameter("EndDate", ds.Time(tindexes.back()).ToTString());
fw.SetParameter("Timestep", ds.Time(tindexes[1]) - ds.Time(tindexes[0]));
fw.SetParameter("Timestep", (ds.Time(tindexes[1]) - ds.Time(tindexes[0])).Seconds());
fw.SetParameter("DataID", michlib::UniqueId());
fw.SetParameter("Creation command", args.at("_cmdline"));
}

6
actions/actionint.h

@ -187,9 +187,9 @@ template<class D> MString ActionINT::DoAction(const CLArgs& args, D& ds)
for(size_t j = 0; j < temp.size(); j++) hi.emplace_back(std::move(temp[j]));
}
}
auto step = ds.Time(hiind) - ds.Time(loind);
auto delta = points[i].t - ds.Time(loind);
real trel = static_cast<real>(delta) / static_cast<real>(step);
auto step = (ds.Time(hiind) - ds.Time(loind)).S();
auto delta = (points[i].t - ds.Time(loind)).S();
real trel = delta / step;
fw.Write(points[i].lon0);
fw.Write(points[i].lat0);

4
include/actiondep.h

@ -41,13 +41,13 @@ struct TimeData
for(size_t i = 0; i < steps.size(); i++)
{
auto delta = data.Time(tindexes[i]) - refdate;
while(delta % stepunits[unitind] != 0) unitind++;
while(delta.Seconds() % stepunits[unitind] != 0) unitind++;
}
for(size_t i = 0; i < steps.size(); i++)
{
auto delta = data.Time(tindexes[i]) - refdate;
steps[i] = michlib::int_cast<decltype(steps)::value_type>(delta / stepunits[unitind]);
steps[i] = michlib::int_cast<decltype(steps)::value_type>(delta.Seconds() / stepunits[unitind]);
}
}

2
include/layereddata.h

@ -162,7 +162,7 @@ class LayeredData: public NCFuncs
return times[i];
}
time_t Timestep() const { return isOk() ? (times[1] - times[0]) : 0; }
time_t Timestep() const { return isOk() ? (times[1] - times[0]).Seconds() : 0; }
MString Title() const { return title; }

2
michlib

@ -1 +1 @@
Subproject commit e2882902b88229bb4b0e6fbeb76c79ac6d46d53d
Subproject commit 1b673a0202011d06323f8aebaa7ee58cbc7b0649

2
sources/AVISOLOCAL.h

@ -49,7 +49,7 @@ class AVISOLOCALData: public NCFuncs
return times[i];
}
time_t Timestep() const { return isOk() ? (times[1] - times[0]) : 0; }
time_t Timestep() const { return isOk() ? (times[1] - times[0]).Seconds() : 0; }
explicit operator bool() const { return times.size() > 0; }

2
sources/BINFILE.h

@ -38,7 +38,7 @@ class BINFILEData
return times[i];
}
time_t Timestep() const { return isOk() ? (times[1] - times[0]) : 0; }
time_t Timestep() const { return isOk() ? (times[1] - times[0]).Seconds() : 0; }
explicit operator bool() const { return times.size() > 0; }

10
sources/VYLET.cpp

@ -258,7 +258,7 @@ VYLETData::Data VYLETData::ReadL() const
{
time = R2Time((*vylet)[tcol - 1][iy * lons.size() + ix]);
lambda = (*vylet)[lcol - 1][iy * lons.size() + ix];
days = static_cast<real>(time - start) / MDateTime::secondsperday;
days = (time - start).D();
out(ix, iy) = lambda / days;
}
@ -284,7 +284,7 @@ VYLETData::Data VYLETData::ReadT() const
const real acc = vylet->ParameterRValue("accuracy", 1.0);
const real tstep = 2.0 * M_PI * 1000.0 / acc;
const real maxdays = static_cast<real>(end - start) / MDateTime::secondsperday;
const real maxdays = (end - start).D();
MDateTime time;
real days;
@ -297,7 +297,7 @@ VYLETData::Data VYLETData::ReadT() const
x = (*vylet)[2][iy * lons.size() + ix];
y = (*vylet)[3][iy * lons.size() + ix];
time = R2Time((*vylet)[tcol - 1][iy * lons.size() + ix]);
days = static_cast<real>(time - start) / MDateTime::secondsperday;
days = (time - start).D();
if(days <= tstep * 1.5) days = 0.0;
inside = x > xl && x < xr && y > yd && y < yu;
maxtime = days >= maxdays - tstep * 0.5;
@ -505,7 +505,7 @@ VYLETData::Data VYLETData::ReadTmask() const
const real acc = vylet->ParameterRValue("accuracy", 1.0);
const real tstep = 2.0 * M_PI * 1000.0 / acc;
const real maxdays = static_cast<real>(end - start) / MDateTime::secondsperday;
const real maxdays = (end - start).D();
MDateTime time;
real days;
@ -515,7 +515,7 @@ VYLETData::Data VYLETData::ReadTmask() const
for(size_t ix = 0; ix < lons.size(); ix++)
{
time = R2Time((*vylet)[tcol - 1][iy * lons.size() + ix]);
days = static_cast<real>(time - start) / MDateTime::secondsperday;
days = (time - start).D();
maxtime = days >= maxdays - tstep * 0.5;
out(ix, iy) = maxtime ? 1.0 : NAN;
}

Loading…
Cancel
Save