World Ocean Simulation System (WOSS) library
woss::BathyGebcoDb Class Reference

NetCDF specialization of WossNetcdfDb for GEBCO database. More...

#include <bathymetry-gebco-db.h>

Inheritance diagram for woss::BathyGebcoDb:
Inheritance graph
Collaboration diagram for woss::BathyGebcoDb:
Collaboration graph

Public Member Functions

 BathyGebcoDb (const std::string &name)
 
virtual ~BathyGebcoDb () override=default
 
virtual bool insertValue (const Coord &coordinates, const Bathymetry &bathymetry_value) override
 
virtual Bathymetry getValue (const Coord &coords) const override
 
virtual bool finalizeConnection () override
 
void setGebcoType (const GEBCO_BATHY_TYPE &type)
 
GEBCO_BATHY_TYPE getGebcoType () const
 
- Public Member Functions inherited from woss::WossNetcdfDb
 WossNetcdfDb (const std::string &name)
 
virtual ~WossNetcdfDb () override
 
virtual bool openConnection () override
 
virtual bool closeConnection () override
 
- Public Member Functions inherited from woss::WossDb
 WossDb (const std::string &name)
 
virtual ~WossDb ()=default
 
void setDbName (const std::string &pathname)
 
std::string getDbName () const
 
void setDebug (double flag=true)
 
bool isUsingDebug () const
 
virtual bool isValid () const
 
- Public Member Functions inherited from woss::WossBathymetryDb
 WossBathymetryDb ()=default
 
virtual ~WossBathymetryDb ()=default
 

Protected Member Functions

long get1DBathyIndex (const Coord &coords) const
 
Gebco2DIndexes get2DBathyIndexes (const Coord &coords) const
 
- Protected Member Functions inherited from woss::WossDb
PathName getPathName (const std::string &complete_path) const
 

Protected Attributes

GEBCO_BATHY_TYPE gebco_type
 
netCDF::NcVar bathy_var
 
NcVar * bathy_var
 
netCDF::NcVar lat_var
 
NcVar * lat_var
 
netCDF::NcVar lon_var
 
NcVar * lon_var
 
- Protected Attributes inherited from woss::WossNetcdfDb
std::unique_ptr< netCDF::NcFile > netcdf_db = nullptr
 
std::unique_ptr< NcFile > netcdf_db = nullptr
 
- Protected Attributes inherited from woss::WossDb
std::string db_name
 
bool debug
 

Detailed Description

NetCDF specialization of WossNetcdfDb for GEBCO database.

NetCDF specialization of WossNetcdfDb for GEBCO database. It creates a NetCDF variable used to get requested bathymetry values

Constructor & Destructor Documentation

◆ BathyGebcoDb()

BathyGebcoDb::BathyGebcoDb ( const std::string &  name)

BathyGebcoDb constructor

Parameters
namepathname of database

◆ ~BathyGebcoDb()

virtual woss::BathyGebcoDb::~BathyGebcoDb ( )
overridevirtualdefault

Member Function Documentation

◆ finalizeConnection()

bool BathyGebcoDb::finalizeConnection ( )
overridevirtual

Post openConnection() actions. It create and initializes a NetCDF variable

Returns
true if method was successful, false otherwise

Implements woss::WossDb.

References bathy_var, woss::WossDb::debug, woss::GEBCO_1D_1_MINUTE_BATHY_TYPE, woss::GEBCO_1D_30_SECONDS_BATHY_TYPE, gebco_type, lat_var, lon_var, and woss::WossNetcdfDb::netcdf_db.

◆ get1DBathyIndex()

long BathyGebcoDb::get1DBathyIndex ( const Coord coords) const
protected

Returns the GEBCO 1D index corresponding the given coordinates. This index will be used to access the NetCDF variable and thus retrieving the bathymetry value

Parameters
coordsconst reference to a valid Coord object
Returns
index value

References woss::WossDb::debug, woss::GEBCO_1D_1_MINUTE_BATHY_TYPE, woss::GEBCO_1D_30_SECONDS_BATHY_TYPE, gebco_type, woss::Coord::getLatitude(), and woss::Coord::getLongitude().

Referenced by getValue().

Here is the call graph for this function:

◆ get2DBathyIndexes()

Gebco2DIndexes BathyGebcoDb::get2DBathyIndexes ( const Coord coords) const
protected

Returns the GEBCO 2D indexes corresponding the given coordinates. These indexes will be used to access the NetCDF variable and thus retrieving the bathymetry value

Parameters
coordsconst reference to a valid Coord object
Returns
Gebco2DIndexes value

References woss::WossDb::debug, woss::GEBCO_2D_15_SECONDS_BATHY_TYPE, woss::GEBCO_2D_1_MINUTE_BATHY_TYPE, woss::GEBCO_2D_30_SECONDS_BATHY_TYPE, gebco_type, woss::Coord::getLatitude(), and woss::Coord::getLongitude().

Referenced by getValue().

Here is the call graph for this function:

◆ getGebcoType()

GEBCO_BATHY_TYPE woss::BathyGebcoDb::getGebcoType ( ) const
inline

Returns which GEBCO version is in use #return GEBCO_BATHY_TYPE instance

References gebco_type.

◆ getValue()

Bathymetry BathyGebcoDb::getValue ( const Coord coords) const
overridevirtual

Returns the positive depth value ( bathymetry ) of given coordinates, if present in the database. If given coordinates are on land ( original retrieved value is positive ) HUGE_VAL is returned.

Parameters
coordsconst reference to a valid Coord object
Returns
positive depth value [m] if coordinates are found, HUGE_VAL otherwise

Implements woss::WossBathymetryDb.

References bathy_var, woss::WossDb::debug, woss::GEBCO_1D_1_MINUTE_BATHY_TYPE, woss::GEBCO_1D_30_SECONDS_BATHY_TYPE, woss::GEBCO_2D_15_SECONDS_BATHY_TYPE, woss::GEBCO_2D_1_MINUTE_BATHY_TYPE, woss::GEBCO_2D_30_SECONDS_BATHY_TYPE, gebco_type, get1DBathyIndex(), get2DBathyIndexes(), woss::Coord::getLatitude(), woss::Coord::getLongitude(), lat_var, and lon_var.

Here is the call graph for this function:

◆ insertValue()

bool BathyGebcoDb::insertValue ( const Coord coordinates,
const Bathymetry bathymetry_value 
)
overridevirtual

Inserts the given woss::Bathymetry value in the database for given coordinates

Parameters
coordinatesconst reference to a valid Coord object
bathymetry_valueconst reference to woss::Bathymetry value to be inserted
Returns
true if method was successful, false otherwise

Implements woss::WossBathymetryDb.

◆ setGebcoType()

void woss::BathyGebcoDb::setGebcoType ( const GEBCO_BATHY_TYPE type)
inline

Notify the database which GEBCO version is in use

Parameters
typeGEBCO_BATHY_TYPE instance

References gebco_type.

Member Data Documentation

◆ bathy_var [1/2]

netCDF::NcVar woss::BathyGebcoDb::bathy_var
protected

NetCDF bathymetry variable

Referenced by finalizeConnection(), and getValue().

◆ bathy_var [2/2]

NcVar* woss::BathyGebcoDb::bathy_var
protected

◆ gebco_type

GEBCO_BATHY_TYPE woss::BathyGebcoDb::gebco_type
protected

◆ lat_var [1/2]

netCDF::NcVar woss::BathyGebcoDb::lat_var
protected

NetCDF latitude variable

Referenced by finalizeConnection(), and getValue().

◆ lat_var [2/2]

NcVar* woss::BathyGebcoDb::lat_var
protected

◆ lon_var [1/2]

netCDF::NcVar woss::BathyGebcoDb::lon_var
protected

NetCDF longitude variable

Referenced by finalizeConnection(), and getValue().

◆ lon_var [2/2]

NcVar* woss::BathyGebcoDb::lon_var
protected

The documentation for this class was generated from the following files: