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 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
23#ifndef WOSS_SSP_NETCDF_DB_H
24#define WOSS_SSP_NETCDF_DB_H
25
26
37#ifdef WOSS_NETCDF_SUPPORT
38
39#include <utility>
40#include <ssp-definitions.h>
41#include "woss-db.h"
42#if defined (WOSS_NETCDF4_SUPPORT)
43#include <ncVar.h>
44#endif // defined (WOSS_NETCDF4_SUPPORT)
45
46namespace woss {
47
48 static constexpr inline int SSP_WOA2005_STD_NLAT = 180;
50 static constexpr inline int SSP_WOA2005_STD_NLON = 360;
52 static constexpr inline double SSP_WOA2005_STD_SPACING = 1.0;
54 static constexpr inline double SSP_WOA2005_STD_MIN_LAT = -89.5;
56 static constexpr inline double SSP_WOA2005_STD_MAX_LAT = 89.5;
58 static constexpr inline double SSP_WOA2005_STD_MIN_LON = -179.5;
60 static constexpr inline double SSP_WOA2005_STD_MAX_LON = 179.5;
62 static constexpr inline double SSP_WOA2005_STD_START_LAT = 89.5;
64 static constexpr inline double SSP_WOA2005_STD_START_LON = -179.5;
66 static constexpr inline int SSP_WOA2013_STD_NLAT = 720;
68 static constexpr inline int SSP_WOA2013_STD_NLON = 1440;
70 static constexpr inline double SSP_WOA2013_STD_SPACING = 0.25;
72 static constexpr inline double SSP_WOA2013_STD_MIN_LAT = -89.875;
74 static constexpr inline double SSP_WOA2013_STD_MAX_LAT = 89.875;
76 static constexpr inline double SSP_WOA2013_STD_MIN_LON = -179.875;
78 static constexpr inline double SSP_WOA2013_STD_MAX_LON = 179.875;
80 static constexpr inline double SSP_WOA2013_STD_START_LAT = -89.875;
82 static constexpr inline double SSP_WOA2013_STD_START_LON = -179.875;
84 static constexpr inline int SSP_STD_NDEPTH = 33;
89 static constexpr inline short ssp_std_depths[SSP_STD_NDEPTH] = { 0, 10, 20, 30, 50, 75, 100, 125, 150, 200, 250, 300,
90 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500,
91 1750, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500 };
92
96 using SSPIndexes = std::pair< int, int >;
97
98 enum class WOADbType {
100 WOA_DB_TYPE_2013 = 1,
102 };
103
109 class SspWoa2005Db : public WossNetcdfDb, public WossSSPDb {
110
111 public:
112
117 SspWoa2005Db( const std::string& name );
118
119#if defined (WOSS_NETCDF4_SUPPORT)
125 SspWoa2005Db( const std::string& name, WOADbType db_type );
126#endif // defined (WOSS_NETCDF4_SUPPORT)
127
128 virtual ~SspWoa2005Db() override = default;
129
130
135 virtual bool finalizeConnection() override;
136
144 virtual bool insertValue( const Coord& coordinates, const Time& time_value, const SSP& ssp_value ) override;
145
146
155 virtual std::unique_ptr<SSP> getValue( const Coord& coordinates, const Time& time, long double ssp_depth_precision ) const override;
156
162
163
164 protected:
165
170
174#if defined (WOSS_NETCDF4_SUPPORT)
175 netCDF::NcVar ssp_var;
176#else
177 NcVar* ssp_var;
178#endif // defined (WOSS_NETCDF4_SUPPORT)
179#if defined (WOSS_NETCDF4_SUPPORT)
183 netCDF::NcVar lat_var;
187 netCDF::NcVar lon_var;
188#endif // defined (WOSS_NETCDF4_SUPPORT)
189
195 SSPIndexes getSSPIndexes( const Coord& coordinates ) const;
196
197#if defined (WOSS_NETCDF4_SUPPORT)
204 void getSSPValue( const Coord& coordinates, const SSPIndexes& indexes, double ssp_values[] ) const;
205#else
211 void getSSPValue( const SSPIndexes& indexes, double ssp_values[] ) const;
212#endif // defined (WOSS_NETCDF4_SUPPORT)
213
214 };
215
216}
217
218#endif // WOSS_NETCDF_SUPPORT
219
220#endif /* WOSS_SSP_NETCDF_DB_H */
Coordinates (lat, long) class definitions and functions library.
Definition coordinates-definitions.h:98
SSP class offers multiple creation and manipulation capabilities for sound speed profile.
Definition ssp-definitions.h:247
WossDb for the custom made NetCDF WOA2005 SSP database.
Definition ssp-woa2005-db.h:109
void getSSPValue(const SSPIndexes &indexes, double ssp_values[]) const
SSPIndexes getSSPIndexes(const Coord &coordinates) const
Definition ssp-woa2005-db.cpp:120
WOADbType woa_db_type
Definition ssp-woa2005-db.h:169
virtual ~SspWoa2005Db() override=default
virtual bool finalizeConnection() override
Definition ssp-woa2005-db.cpp:70
netCDF::NcVar ssp_var
Definition ssp-woa2005-db.h:175
NcVar * ssp_var
Definition ssp-woa2005-db.h:177
netCDF::NcVar lon_var
Definition ssp-woa2005-db.h:187
netCDF::NcVar lat_var
Definition ssp-woa2005-db.h:183
WOADbType getWoaDbType() const
Definition ssp-woa2005-db.h:161
virtual bool insertValue(const Coord &coordinates, const Time &time_value, const SSP &ssp_value) override
Definition ssp-woa2005-db.cpp:114
virtual std::unique_ptr< SSP > getValue(const Coord &coordinates, const Time &time, long double ssp_depth_precision) const override
Definition ssp-woa2005-db.cpp:266
void getSSPValue(const Coord &coordinates, const SSPIndexes &indexes, double ssp_values[]) const
Definition ssp-woa2005-db.cpp:169
a class for time date manipulation
Definition time-definitions.h:83
NetCDF implementation of WossDb.
Definition woss-db.h:178
Data behaviour class for SSP database.
Definition woss-db.h:338
Definition ac-toolbox-arr-asc-reader.h:44
WOADbType
Definition ssp-woa2005-db.h:98
@ WOA_DB_TYPE_INVALID
Must always be the last.
@ WOA_DB_TYPE_2013
2013, 2001, 2018 and 2023 NetCDF4 Db type, 0.25 degree resolution
@ WOA_DB_TYPE_2005
2005 and 2009 NetCDF Db type, 1 degree resolution
std::pair< int, int > SSPIndexes
Definition ssp-woa2005-db.h:96
Definitions and library for Sound Speed Profiles.
Provides the interface for woss::WossDb class.