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 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
40#ifndef WOSS_SEDIMENT_DECK41_COORD_DB_H
41#define WOSS_SEDIMENT_DECK41_COORD_DB_H
42
43
44#ifdef WOSS_NETCDF_SUPPORT
45
47#include "woss-db.h"
48#if defined (WOSS_NETCDF4_SUPPORT)
49#include <ncVar.h>
50#endif // defined (WOSS_NETCDF4_SUPPORT)
51
52namespace woss {
53
54
55 static const int DECK41_MINUTES_SEDIM_NLAT = 10801;
57 static const int DECK41_MINUTES_SEDIM_NLON = 21601;
59 static const double DECK41_MINUTES_SEDIM_SPACING = 0.0166666666666667;
61 static const int DECK41_V2_SEDIM_NLAT = 10800;
63 static const int DECK41_V2_SEDIM_NLON = 21600;
65 static const double DECK41_V2_SEDIM_MIN_LAT = -89.9833333333333333;
67 static const double DECK41_V2_SEDIM_MAX_LAT = 89.9833333333333333;
69 static const double DECK41_V2_SEDIM_MIN_LON = -179.9833333333333333;
71 static const double DECK41_V2_SEDIM_MAX_LON = 179.9833333333333333;
73 static const double DECK41_V2_SEDIM_START_LAT = -89.9833333333333333;
75 static const double DECK41_V2_SEDIM_START_LON = -179.9833333333333333;
77 static const double DECK41_V2_SEDIM_SPACING = 0.0166666666666667;
87
88
95
96
97 public:
98
103 SedimDeck41CoordDb( const ::std::string& name = DB_NAME_NOT_SET );
104
105#if defined (WOSS_NETCDF4_SUPPORT)
111 SedimDeck41CoordDb( const ::std::string& name, DECK41DbType db_type );
112#endif // defined (WOSS_NETCDF4_SUPPORT)
113
114 virtual ~SedimDeck41CoordDb() { }
115
121 Deck41Types getSeaFloorType( const Coord& coordinates ) const ;
122
123
128 virtual bool finalizeConnection();
129
130
135 virtual bool isValid() { return( WossNetcdfDb::isValid()
136 && db_name != DB_NAME_NOT_SET && deck41_db_type != DECK41_DB_INVALID_TYPE ); }
137
138#if defined (WOSS_NETCDF4_SUPPORT)
143 void setDeck41DbType( DECK41DbType db_type ) { deck41_db_type = db_type; }
144#endif // defined (WOSS_NETCDF4_SUPPORT)
145
151
152
153 protected:
154
155
159#if defined (WOSS_NETCDF4_SUPPORT)
160 netCDF::NcVar main_sedim_var_coord;
161#else
163#endif //
164
168#if defined (WOSS_NETCDF4_SUPPORT)
169 netCDF::NcVar sec_sedim_var_coord;
170#else
171 NcVar* sec_sedim_var_coord;
172#endif // defined (WOSS_NETCDF4_SUPPORT)
173
177#if defined(WOSS_NETCDF4_SUPPORT)
178 netCDF::NcVar lat_var;
179#else
180 NcVar* lat_var;
181#endif // defined(WOSS_NETCDF4_SUPPORT)
182
186#if defined(WOSS_NETCDF4_SUPPORT)
187 netCDF::NcVar lon_var;
188#else
189 NcVar* lon_var;
190#endif // defined(WOSS_NETCDF4_SUPPORT)
191
196
202 int getSedimIndex( const Coord& coords ) const ;
203
204#if defined (WOSS_NETCDF4_SUPPORT)
210 ::std::pair< int, int > getSedimIndexes( const Coord& coordinates ) const;
211#endif // defined (WOSS_NETCDF4_SUPPORT)
212 };
213
214
215}
216
217#endif // WOSS_NETCDF_SUPPORT
218
219#endif /* WOSS_SEDIMENT_DECK41_COORD_DB_H */
220
221
222
Coordinates (lat, long) class definitions and functions library.
Definition coordinates-definitions.h:107
WossDb for custom made NetCDF DECK41 Sediment database.
Definition sediment-deck41-coord-db.h:94
Deck41Types getSeaFloorType(const Coord &coordinates) const
Definition sediment-deck41-coord-db.cpp:177
netCDF::NcVar lon_var
Definition sediment-deck41-coord-db.h:187
::std::pair< int, int > getSedimIndexes(const Coord &coordinates) const
Definition sediment-deck41-coord-db.cpp:79
netCDF::NcVar lat_var
Definition sediment-deck41-coord-db.h:178
virtual bool isValid()
Definition sediment-deck41-coord-db.h:135
netCDF::NcVar sec_sedim_var_coord
Definition sediment-deck41-coord-db.h:169
int getSedimIndex(const Coord &coords) const
Definition sediment-deck41-coord-db.cpp:120
DECK41DbType getDeck41DbType() const
Definition sediment-deck41-coord-db.h:150
virtual bool finalizeConnection()
Definition sediment-deck41-coord-db.cpp:140
DECK41DbType deck41_db_type
Definition sediment-deck41-coord-db.h:195
netCDF::NcVar main_sedim_var_coord
Definition sediment-deck41-coord-db.h:160
void setDeck41DbType(DECK41DbType db_type)
Definition sediment-deck41-coord-db.h:143
virtual bool isValid()
Definition woss-db.h:134
::std::string db_name
Definition woss-db.h:164
NetCDF implementation of WossDb.
Definition woss-db.h:193
DECK41DbType
Definition sediment-deck41-coord-db.h:82
@ DECK41_DB_V2_TYPE
DECK41 V2 NetCDF4 db.
Definition sediment-deck41-coord-db.h:84
@ DECK41_DB_INVALID_TYPE
INVALID, must be last.
Definition sediment-deck41-coord-db.h:85
@ DECK41_DB_V1_TYPE
DECK41 V1 NetCDF Legacy db.
Definition sediment-deck41-coord-db.h:83
Definitions and library for woss::Sediment class.
Provides the interface for woss::WossDb class.