World Ocean Simulation System (WOSS) library
sediment-deck41-coord-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_SEDIMENT_DECK41_COORD_DB_H
34#define WOSS_SEDIMENT_DECK41_COORD_DB_H
35
36
37#ifdef WOSS_NETCDF_SUPPORT
38
39#include <utility>
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 int DECK41_MINUTES_SEDIM_NLAT = 10801;
50 static constexpr int DECK41_MINUTES_SEDIM_NLON = 21601;
52 static constexpr double DECK41_MINUTES_SEDIM_SPACING = 0.0166666666666667;
54 static constexpr int DECK41_V2_SEDIM_NLAT = 10800;
56 static constexpr int DECK41_V2_SEDIM_NLON = 21600;
58 static constexpr double DECK41_V2_SEDIM_MIN_LAT = -89.9833333333333333;
60 static constexpr double DECK41_V2_SEDIM_MAX_LAT = 89.9833333333333333;
62 static constexpr double DECK41_V2_SEDIM_MIN_LON = -179.9833333333333333;
64 static constexpr double DECK41_V2_SEDIM_MAX_LON = 179.9833333333333333;
66 static constexpr double DECK41_V2_SEDIM_START_LAT = -89.9833333333333333;
68 static constexpr double DECK41_V2_SEDIM_START_LON = -179.9833333333333333;
70 static constexpr double DECK41_V2_SEDIM_SPACING = 0.0166666666666667;
80
81
88
89 public:
90
95 SedimDeck41CoordDb( const std::string& name = DB_NAME_NOT_SET );
96
97#if defined (WOSS_NETCDF4_SUPPORT)
103 SedimDeck41CoordDb( const std::string& name, DECK41DbType db_type );
104#endif // defined (WOSS_NETCDF4_SUPPORT)
105
106 virtual ~SedimDeck41CoordDb() override = default;
107
113 Deck41Types getSeaFloorType( const Coord& coordinates ) const;
114
115
120 virtual bool finalizeConnection() override;
121
122
127 virtual bool isValid() const override { return( WossNetcdfDb::isValid()
128 && db_name != DB_NAME_NOT_SET && deck41_db_type != DECK41DbType::DECK41_DB_INVALID_TYPE ); }
129
130#if defined (WOSS_NETCDF4_SUPPORT)
135 void setDeck41DbType( DECK41DbType db_type ) { deck41_db_type = db_type; }
136#endif // defined (WOSS_NETCDF4_SUPPORT)
137
143
144
145 protected:
146
147
151#if defined (WOSS_NETCDF4_SUPPORT)
152 netCDF::NcVar main_sedim_var_coord;
153#else
155#endif //
156
160#if defined (WOSS_NETCDF4_SUPPORT)
161 netCDF::NcVar sec_sedim_var_coord;
162#else
164#endif // defined (WOSS_NETCDF4_SUPPORT)
165
169#if defined(WOSS_NETCDF4_SUPPORT)
170 netCDF::NcVar lat_var;
171#else
172 NcVar* lat_var;
173#endif // defined(WOSS_NETCDF4_SUPPORT)
174
178#if defined(WOSS_NETCDF4_SUPPORT)
179 netCDF::NcVar lon_var;
180#else
181 NcVar* lon_var;
182#endif // defined(WOSS_NETCDF4_SUPPORT)
183
188
194 int getSedimIndex( const Coord& coords ) const;
195
196#if defined (WOSS_NETCDF4_SUPPORT)
202 std::pair< int, int > getSedimIndexes( const Coord& coordinates ) const;
203#endif // defined (WOSS_NETCDF4_SUPPORT)
204 };
205
206
207}
208
209#endif // WOSS_NETCDF_SUPPORT
210
211#endif /* WOSS_SEDIMENT_DECK41_COORD_DB_H */
212
213
214
Coordinates (lat, long) class definitions and functions library.
Definition coordinates-definitions.h:98
WossDb for custom made NetCDF DECK41 Sediment database.
Definition sediment-deck41-coord-db.h:87
Deck41Types getSeaFloorType(const Coord &coordinates) const
Definition sediment-deck41-coord-db.cpp:177
virtual bool isValid() const override
Definition sediment-deck41-coord-db.h:127
virtual ~SedimDeck41CoordDb() override=default
netCDF::NcVar lon_var
Definition sediment-deck41-coord-db.h:179
std::pair< int, int > getSedimIndexes(const Coord &coordinates) const
Definition sediment-deck41-coord-db.cpp:73
netCDF::NcVar lat_var
Definition sediment-deck41-coord-db.h:170
NcVar * lon_var
Definition sediment-deck41-coord-db.h:181
NcVar * lat_var
Definition sediment-deck41-coord-db.h:172
netCDF::NcVar sec_sedim_var_coord
Definition sediment-deck41-coord-db.h:161
int getSedimIndex(const Coord &coords) const
Definition sediment-deck41-coord-db.cpp:118
DECK41DbType getDeck41DbType() const
Definition sediment-deck41-coord-db.h:142
NcVar * main_sedim_var_coord
Definition sediment-deck41-coord-db.h:154
NcVar * sec_sedim_var_coord
Definition sediment-deck41-coord-db.h:163
virtual bool finalizeConnection() override
Definition sediment-deck41-coord-db.cpp:140
DECK41DbType deck41_db_type
Definition sediment-deck41-coord-db.h:187
netCDF::NcVar main_sedim_var_coord
Definition sediment-deck41-coord-db.h:152
void setDeck41DbType(DECK41DbType db_type)
Definition sediment-deck41-coord-db.h:135
std::string db_name
Definition woss-db.h:152
virtual bool isValid() const
Definition woss-db.h:124
NetCDF implementation of WossDb.
Definition woss-db.h:178
Definition ac-toolbox-arr-asc-reader.h:44
DECK41DbType
Definition sediment-deck41-coord-db.h:75
@ DECK41_DB_V1_TYPE
DECK41 V1 NetCDF Legacy db.
@ DECK41_DB_INVALID_TYPE
INVALID, must be last.
@ DECK41_DB_V2_TYPE
DECK41 V2 NetCDF4 db.
std::pair< int, int > Deck41Types
Definition sediment-definitions.h:46
Definitions and library for woss::Sediment class.
Provides the interface for woss::WossDb class.