You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
66 lines
1.7 KiB
#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; } |
|
|
|
VarPresence 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); }); |
|
} |
|
|
|
bool Read(const MString& vname, std::map<MString, Data>& cache, const BaseParameters* ip, size_t i) const; |
|
|
|
template<class DataType> Data ReadVarRaw(const NCFileA& nc, const MString& name, const struct Parameters* p) const; |
|
};
|
|
|