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.
 
 
 

64 lines
1.6 KiB

#pragma once
#include "DataAdapters/ncfilealt.h"
#include "ParseArgs.h"
#include "basedata.h"
#include "mdatetime.h"
#include "mregex.h"
#include <dirent.h>
#include <set>
#include <utility>
using michlib::Ceil;
using michlib::Floor;
using michlib::GPL;
using michlib::MDateTime;
using michlib::pointer_cast;
using michlib::RegExp;
using michlib::uint2;
using michlib::uint4;
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:
static constexpr const char* name = "MODISBINLOCAL";
static constexpr const char* disabledactions = "genintfile uv";
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 struct Region& reg) 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];
}
};