World Ocean Simulation System (WOSS) library
bathymetry-gebco-db.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 2025 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - WOSS@guerra-tlc.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation;
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
33#ifndef WOSS_BATHYMETRY_GEBCO_DB_H
34#define WOSS_BATHYMETRY_GEBCO_DB_H
35
36#ifdef WOSS_NETCDF_SUPPORT
37
38#include <utility>
39#if defined (WOSS_NETCDF4_SUPPORT)
40#include <ncVar.h>
41#endif // defined (WOSS_NETCDF4_SUPPORT)
43#include "woss-db.h"
44
45namespace woss {
46
47 static constexpr inline int GEBCO_1_MINUTE_BATHY_NLAT = 10801;
49 static constexpr inline int GEBCO_1_MINUTE_BATHY_NLON = 21601;
51 static constexpr inline double GEBCO_1_MINUTE_BATHY_SPACING = 0.0166666666666667;
53 static constexpr inline int GEBCO_30_SECONDS_BATHY_NLAT = 21600;
55 static constexpr inline int GEBCO_30_SECONDS_BATHY_NLON = 43200;
57 static constexpr inline double GEBCO_30_SECONDS_BATHY_SPACING = 0.00833333333333333;
59 static constexpr inline int GEBCO_15_SECONDS_BATHY_NLAT = 43200;
61 static constexpr inline int GEBCO_15_SECONDS_BATHY_NLON = 86400;
63 static constexpr inline double GEBCO_15_SECONDS_BATHY_SPACING = 0.004166666666666665;
65 static constexpr inline double GEBCO_1_MINUTE_BATHY_MIN_LAT = -90.0;
67 static constexpr inline double GEBCO_1_MINUTE_BATHY_MAX_LAT = 90.0;
69 static constexpr inline double GEBCO_1_MINUTE_BATHY_MIN_LONG = -180.0;
71 static constexpr inline double GEBCO_1_MINUTE_BATHY_MAX_LONG = 180.0;
73 static constexpr inline double GEBCO_30_SECONDS_BATHY_MIN_LAT = -89.995833333333333335;
75 static constexpr inline double GEBCO_30_SECONDS_BATHY_MAX_LAT = 89.995833333333333335;
77 static constexpr inline double GEBCO_30_SECONDS_BATHY_MIN_LONG = -179.995833333333333335;
79 static constexpr inline double GEBCO_30_SECONDS_BATHY_MAX_LONG = 179.995833333333333335;
81 static constexpr inline double GEBCO_15_SECONDS_BATHY_MIN_LAT = -89.9979166666666666675;
83 static constexpr inline double GEBCO_15_SECONDS_BATHY_MAX_LAT = 89.9979166666666666675;
85 static constexpr inline double GEBCO_15_SECONDS_BATHY_MIN_LONG = -179.9979166666666666675;
87 static constexpr inline double GEBCO_15_SECONDS_BATHY_MAX_LONG = 179.9979166666666666675;
89 static constexpr inline double GEBCO_1D_1_MINUTE_BATHY_START_LAT = 90.0;
91 static constexpr inline double GEBCO_1D_1_MINUTE_BATHY_START_LONG = -180.0;
93 static constexpr inline double GEBCO_1D_30_SECONDS_BATHY_START_LAT = 89.995833333333333335;
95 static constexpr inline double GEBCO_1D_30_SECONDS_BATHY_START_LONG = -179.995833333333333335;
97 static constexpr inline double GEBCO_2D_1_MINUTE_BATHY_START_LAT = -90.0;
99 static constexpr inline double GEBCO_2D_1_MINUTE_BATHY_START_LONG = -180.0;
101 static constexpr inline double GEBCO_2D_30_SECONDS_BATHY_START_LAT = -89.995833333333333335;
103 static constexpr inline double GEBCO_2D_30_SECONDS_BATHY_START_LONG = -179.995833333333333335;
105 static constexpr inline double GEBCO_2D_15_SECONDS_BATHY_START_LAT = -89.9979166666666666675;
107 static constexpr inline double GEBCO_2D_15_SECONDS_BATHY_START_LONG = -179.9979166666666666675;
109 using Gebco2DIndexes = std::pair< long, long >;
122
130
131 public:
132
137 BathyGebcoDb( const std::string& name );
138
139 virtual ~BathyGebcoDb() override = default;
140
147 virtual bool insertValue( const Coord& coordinates, const Bathymetry& bathymetry_value ) override;
148
149
156 virtual Bathymetry getValue( const Coord& coords ) const override;
157
162 virtual bool finalizeConnection() override;
163
168 void setGebcoType( const GEBCO_BATHY_TYPE& type ) { gebco_type = type; }
169
175
176 protected:
177
182
186#if defined(WOSS_NETCDF4_SUPPORT)
187 netCDF::NcVar bathy_var;
188#else
189 NcVar* bathy_var;
190#endif // #if defined(WOSS_NETCDF4_SUPPORT)
191
195#if defined(WOSS_NETCDF4_SUPPORT)
196 netCDF::NcVar lat_var;
197#else
198 NcVar* lat_var;
199#endif // defined(WOSS_NETCDF4_SUPPORT)
200
204#if defined(WOSS_NETCDF4_SUPPORT)
205 netCDF::NcVar lon_var;
206#else
207 NcVar* lon_var;
208#endif // defined(WOSS_NETCDF4_SUPPORT)
209
216 long get1DBathyIndex( const Coord& coords ) const;
217
224 Gebco2DIndexes get2DBathyIndexes( const Coord& coords ) const;
225 };
226
227}
228
229#endif // WOSS_NETCDF_SUPPORT
230
231#endif /* WOSS_BATHYMETRY_GEBCO_DB_H */
232
233
234
NetCDF specialization of WossNetcdfDb for GEBCO database.
Definition bathymetry-gebco-db.h:129
NcVar * lat_var
Definition bathymetry-gebco-db.h:198
netCDF::NcVar bathy_var
Definition bathymetry-gebco-db.h:187
netCDF::NcVar lon_var
Definition bathymetry-gebco-db.h:205
NcVar * bathy_var
Definition bathymetry-gebco-db.h:189
long get1DBathyIndex(const Coord &coords) const
Definition bathymetry-gebco-db.cpp:313
virtual ~BathyGebcoDb() override=default
Gebco2DIndexes get2DBathyIndexes(const Coord &coords) const
Definition bathymetry-gebco-db.cpp:366
virtual bool insertValue(const Coord &coordinates, const Bathymetry &bathymetry_value) override
Definition bathymetry-gebco-db.cpp:143
GEBCO_BATHY_TYPE getGebcoType() const
Definition bathymetry-gebco-db.h:174
netCDF::NcVar lat_var
Definition bathymetry-gebco-db.h:196
GEBCO_BATHY_TYPE gebco_type
Definition bathymetry-gebco-db.h:181
void setGebcoType(const GEBCO_BATHY_TYPE &type)
Definition bathymetry-gebco-db.h:168
virtual Bathymetry getValue(const Coord &coords) const override
Definition bathymetry-gebco-db.cpp:149
virtual bool finalizeConnection() override
Definition bathymetry-gebco-db.cpp:64
NcVar * lon_var
Definition bathymetry-gebco-db.h:207
Coordinates (lat, long) class definitions and functions library.
Definition coordinates-definitions.h:98
Data behaviour class for bathymetry database.
Definition woss-db.h:265
NetCDF implementation of WossDb.
Definition woss-db.h:178
Provides the interface for the woss::Coord and woss::CoordZ classes.
Definition ac-toolbox-arr-asc-reader.h:44
GEBCO_BATHY_TYPE
Definition bathymetry-gebco-db.h:114
@ GEBCO_1D_1_MINUTE_BATHY_TYPE
GEBCO 1D, one minute of arc netcf format.
@ GEBCO_2D_1_MINUTE_BATHY_TYPE
GEBCO 2D, one minute of arc netcf format.
@ GEBCO_1D_30_SECONDS_BATHY_TYPE
GEBCO 1D, thirty seconds of arc netcf format.
@ GEBCO_INVALID_BATHY_TYPE
INVALID, must be last.
@ GEBCO_2D_15_SECONDS_BATHY_TYPE
GEBCO 2D, fifteen seconds of arc netcf format.
@ GEBCO_2D_30_SECONDS_BATHY_TYPE
GEBCO 2D, thirty seconds of arc netcf format.
std::pair< long, long > Gebco2DIndexes
Definition bathymetry-gebco-db.h:109
double Bathymetry
Definition definitions.h:44
Provides the interface for woss::WossDb class.