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 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - federico@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/*
23 * This software has been developed by Federico Guerra and SIGNET lab,
24 * University of Padova, in collaboration with the NATO Centre for
25 * Maritime Research and Experimentation (http://www.cmre.nato.int ;
26 * E-mail: pao@cmre.nato.int), whose support is gratefully acknowledged.
27 */
28
39#ifndef WOSS_BATHYMETRY_GEBCO_DB_H
40#define WOSS_BATHYMETRY_GEBCO_DB_H
41
42#ifdef WOSS_NETCDF_SUPPORT
43
44#include "woss-db.h"
45#include <utility>
46#if defined (WOSS_NETCDF4_SUPPORT)
47#include <ncVar.h>
48#endif // defined (WOSS_NETCDF4_SUPPORT)
49
50namespace woss {
51
52
53 static const int GEBCO_1_MINUTE_BATHY_NLAT = 10801;
55 static const int GEBCO_1_MINUTE_BATHY_NLON = 21601;
57 static const double GEBCO_1_MINUTE_BATHY_SPACING = 0.0166666666666667;
60 static const int GEBCO_30_SECONDS_BATHY_NLAT = 21600;
62 static const int GEBCO_30_SECONDS_BATHY_NLON = 43200;
64 static const double GEBCO_30_SECONDS_BATHY_SPACING = 0.00833333333333333;
67 static const int GEBCO_15_SECONDS_BATHY_NLAT = 43200;
69 static const int GEBCO_15_SECONDS_BATHY_NLON = 86400;
71 static const double GEBCO_15_SECONDS_BATHY_SPACING = 0.004166666666666665;
74 static const double GEBCO_1_MINUTE_BATHY_MIN_LAT = -90.0;
76 static const double GEBCO_1_MINUTE_BATHY_MAX_LAT = 90.0;
78 static const double GEBCO_1_MINUTE_BATHY_MIN_LONG = -180.0;
80 static const double GEBCO_1_MINUTE_BATHY_MAX_LONG = 180.0;
83 static const double GEBCO_30_SECONDS_BATHY_MIN_LAT = -89.995833333333333335;
85 static const double GEBCO_30_SECONDS_BATHY_MAX_LAT = 89.995833333333333335;
87 static const double GEBCO_30_SECONDS_BATHY_MIN_LONG = -179.995833333333333335;
89 static const double GEBCO_30_SECONDS_BATHY_MAX_LONG = 179.995833333333333335;
92 static const double GEBCO_15_SECONDS_BATHY_MIN_LAT = -89.9979166666666666675;
94 static const double GEBCO_15_SECONDS_BATHY_MAX_LAT = 89.9979166666666666675;
96 static const double GEBCO_15_SECONDS_BATHY_MIN_LONG = -179.9979166666666666675;
98 static const double GEBCO_15_SECONDS_BATHY_MAX_LONG = 179.9979166666666666675;
101 static const double GEBCO_1D_1_MINUTE_BATHY_START_LAT = 90.0;
103 static const double GEBCO_1D_1_MINUTE_BATHY_START_LONG = -180.0;
106 static const double GEBCO_1D_30_SECONDS_BATHY_START_LAT = 89.995833333333333335;
108 static const double GEBCO_1D_30_SECONDS_BATHY_START_LONG = -179.995833333333333335;
111 static const double GEBCO_2D_1_MINUTE_BATHY_START_LAT = -90.0;
113 static const double GEBCO_2D_1_MINUTE_BATHY_START_LONG = -180.0;
116 static const double GEBCO_2D_30_SECONDS_BATHY_START_LAT = -89.995833333333333335;
118 static const double GEBCO_2D_30_SECONDS_BATHY_START_LONG = -179.995833333333333335;
121 static const double GEBCO_2D_15_SECONDS_BATHY_START_LAT = -89.9979166666666666675;
123 static const double GEBCO_2D_15_SECONDS_BATHY_START_LONG = -179.9979166666666666675;
127 typedef std::pair< long, long > Gebco2DIndexes;
140
141
149
150
151 public:
152
153
158 BathyGebcoDb( const ::std::string& name );
159
160 virtual ~BathyGebcoDb() { }
161
162
169 virtual bool insertValue( const Coord& coordinates, const Bathymetry& bathymetry_value );
170
171
178 virtual double getValue( const Coord& coords ) const ;
179
180
185 virtual bool finalizeConnection();
186
187
192 void setGebcoType( const GEBCO_BATHY_TYPE& type ) { gebco_type = type; }
193
199
200
201 protected:
202
203
208
209
213#if defined(WOSS_NETCDF4_SUPPORT)
214 netCDF::NcVar bathy_var;
215#else
216 NcVar* bathy_var;
217#endif // #if defined(WOSS_NETCDF4_SUPPORT)
218
219
223#if defined(WOSS_NETCDF4_SUPPORT)
224 netCDF::NcVar lat_var;
225#else
226 NcVar* lat_var;
227#endif // defined(WOSS_NETCDF4_SUPPORT)
228
232#if defined(WOSS_NETCDF4_SUPPORT)
233 netCDF::NcVar lon_var;
234#else
235 NcVar* lon_var;
236#endif // defined(WOSS_NETCDF4_SUPPORT)
237
238
245 long get1DBathyIndex( const Coord& coords ) const ;
246
253 Gebco2DIndexes get2DBathyIndexes( const Coord& coords ) const ;
254 };
255
256}
257
258#endif // WOSS_NETCDF_SUPPORT
259
260#endif /* WOSS_BATHYMETRY_GEBCO_DB_H */
261
262
263
GEBCO_BATHY_TYPE
Definition bathymetry-gebco-db.h:132
@ GEBCO_1D_1_MINUTE_BATHY_TYPE
GEBCO 1D, one minute of arc netcf format.
Definition bathymetry-gebco-db.h:133
@ GEBCO_2D_1_MINUTE_BATHY_TYPE
GEBCO 2D, one minute of arc netcf format.
Definition bathymetry-gebco-db.h:135
@ GEBCO_INVALID_BATHY_TYPE
INVALID, must be last.
Definition bathymetry-gebco-db.h:138
@ GEBCO_1D_30_SECONDS_BATHY_TYPE
GEBCO 1D, thirty seconds of arc netcf format.
Definition bathymetry-gebco-db.h:134
@ GEBCO_2D_30_SECONDS_BATHY_TYPE
GEBCO 2D, thirty seconds of arc netcf format.
Definition bathymetry-gebco-db.h:136
@ GEBCO_2D_15_SECONDS_BATHY_TYPE
GEBCO 2D, fifteen seconds of arc netcf format.
Definition bathymetry-gebco-db.h:137
std::pair< long, long > Gebco2DIndexes
Definition bathymetry-gebco-db.h:127
NetCDF specialization of WossNetcdfDb for GEBCO database.
Definition bathymetry-gebco-db.h:148
virtual bool insertValue(const Coord &coordinates, const Bathymetry &bathymetry_value)
Definition bathymetry-gebco-db.cpp:151
netCDF::NcVar bathy_var
Definition bathymetry-gebco-db.h:214
netCDF::NcVar lon_var
Definition bathymetry-gebco-db.h:233
GEBCO_BATHY_TYPE getGebcoType()
Definition bathymetry-gebco-db.h:198
virtual bool finalizeConnection()
Definition bathymetry-gebco-db.cpp:72
long get1DBathyIndex(const Coord &coords) const
Definition bathymetry-gebco-db.cpp:320
Gebco2DIndexes get2DBathyIndexes(const Coord &coords) const
Definition bathymetry-gebco-db.cpp:365
virtual double getValue(const Coord &coords) const
Definition bathymetry-gebco-db.cpp:157
netCDF::NcVar lat_var
Definition bathymetry-gebco-db.h:224
GEBCO_BATHY_TYPE gebco_type
Definition bathymetry-gebco-db.h:207
void setGebcoType(const GEBCO_BATHY_TYPE &type)
Definition bathymetry-gebco-db.h:192
Coordinates (lat, long) class definitions and functions library.
Definition coordinates-definitions.h:107
Data behaviour class for bathymetry database.
Definition woss-db.h:292
NetCDF implementation of WossDb.
Definition woss-db.h:193
Provides the interface for woss::WossDb class.