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 bool insertValue (const Coord &coordinates, const Bathymetry &bathymetry_value)
 
virtual double getValue (const Coord &coords) const
 
virtual bool finalizeConnection ()
 
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 bool openConnection ()
 
virtual bool closeConnection ()
 
- Public Member Functions inherited from woss::WossDb
 WossDb (const ::std::string &name)
 
void setDbName (const ::std::string &pathname)
 
::std::string getDbName () const
 
void setDebug (double flag=true)
 
bool isUsingDebug () const
 
virtual bool isValid ()
 

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)
 

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 constructor

Parameters
namepathname of database

Member Function Documentation

◆ finalizeConnection()

bool BathyUtmCsvDb::finalizeConnection ( )
virtual

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::getUtmWgs84FromCoord(), 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
virtual

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 
)
virtual

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.

Referenced by woss::BathyUtmCsvDbCreator::createWossDb().

◆ 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.

Referenced by woss::BathyUtmCsvDbCreator::createWossDb().

◆ 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.

Referenced by woss::BathyUtmCsvDbCreator::createWossDb().

◆ setDbSpacing()

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

Sets db resolution, in meters

Parameters
spacingspace resolution in meters

References db_spacing.

Referenced by woss::BathyUtmCsvDbCreator::createWossDb().

◆ 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.

Referenced by woss::BathyUtmCsvDbCreator::createWossDb().

◆ setLandApproximationFlag()

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

Sets land approximation flag

Parameters
flagland approximation flag

References approx_land_to_sea_surface.

Referenced by woss::BathyUtmCsvDbCreator::createWossDb().

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 getLandApproximationFlag(), getValue(), and setLandApproximationFlag().

◆ bathy_vec

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

Vector with bathymetry values

Referenced by getValue(), and importData().

◆ db_spacing

double woss::BathyUtmCsvDb::db_spacing
protected

spatial spacing of the db, in meters

Referenced by 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 getBathyIndex(), getDbRangeEasting(), and setDbRangeEasting().

◆ range_easting_start

double woss::BathyUtmCsvDb::range_easting_start
protected

Separator used in the csv file

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

◆ range_northing_end

double woss::BathyUtmCsvDb::range_northing_end
protected

Separator used in the csv file

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

◆ range_northing_start

double woss::BathyUtmCsvDb::range_northing_start
protected

Separator used in the csv file

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

◆ separator

char woss::BathyUtmCsvDb::separator
protected

Separator used in the csv file

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

◆ total_easting_values

int woss::BathyUtmCsvDb::total_easting_values
protected

Separator used in the csv file

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

◆ total_northing_values

int woss::BathyUtmCsvDb::total_northing_values
protected

Separator used in the csv file

Referenced by getDbTotalValues(), and setDbTotalValues().


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