diff --git a/include/NEMOBIO.h b/include/NEMOBIO.h new file mode 100644 index 0000000..37d1e72 --- /dev/null +++ b/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); + } +}; diff --git a/include/data.h b/include/data.h index 0888424..2e6d9f2 100644 --- a/include/data.h +++ b/include/data.h @@ -5,9 +5,10 @@ #include "HYCOM.h" #include "MODISBINLOCAL.h" #include "NEMO.h" +#include "NEMOBIO.h" #include -using DataVariants = std::variant; +using DataVariants = std::variant; class Data: public DataVariants { public: diff --git a/include/odm.h b/include/odm.h index 0802c19..780f7c3 100644 --- a/include/odm.h +++ b/include/odm.h @@ -16,6 +16,8 @@ template consteval bool MustSup() constexpr bool NEMOsup = MustSup() && MustSup() && MustSup() && MustSup(); +constexpr bool NEMOBIOsup = MustSup() && MustSup(); + constexpr bool HYCOMsup = MustSup() && MustSup() && MustSup() && MustSup(); @@ -33,3 +35,5 @@ template static constexpr bool DisableAction = false; template<> constexpr bool DisableAction = true; template<> constexpr bool DisableAction = true; template<> constexpr bool DisableAction = true; +template<> constexpr bool DisableAction = true; +template<> constexpr bool DisableAction = true; diff --git a/src/data.cpp b/src/data.cpp index 679b58e..fadc38d 100644 --- a/src/data.cpp +++ b/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)); } diff --git a/src/ncfuncs.cpp b/src/ncfuncs.cpp index 8b7fa35..0fd5721 100644 --- a/src/ncfuncs.cpp +++ b/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 ""; } diff --git a/src/odm.cpp b/src/odm.cpp index 1129643..6051b70 100644 --- a/src/odm.cpp +++ b/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");