Browse Source

Added new source NEMOBIO

interpolate
Michael Uleysky 1 year ago
parent
commit
5314746eb8
  1. 44
      include/NEMOBIO.h
  2. 3
      include/data.h
  3. 4
      include/odm.h
  4. 11
      src/data.cpp
  5. 6
      src/ncfuncs.cpp
  6. 11
      src/odm.cpp

44
include/NEMOBIO.h

@ -0,0 +1,44 @@
#pragma once
#include "layereddata.h"
class NEMOBIOData: public LayeredData
{
enum Type
{
TYPE_UNKNOWN,
TYPE_DT,
TYPE_NRT,
};
Type type = TYPE_UNKNOWN;
public:
NEMOBIOData() = default;
MString DataTitle() const
{
switch(type)
{
case(TYPE_DT): return "NEMO BIO Delayed time (DT)";
case(TYPE_NRT): return "NEMO BIO Near-real time (NRT)";
default: return "No title";
}
}
// TODO: RetVal
MString Open(const CLArgs& args)
{
MString dataset = args.contains("dataset") ? args.at("dataset") : "DT";
GPL.UsePrefix("NEMOBIO");
if(dataset == "DT")
type = TYPE_DT;
else if(dataset == "NRT")
type = TYPE_NRT;
else
return "Unknown dataset: " + dataset;
SetTitle(DataTitle());
return LayeredData::Open(dataset);
}
};

3
include/data.h

@ -5,9 +5,10 @@
#include "HYCOM.h"
#include "MODISBINLOCAL.h"
#include "NEMO.h"
#include "NEMOBIO.h"
#include <variant>
using DataVariants = std::variant<NEMOData, HYCOMData, AVISOData, AVISOLOCALData, BINFILEData, MODISBINLOCALData>;
using DataVariants = std::variant<NEMOData, NEMOBIOData, HYCOMData, AVISOData, AVISOLOCALData, BINFILEData, MODISBINLOCALData>;
class Data: public DataVariants
{
public:

4
include/odm.h

@ -16,6 +16,8 @@ template<class T, ActionID id> consteval bool MustSup()
constexpr bool NEMOsup =
MustSup<NEMOData, ActionID::INFO>() && MustSup<NEMOData, ActionID::TSC>() && MustSup<NEMOData, ActionID::UV>() && MustSup<NEMOData, ActionID::GENINTFILE>();
constexpr bool NEMOBIOsup = MustSup<NEMOBIOData, ActionID::INFO>() && MustSup<NEMOBIOData, ActionID::TSC>();
constexpr bool HYCOMsup =
MustSup<HYCOMData, ActionID::INFO>() && MustSup<HYCOMData, ActionID::TSC>() && MustSup<HYCOMData, ActionID::UV>() && MustSup<HYCOMData, ActionID::GENINTFILE>();
@ -33,3 +35,5 @@ template<class T, ActionID id> static constexpr bool DisableAction = false;
template<> constexpr bool DisableAction<BINFILEData, ActionID::GENINTFILE> = true;
template<> constexpr bool DisableAction<MODISBINLOCALData, ActionID::UV> = true;
template<> constexpr bool DisableAction<MODISBINLOCALData, ActionID::GENINTFILE> = true;
template<> constexpr bool DisableAction<NEMOBIOData, ActionID::UV> = true;
template<> constexpr bool DisableAction<NEMOBIOData, ActionID::GENINTFILE> = true;

11
src/data.cpp

@ -12,6 +12,13 @@ MString Data::Init(const CLArgs& args)
if(res.Exist()) return "Can't open source " + src + ":\n" + res;
*this = Data(std::move(data));
}
if(src == "NEMOBIO")
{
NEMOBIOData data;
auto res = data.Open(args);
if(res.Exist()) return "Can't open source " + src + ":\n" + res;
*this = Data(std::move(data));
}
else if(src == "AVISO")
{
AVISOData data;
@ -36,14 +43,14 @@ MString Data::Init(const CLArgs& args)
else if(src == "BINFILE")
{
BINFILEData data;
auto res = data.Open(args);
auto res = data.Open(args);
if(res.Exist()) return "Can't open source " + src + ":\n" + res;
*this = Data(std::move(data));
}
else if(src == "MODISBINLOCAL")
{
MODISBINLOCALData data;
auto res = data.Open(args);
auto res = data.Open(args);
if(res.Exist()) return "Can't open source " + src + ":\n" + res;
*this = Data(std::move(data));
}

6
src/ncfuncs.cpp

@ -116,6 +116,12 @@ MString NCFuncs::StName2Name(const MString& stname)
if(stname == "surface_geostrophic_eastward_sea_water_velocity") return "u";
if(stname == "surface_geostrophic_northward_sea_water_velocity") return "v";
if(stname == "upward_sea_water_velocity") return "w";
if(stname == "mass_concentration_of_chlorophyll_a_in_sea_water") return "chl";
if(stname == "mole_concentration_of_nitrate_in_sea_water") return "NO3";
if(stname == "net_primary_production_of_biomass_expressed_as_carbon_per_unit_volume_in_sea_water") return "prprod";
if(stname == "mole_concentration_of_phytoplankton_expressed_as_carbon_in_sea_water") return "Cchl";
if(stname == "mole_concentration_of_phosphate_in_sea_water") return "PO4";
if(stname == "mole_concentration_of_silicate_in_sea_water") return "Si";
return "";
}

11
src/odm.cpp

@ -6,16 +6,18 @@ inline void Usage(const MString& arg0)
message("Keys are:");
message(" action. What the program should do. May be: info, tsc, uv, genintfile. Default: info.");
message(" Keys for action=info. Print some information about dataset.");
message(" source. Required. May be: NEMO, HYCOM, AVISO, AVISOLOCAL, BINFILE");
message(" source. Required. May be: NEMO, NEMOBIO, HYCOM, AVISO, AVISOLOCAL, BINFILE");
message(" Keys for source=NEMO");
message(" dataset. Can be DT, NRT or NRT6. Default: DT");
message(" Keys for source=NEMOBIO");
message(" dataset. Can be DT or NRT. Default: DT");
message(" Keys for source=HYCOM");
message(" dataset. Can be Forecast, Hindcast or Reanalysis. Default: Forecast");
message(" Keys for source=AVISO");
message(" dataset. Can be DT, NRT, EckmanDT or EckmanNRT. Default: DT");
message(" Keys for action=tsc. Get temperature, salinity, chlorofill from dataset.");
message(" source. Required. May be: NEMO, HYCOM, AVISO, AVISOLOCAL, BINFILE");
message(" var. Required. May be: U, U2, u, v, temp, ptemp, pdens, sal, chl, mld, ssh or w.");
message(" source. Required. May be: NEMO, NEMOBIO, HYCOM, AVISO, AVISOLOCAL, BINFILE");
message(" var. Required. May be: U, U2, u, v, temp, ptemp, pdens, sal, chl, mld, ssh, w, NO3, PO4, Si, prprod, Cchl.");
message(" time. Time moment or regular expression. If present, timeb and timee must be absent");
message(" timeb, timee. Time interval. If present, time must be absent");
message(" lonb, lone, latb, late. Required. Region of interest");
@ -23,6 +25,9 @@ inline void Usage(const MString& arg0)
message(" Keys for source=NEMO");
message(" dataset. Can be DT, NRT or NRT6. Default: DT");
message(" layer and/or depth. Layer or depth of NEMO dataset. If depth is specified, layer is ignored. Both ignored, if var=mld or var=ssh. Default: layer=0");
message(" Keys for source=NEMOBIO");
message(" dataset. Can be DT or NRT. Default: DT");
message(" layer and/or depth. Layer or depth of NEMOBIO dataset. If depth is specified, layer is ignored. Default: layer=0");
message(" Keys for source=HYCOM");
message(" dataset. Can be Forecast, Hindcast or Reanalysis. Default: Forecast");
message(" layer and/or depth. Layer or depth of HYCOM dataset. If depth is specified, layer is ignored. Both ignored, if var=mld or var=ssh. Default: layer=0");

Loading…
Cancel
Save