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

Specialization of WossTextualDb for UTM CSV database. More...

#include <bathymetry-utm-csv-db.h>

Inheritance diagram for woss::BathyUtmCsvDb:
Inheritance graph
Collaboration diagram for woss::BathyUtmCsvDb:
Collaboration graph

Public Member Functions

 BathyUtmCsvDb (const std::string &name)
virtual ~BathyUtmCsvDb () 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 setCSVSeparator (const char new_separator)
const char getCSVSeparator () const
void setDbSpacing (double spacing)
double getDbSpacing () const
void setDbTotalValues (int nnorth, int neast)
std::pair< int, int > getDbTotalValues () const
void setDbRangeEasting (double start, double end)
std::pair< double, double > getDbRangeEasting () const
void setDbRangeNorthing (double start, double end)
std::pair< double, double > getDbRangeNorthing () const
void setLandApproximationFlag (bool flag)
bool getLandApproximationFlag ()
Public Member Functions inherited from woss::WossTextualDb
 WossTextualDb (const std::string &name)
virtual ~WossTextualDb () 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

int getBathyIndex (const Coord &coords) const
virtual bool importData ()
Protected Member Functions inherited from woss::WossDb
PathName getPathName (const std::string &complete_path) const

Protected Attributes

std::vector< double > bathy_vec
char separator
double db_spacing
int total_northing_values
int total_easting_values
double range_easting_start
double range_easting_end
double range_northing_start
double range_northing_end
bool approx_land_to_sea_surface
Protected Attributes inherited from woss::WossTextualDb
std::fstream textual_db
Protected Attributes inherited from woss::WossDb
std::string db_name
bool debug

Static Protected Attributes

static const double land_approximation_depth = 0.000000001

Detailed Description

Specialization of WossTextualDb for UTM CSV database.

Specialization of WossTextualDb for UTM CSV database. It creates a vector used to get requested bathymetry values.

Constructor & Destructor Documentation

◆ BathyUtmCsvDb()

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

◆ ~BathyUtmCsvDb()

virtual woss::BathyUtmCsvDb::~BathyUtmCsvDb ( )
overridevirtualdefault

Member Function Documentation

◆ finalizeConnection()

bool BathyUtmCsvDb::finalizeConnection ( )
overridevirtual

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

Returns
true if method was successful, false otherwise

Implements woss::WossDb.

References importData().

Here is the call graph for this function:

◆ getBathyIndex()

int BathyUtmCsvDb::getBathyIndex ( const Coord & coords) const
protected

Returns the index corresponding the given coordinates. This index will be used to access the vector variable and thus retrieving the bathymetry value

Parameters
coordsconst reference to a valid Coord object
Returns
index value

References db_spacing, woss::WossDb::debug, woss::UtmWgs84::getEasting(), woss::UtmWgs84::getNorthing(), woss::UtmWgs84::getUtmWgs84FromCoord(), woss::UtmWgs84::isValid(), range_easting_end, range_easting_start, range_northing_end, range_northing_start, and total_easting_values.

Referenced by getValue().

Here is the call graph for this function:

◆ getCSVSeparator()

const char woss::BathyUtmCsvDb::getCSVSeparator ( ) const
inline

Returns the current char separator

Returns
the char separator

References separator.

◆ getDbRangeEasting()

std::pair< double, double > woss::BathyUtmCsvDb::getDbRangeEasting ( ) const
inline

Returns the current db range easting

Returns
the db easting range start and end

References range_easting_end, and range_easting_start.

◆ getDbRangeNorthing()

std::pair< double, double > woss::BathyUtmCsvDb::getDbRangeNorthing ( ) const
inline

Returns the current db range northing

Returns
the db easting range start and end

References range_northing_end, and range_northing_start.

◆ getDbSpacing()

double woss::BathyUtmCsvDb::getDbSpacing ( ) const
inline

Returns the current db spatial resolution

Returns
the db spatial resolution in meters

References db_spacing.

◆ getDbTotalValues()

std::pair< int, int > woss::BathyUtmCsvDb::getDbTotalValues ( ) const
inline

Returns the total northing and easting values

Returns
pair of total northing and easting values

References total_easting_values, and total_northing_values.

◆ getLandApproximationFlag()

bool woss::BathyUtmCsvDb::getLandApproximationFlag ( )
inline

Returns the current land approximation flag

Returns
the land approximation flag

References approx_land_to_sea_surface.

◆ getValue()

double BathyUtmCsvDb::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 approx_land_to_sea_surface, bathy_vec, woss::WossDb::debug, getBathyIndex(), and land_approximation_depth.

Here is the call graph for this function:

◆ importData()

bool BathyUtmCsvDb::importData ( )
protectedvirtual

Imports data from .csv file and store depth values in the bathy_vec

Returns
true if operation succeeds, false otherwise

References bathy_vec, woss::WossDb::db_name, woss::WossDb::debug, separator, and woss::WossTextualDb::textual_db.

Referenced by finalizeConnection().

◆ insertValue()

bool BathyUtmCsvDb::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.

◆ setCSVSeparator()

void woss::BathyUtmCsvDb::setCSVSeparator ( const char new_separator)
inline

Sets the char separator used in CSV textual db

Parameters
new_separatorseparator char

References separator.

◆ setDbRangeEasting()

void woss::BathyUtmCsvDb::setDbRangeEasting ( double start,
double end )
inline

Sets db range easting start and end

Parameters
starteasting range start
endeasting range end

References range_easting_end, and range_easting_start.

◆ setDbRangeNorthing()

void woss::BathyUtmCsvDb::setDbRangeNorthing ( double start,
double end )
inline

Sets db northing range start and end

Parameters
startnorthing range start
endnorthing range end

References range_northing_end, and range_northing_start.

◆ setDbSpacing()

void woss::BathyUtmCsvDb::setDbSpacing ( double spacing)
inline

Sets db resolution, in meters

Parameters
spacingspace resolution in meters

References db_spacing.

◆ setDbTotalValues()

void woss::BathyUtmCsvDb::setDbTotalValues ( int nnorth,
int neast )
inline

Sets the db total northing and easting values

Parameters
nnorthdb total northing points. should be >= 0
neastdb total easting points. should be >= 0

References total_easting_values, and total_northing_values.

◆ setLandApproximationFlag()

void woss::BathyUtmCsvDb::setLandApproximationFlag ( bool flag)
inline

Sets land approximation flag

Parameters
flagland approximation flag

References approx_land_to_sea_surface.

Member Data Documentation

◆ approx_land_to_sea_surface

bool woss::BathyUtmCsvDb::approx_land_to_sea_surface
protected

Approximate land db points to sea surface

Referenced by BathyUtmCsvDb(), getLandApproximationFlag(), getValue(), and setLandApproximationFlag().

◆ bathy_vec

std::vector<double> woss::BathyUtmCsvDb::bathy_vec
protected

Vector with bathymetry values

Referenced by BathyUtmCsvDb(), getValue(), and importData().

◆ db_spacing

double woss::BathyUtmCsvDb::db_spacing
protected

spatial spacing of the db, in meters

Referenced by BathyUtmCsvDb(), getBathyIndex(), getDbSpacing(), and setDbSpacing().

◆ land_approximation_depth

const double BathyUtmCsvDb::land_approximation_depth = 0.000000001
staticprotected

Depth value for land approximation

Referenced by getValue().

◆ range_easting_end

double woss::BathyUtmCsvDb::range_easting_end
protected

Separator used in the csv file

Referenced by BathyUtmCsvDb(), getBathyIndex(), getDbRangeEasting(), and setDbRangeEasting().

◆ range_easting_start

double woss::BathyUtmCsvDb::range_easting_start
protected

Separator used in the csv file

Referenced by BathyUtmCsvDb(), getBathyIndex(), getDbRangeEasting(), and setDbRangeEasting().

◆ range_northing_end

double woss::BathyUtmCsvDb::range_northing_end
protected

Separator used in the csv file

Referenced by BathyUtmCsvDb(), getBathyIndex(), getDbRangeNorthing(), and setDbRangeNorthing().

◆ range_northing_start

double woss::BathyUtmCsvDb::range_northing_start
protected

Separator used in the csv file

Referenced by BathyUtmCsvDb(), getBathyIndex(), getDbRangeNorthing(), and setDbRangeNorthing().

◆ separator

char woss::BathyUtmCsvDb::separator
protected

Separator used in the csv file

Referenced by BathyUtmCsvDb(), getCSVSeparator(), importData(), and setCSVSeparator().

◆ total_easting_values

int woss::BathyUtmCsvDb::total_easting_values
protected

Separator used in the csv file

Referenced by BathyUtmCsvDb(), getBathyIndex(), getDbTotalValues(), and setDbTotalValues().

◆ total_northing_values

int woss::BathyUtmCsvDb::total_northing_values
protected

Separator used in the csv file

Referenced by BathyUtmCsvDb(), getDbTotalValues(), and setDbTotalValues().


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