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.
 
 
 

70 lines
1.6 KiB

#pragma once
#include "layereddata.h"
class HYCOMData: public LayeredData
{
enum Type
{
TYPE_UNKNOWN,
TYPE_REANALYSIS,
TYPE_HINDCAST,
TYPE_NRT,
TYPE_FORECAST
};
Type type = TYPE_UNKNOWN;
std::unique_ptr<GenericCache> cache;
public:
static constexpr const char* name = "HYCOM";
HYCOMData()
{
auto oldprefix = michlib::GPL.UsePrefix("HYCOM");
// Cache
cache.reset(CreateCache(michlib::GPL.ParameterSValue("Cache", "")));
if(!cache)
{
michlib::errmessage("Can't init cache");
cache.reset(new FakeCache);
}
michlib::GPL.UsePrefix(oldprefix);
}
MString DataTitle() const
{
switch(type)
{
case(TYPE_REANALYSIS): return "GOFS 3.1: 41-layer HYCOM + NCODA Global 1/12 Reanalysis";
case(TYPE_HINDCAST): return "GOFS 3.1: 41-layer HYCOM + NCODA Global 1/12 Analysis Hindcast";
case(TYPE_NRT): return "ESPC-D-V02: Global 1/12 Analysis Archive";
case(TYPE_FORECAST): return "ESPC-D-V02: Global 1/12 Forecast";
default: return "No title";
}
}
// TODO: RetVal
MString Open(const CLArgs& args)
{
MString dataset = args.contains("dataset") ? args.at("dataset") : "Forecast";
GPL.UsePrefix("HYCOM");
if(dataset == "Forecast")
type = TYPE_FORECAST;
else if(dataset == "NRT")
type = TYPE_NRT;
else if(dataset == "Hindcast")
type = TYPE_HINDCAST;
else if(dataset == "Reanalysis")
type = TYPE_REANALYSIS;
else
return "Unknown dataset: " + dataset;
SetTitle(DataTitle());
return LayeredData::Open(dataset);
}
// Adapter
RetVal<Adapter> GetAdapter(const CLArgs& args, michlib_internal::ParameterListEx& pars) const;
};