Skip to content

Commit 42adbba

Browse files
authored
Added support for DECK41_V2 database data format (#34)
1 parent 88ac4de commit 42adbba

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

examples/woss-aloha-example.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,16 @@ Experiment::InitWossHelper (Ptr<WossHelper> wossHelper, Ptr<WossPropModel> wossP
7979
if (m_databasePath != "")
8080
{
8181
#if defined (WOSS_NETCDF_SUPPORT)
82-
wossHelper->SetAttribute ("SedimDbCoordFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_coordinates.nc"));
83-
wossHelper->SetAttribute ("SedimDbMarsdenFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_mardsen_square.nc"));
84-
wossHelper->SetAttribute ("SedimDbMarsdenOneFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_mardsen_one_degree.nc"));
82+
wossHelper->SetAttribute ("SedimDbCoordFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_V2_coordinates.nc"));
83+
wossHelper->SetAttribute ("SedimDbMarsdenFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_V2_marsden_square.nc"));
84+
wossHelper->SetAttribute ("SedimDbMarsdenOneFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_V2_marsden_one_degree.nc"));
8585
wossHelper->SetAttribute ("BathyDbDebug", BooleanValue (false));
8686
#if defined (WOSS_NETCDF4_SUPPORT)
8787
wossHelper->SetAttribute ("BathyDbGebcoFormat", IntegerValue (4)); // 15 seconds, 2D netcdf format
8888
wossHelper->SetAttribute ("BathyDbCoordFilePath", StringValue (m_databasePath + "/bathymetry/GEBCO_2020.nc"));
8989
wossHelper->SetAttribute ("SspDbWoaDbType", IntegerValue (1)); // 2013 WOA DB Format
9090
wossHelper->SetAttribute ("SspDbCoordFilePath", StringValue (m_databasePath + "/ssp/WOA2018/WOA2018_SSP_April.nc"));
91+
wossHelper->SetAttribute ("SedimentDbDeck41DbType", IntegerValue (1)); // DECK41 V2 database data format
9192
#else
9293
wossHelper->SetAttribute ("BathyDbGebcoFormat", IntegerValue (3)); // 30 seconds, 2D netcdf format
9394
wossHelper->SetAttribute ("BathyDbCoordFilePath", StringValue (m_databasePath + "/bathymetry/GEBCO_2014_2D.nc"));

helper/woss-helper.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
#define WH_WOA_DB_TYPE_DEFAULT (1)
7373
#define WH_WOA_DB_TYPE_MIN (0)
7474
#define WH_WOA_DB_TYPE_MAX (1)
75+
#define WH_SEDIMENT_DECK41_FORMAT_DEFAULT (1)
76+
#define WH_SEDIMENT_DECK41_FORMAT_MIN (0)
77+
#define WH_SEDIMENT_DECK41_FORMAT_MAX (1)
7578
#endif // defined (WOSS_NETCDF_SUPPORT)
7679

7780
namespace ns3 {
@@ -191,6 +194,9 @@ WossHelper::WossHelper ()
191194
#if defined (WOSS_NETCDF_SUPPORT)
192195
m_sedimDbCreatorDebug (WH_DEBUG_DEFAULT),
193196
m_sedimDbDebug (WH_DEBUG_DEFAULT),
197+
#if defined (WOSS_NETCDF4_SUPPORT)
198+
m_sedimDbDeck41DbType(WH_SEDIMENT_DECK41_FORMAT_DEFAULT),
199+
#endif // defined (WOSS_NETCDF4_SUPPORT)
194200
m_sedimDbCoordFilePath (WH_STRING_DEFAULT),
195201
m_sedimDbMarsdenFilePath (WH_STRING_DEFAULT),
196202
m_sedimDbMarsdenOneFilePath (WH_STRING_DEFAULT),
@@ -409,6 +415,9 @@ WossHelper::Initialize (Ptr<WossPropModel> wossPropModel)
409415
m_sedimDbCreator->setDeck41MarsdenOnePathName (m_sedimDbMarsdenOneFilePath);
410416
m_sedimDbCreator->setDebug (m_sedimDbCreatorDebug);
411417
m_sedimDbCreator->setWossDebug (m_sedimDbDebug);
418+
#if defined (WOSS_NETCDF4_SUPPORT)
419+
m_sedimDbCreator->setDeck41DbType ((woss::DECK41DbType)m_sedimDbDeck41DbType);
420+
#endif // defined (WOSS_NETCDF4_SUPPORT)
412421

413422
m_wossController->setSedimentDbCreator (m_sedimDbCreator);
414423
}
@@ -1339,6 +1348,13 @@ WossHelper::GetTypeId ()
13391348
BooleanValue (WH_DEBUG_DEFAULT),
13401349
MakeBooleanAccessor (&WossHelper::m_sedimDbDebug),
13411350
MakeBooleanChecker () )
1351+
#if defined (WOSS_NETCDF4_SUPPORT)
1352+
.AddAttribute ("SedimentDbDeck41DbType",
1353+
"SSP WOA Db Type: 0 = V1 Format Db, 1 = V2 Format Db",
1354+
IntegerValue (WH_SEDIMENT_DECK41_FORMAT_DEFAULT),
1355+
MakeIntegerAccessor (&WossHelper::m_sedimDbDeck41DbType),
1356+
MakeIntegerChecker<int> (WH_SEDIMENT_DECK41_FORMAT_MIN, WH_SEDIMENT_DECK41_FORMAT_MAX ) )
1357+
#endif // defined (WOSS_NETCDF4_SUPPORT)
13421358
.AddAttribute ("SedimDbCoordFilePath",
13431359
"Sediment Db will read the coordinates database from this file (full path required)",
13441360
StringValue (WH_STRING_DEFAULT),

helper/woss-helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@ class WossHelper : public Object
486486
#if defined (WOSS_NETCDF_SUPPORT)
487487
bool m_sedimDbCreatorDebug; //!< enable/disable the debug prints of the woss sediment database creator.
488488
bool m_sedimDbDebug; //!< enable/disable the debug prints of the woss sediment database.
489+
#if defined (WOSS_NETCDF4_SUPPORT)
490+
int m_sedimDbDeck41DbType; //!< set the DECK41 database data format type. 0 = V1 data format, 1 = V2 data format
491+
#endif // defined (WOSS_NETCDF4_SUPPORT)
489492
::std::string m_sedimDbCoordFilePath; //!< setup the path of the sediment database indexed by geographical coordinates with decimal degrees resolution
490493
::std::string m_sedimDbMarsdenFilePath; //!< setup the path of the sediment database indexed by geographical coordinates with marsden square resolution
491494
::std::string m_sedimDbMarsdenOneFilePath; //!< setup the path of the sediment database indexed by geographical coordinates with marsden one square resolution

0 commit comments

Comments
 (0)