World Ocean Simulation System (WOSS) library
ssp-woa2005-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
29
30#ifndef WOSS_SSP_NETCDF_DB_H
31#define WOSS_SSP_NETCDF_DB_H
32
33
44#ifdef WOSS_NETCDF_SUPPORT
45
46
47#include <ssp-definitions.h>
48#include "woss-db.h"
49#if defined (WOSS_NETCDF4_SUPPORT)
50#include <ncVar.h>
51#endif // defined (WOSS_NETCDF4_SUPPORT)
52
53namespace woss {
54
55 static const int SSP_WOA2005_STD_NLAT = 180;
57 static const int SSP_WOA2005_STD_NLON = 360;
59 static const double SSP_WOA2005_STD_SPACING = 1.0;
62 static const double SSP_WOA2005_STD_MIN_LAT = -89.5;
64 static const double SSP_WOA2005_STD_MAX_LAT = 89.5;
67 static const double SSP_WOA2005_STD_MIN_LON = -179.5;
69 static const double SSP_WOA2005_STD_MAX_LON = 179.5;
72 static const double SSP_WOA2005_STD_START_LAT = 89.5;
74 static const double SSP_WOA2005_STD_START_LON = -179.5;
77 static const int SSP_WOA2013_STD_NLAT = 720;
79 static const int SSP_WOA2013_STD_NLON = 1440;
81 static const double SSP_WOA2013_STD_SPACING = 0.25;
84 static const double SSP_WOA2013_STD_MIN_LAT = -89.875;
86 static const double SSP_WOA2013_STD_MAX_LAT = 89.875;
89 static const double SSP_WOA2013_STD_MIN_LON = -179.875;
91 static const double SSP_WOA2013_STD_MAX_LON = 179.875;
94 static const double SSP_WOA2013_STD_START_LAT = -89.875;
96 static const double SSP_WOA2013_STD_START_LON = -179.875;
98 static const int SSP_STD_NDEPTH = 33;
103 static const short ssp_std_depths[SSP_STD_NDEPTH] = { 0, 10, 20, 30, 50, 75, 100, 125, 150, 200, 250, 300,
104 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500,
105 1750, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500 };
106
110 typedef ::std::pair< int, int > SSPIndexes;
111
117
123 class SspWoa2005Db : public WossNetcdfDb, public WossSSPDb {
124
125
126 public:
127
128
133 SspWoa2005Db( const ::std::string& name );
134
135#if defined (WOSS_NETCDF4_SUPPORT)
141 SspWoa2005Db( const ::std::string& name, WOADbType db_type );
142#endif // defined (WOSS_NETCDF4_SUPPORT)
143
144 virtual ~SspWoa2005Db() { }
145
146
151 virtual bool finalizeConnection();
152
153
161 virtual bool insertValue( const Coord& coordinates, const Time& time_value, const SSP& ssp_value );
162
163
172 virtual SSP* getValue( const Coord& coordinates, const Time& time, long double ssp_depth_precision ) const ;
173
179
180
181 protected:
182
187
191#if defined (WOSS_NETCDF4_SUPPORT)
192 netCDF::NcVar ssp_var;
193#else
194 NcVar* ssp_var;
195#endif // defined (WOSS_NETCDF4_SUPPORT)
196
197#if defined (WOSS_NETCDF4_SUPPORT)
201 netCDF::NcVar lat_var;
205 netCDF::NcVar lon_var;
206#endif // defined (WOSS_NETCDF4_SUPPORT)
207
213 SSPIndexes getSSPIndexes( const Coord& coordinates ) const;
214
215#if defined (WOSS_NETCDF4_SUPPORT)
222 void getSSPValue( const Coord& coordinates, const SSPIndexes& indexes, double ssp_values[] ) const;
223#else
229 void getSSPValue( const SSPIndexes& indexes, double ssp_values[] ) const;
230#endif // defined (WOSS_NETCDF4_SUPPORT)
231
232
233 };
234
235
236}
237
238
239#endif // WOSS_NETCDF_SUPPORT
240
241#endif /* WOSS_SSP_NETCDF_DB_H */
242
243
244
Coordinates (lat, long) class definitions and functions library.
Definition coordinates-definitions.h:107
SSP class offers multiple creation and manipulation capabilities for sound speed profile.
Definition ssp-definitions.h:258
WossDb for the custom made NetCDF WOA2005 SSP database.
Definition ssp-woa2005-db.h:123
virtual bool insertValue(const Coord &coordinates, const Time &time_value, const SSP &ssp_value)
Definition ssp-woa2005-db.cpp:121
void getSSPValue(const SSPIndexes &indexes, double ssp_values[]) const
SSPIndexes getSSPIndexes(const Coord &coordinates) const
Definition ssp-woa2005-db.cpp:127
WOADbType woa_db_type
Definition ssp-woa2005-db.h:186
virtual SSP * getValue(const Coord &coordinates, const Time &time, long double ssp_depth_precision) const
Definition ssp-woa2005-db.cpp:266
netCDF::NcVar ssp_var
Definition ssp-woa2005-db.h:192
netCDF::NcVar lon_var
Definition ssp-woa2005-db.h:205
netCDF::NcVar lat_var
Definition ssp-woa2005-db.h:201
WOADbType getWoaDbType() const
Definition ssp-woa2005-db.h:178
void getSSPValue(const Coord &coordinates, const SSPIndexes &indexes, double ssp_values[]) const
Definition ssp-woa2005-db.cpp:170
virtual bool finalizeConnection()
Definition ssp-woa2005-db.cpp:77
a class for time date manipulation
Definition time-definitions.h:95
NetCDF implementation of WossDb.
Definition woss-db.h:193
Data behaviour class for SSP database.
Definition woss-db.h:375
Definitions and library for Sound Speed Profiles.
WOADbType
Definition ssp-woa2005-db.h:112
@ WOA_DB_TYPE_2005
2005 and 2009 NetCDF Db type, 1 degree resolution
Definition ssp-woa2005-db.h:113
@ WOA_DB_TYPE_INVALID
Must always be the last.
Definition ssp-woa2005-db.h:115
@ WOA_DB_TYPE_2013
2013, 2001 and 2018 NetCDF4 Db type, 0.25 degree resolution
Definition ssp-woa2005-db.h:114
::std::pair< int, int > SSPIndexes
Definition ssp-woa2005-db.h:110
Provides the interface for woss::WossDb class.