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.
61 lines
1.5 KiB
61 lines
1.5 KiB
1 year ago
|
#pragma once
|
||
|
#include "ParseArgs.h"
|
||
|
#include "basedata.h"
|
||
|
#include "mdatetime.h"
|
||
|
#include "mregex.h"
|
||
|
#include "DataAdapters/ncfilealt.h"
|
||
|
#include <dirent.h>
|
||
|
#include <set>
|
||
|
#include <utility>
|
||
|
|
||
|
using michlib::GPL;
|
||
|
using michlib::MDateTime;
|
||
|
using michlib::RegExp;
|
||
|
using michlib::uint2;
|
||
|
using michlib::uint4;
|
||
|
using michlib::Floor;
|
||
|
using michlib::Ceil;
|
||
|
using michlib::pointer_cast;
|
||
|
|
||
|
class MODISBINLOCALData
|
||
|
{
|
||
|
MString datapath;
|
||
|
std::vector<MString> dataset;
|
||
|
std::vector<MDateTime> times;
|
||
|
|
||
|
bool SufFromDataset(const MString& datasetstr);
|
||
|
|
||
|
struct Parameters: public BaseParameters
|
||
|
{
|
||
|
real lonb, latb, lone, late;
|
||
|
virtual ~Parameters() override = default;
|
||
|
};
|
||
|
|
||
|
public:
|
||
|
using Data = UngriddedData;
|
||
|
|
||
|
MString Info() const;
|
||
|
MString Open(const CLArgs& args);
|
||
|
Data Read(const MString& var, const BaseParameters* ip, size_t tind) const;
|
||
|
Data ReadFile(const MString& suf, const struct Parameters* p, size_t tind) const;
|
||
|
|
||
|
std::pair<const BaseParameters*, MString> Parameters(michlib_internal::ParameterListEx& pars, const CLArgs& args) const;
|
||
|
|
||
|
bool CheckVar(const MString& vname) const
|
||
|
{
|
||
|
if(dataset.empty()) return false;
|
||
|
bool ischl = dataset.front() == "A_CHL" || dataset.front() == "T_CHL";
|
||
|
return (vname == "chl" && ischl) || (vname == "temp" && !ischl);
|
||
|
}
|
||
|
|
||
|
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];
|
||
|
}
|
||
|
};
|