#pragma once #include "DataAdapters/ncfilealt.h" #include "mdatetime.h" #include #include using michlib::MDateTime; using michlib::MString; using michlib::NCFileA; class NCFuncs { public: struct CoordNames { MString lonname, latname, depthname, timename; size_t nx, ny, nz, nt; }; static MString StName2Name(const MString& stname); static std::tuple Refdate(const MString& refdate); static void GetVars(const NCFileA& nc, std::set& vars); static CoordNames GetCNames(const NCFileA& nc); static CoordNames GetDNames(const NCFileA& nc); static bool HaveVar(const NCFileA& nc, const MString& vname); template static bool CheckVar(const MString& vname, HV hv) { if(!hv(vname)) { bool varexist = false; if(vname == "temp" && hv("ptemp") && hv("sal")) varexist = true; if(vname == "ptemp" && hv("temp") && hv("sal")) varexist = true; if(vname == "pdens" && (hv("ptemp") || hv("temp")) && hv("sal")) varexist = true; if((vname == "U" || vname == "U2") && hv("u") && hv("v")) varexist = true; if(!varexist) return false; } return true; } };