|
|
|
#pragma once
|
|
|
|
#include "mregex.h"
|
|
|
|
#include "ncfuncs.h"
|
|
|
|
#include "simple2ddata.h"
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
using michlib::Ceil;
|
|
|
|
using michlib::DetGeoDomain;
|
|
|
|
using michlib::Floor;
|
|
|
|
using michlib::GPL;
|
|
|
|
using michlib::int2;
|
|
|
|
using michlib::int4;
|
|
|
|
using michlib::RegExp;
|
|
|
|
|
|
|
|
class AVISOLOCALData: public NCFuncs
|
|
|
|
{
|
|
|
|
std::vector<MDateTime> times;
|
|
|
|
MString datapath;
|
|
|
|
|
|
|
|
struct Parameters: public BaseParameters
|
|
|
|
{
|
|
|
|
real lonb, latb, lone, late;
|
|
|
|
virtual ~Parameters() override = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
static constexpr const char* name = "AVISOLOCAL";
|
|
|
|
|
|
|
|
using Data = Simple2DData;
|
|
|
|
|
|
|
|
AVISOLOCALData() = default;
|
|
|
|
|
|
|
|
static MString DataTitle() { return "AVISO local mirror"; }
|
|
|
|
|
|
|
|
MString Info() const;
|
|
|
|
// TODO: RetVal
|
|
|
|
MString Open(const CLArgs& args);
|
|
|
|
|
|
|
|
std::pair<const BaseParameters*, MString> Parameters(michlib_internal::ParameterListEx& pars, const CLArgs& args, const struct Region& reg) const;
|
|
|
|
|
|
|
|
bool isOk() const { return times.size() > 0; }
|
|
|
|
|
|
|
|
size_t NTimes() const { return times.size(); }
|
|
|
|
|
|
|
|
MDateTime Time(size_t i) const
|
|
|
|
{
|
|
|
|
if(!isOk() || i >= times.size()) return MDateTime();
|
|
|
|
return times[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
time_t Timestep() const { return isOk() ? (times[1] - times[0]) : 0; }
|
|
|
|
|
|
|
|
explicit operator bool() const { return times.size() > 0; }
|
|
|
|
|
|
|
|
bool CheckVar(const MString& vname) const
|
|
|
|
{
|
|
|
|
NCFileA nc;
|
|
|
|
nc.Reset(datapath + "/uv-" + times[0].ToString() + ".nc");
|
|
|
|
return NCFuncs::CheckVar(vname, [&nc = std::as_const(nc)](const MString& vn) { return HaveVar(nc, vn); });
|
|
|
|
}
|
|
|
|
|
|
|
|
Data Read(const MString& vname, const BaseParameters* ip, size_t i) const;
|
|
|
|
|
|
|
|
template<class DataType> Data ReadVarRaw(const NCFileA& nc, const MString& name, const struct Parameters* p) const;
|
|
|
|
};
|