bes  Updated for version 3.20.6
FONcArray.h
1 // FONcArray.h
2 
3 // This file is part of BES Netcdf File Out Module
4 
5 // Copyright (c) 2004,2005 University Corporation for Atmospheric Research
6 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 //
22 // You can contact University Corporation for Atmospheric Research at
23 // 3080 Center Green Drive, Boulder, CO 80301
24 
25 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
26 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
27 //
28 // Authors:
29 // pwest Patrick West <pwest@ucar.edu>
30 // jgarcia Jose Garcia <jgarcia@ucar.edu>
31 
32 #ifndef FONcArray_h_
33 #define FONcArray_h_ 1
34 
35 #include <vector>
36 #include <string>
37 
38 #include "FONcBaseType.h"
39 
40 class FONcDim;
41 class FONcMap;
42 
43 namespace libdap {
44 class BaseType;
45 class Array;
46 }
47 
54 class FONcArray: public FONcBaseType {
55 private:
56  // The array being converted
57  libdap::Array * d_a;
58  // The type of data stored in the array
59  nc_type d_array_type;
60  // The number of dimensions to be stored in netcdf (if string, 2)
61  int d_ndims;
62  // The actual number of dimensions of this array (if string, 1)
63  int d_actual_ndims;
64  // The number of elements that will be stored in netcdf
65  int d_nelements;
66  // The FONcDim dimensions to be used for this variable
67  std::vector<FONcDim *> d_dims;
68 
69  // The netcdf dimension ids for this array
70  std::vector<int> d_dim_ids;
71  // The netcdf dimension sizes to be written
72  //size_t * d_dim_sizes; // changed int to size_t. jhrg 12.27.2011
73  std::vector<size_t> d_dim_sizes;
74  // If string data, we need to do some comparison, so instead of
75  // reading it more than once, read it once and save here
76  std::vector<std::string> d_str_data;
77 
78  // If the array is already a map in a grid, then we don't want to
79  // define it or write it.
80  bool d_dont_use_it;
81 
82  // Make this a vector<> jhrg 10/12/15
83  // The netcdf chunk sizes for each dimension of this array.
84  std::vector<size_t> d_chunksizes;
85 
86  // This is vector holds instances of FONcMap* that wrap existing Array
87  // objects that are pushed onto the global FONcGrid::Maps vector. These
88  // are hand made reference counting pointers. I'm not sure we need to
89  // store copies in this object, but it may be the case that without
90  // calling the FONcMap->decref() method they are not deleted. jhrg 8/28/13
91  std::vector<FONcMap*> d_grid_maps;
92 
93  FONcDim * find_dim(std::vector<std::string> &embed, const std::string &name, int size, bool ignore_size = false);
94 
95 public:
96  FONcArray(libdap::BaseType *b);
97  virtual ~FONcArray();
98 
99  virtual void convert(std::vector<std::string> embed);
100  virtual void define(int ncid);
101  virtual void write(int ncid);
102 
103  virtual std::string name();
104  virtual libdap::Array *array()
105  {
106  return d_a;
107  }
108 
109  virtual void dump(std::ostream &strm) const;
110 
111  static std::vector<FONcDim *> Dimensions;
112 };
113 
114 #endif // FONcArray_h_
115 
FONcArray::FONcArray
FONcArray(libdap::BaseType *b)
Constructor for FONcArray that takes a DAP Array.
Definition: FONcArray.cc:55
FONcArray
A DAP Array with file out netcdf information included.
Definition: FONcArray.h:54
FONcMap
A map of a DAP Grid with file out netcdf information included.
Definition: FONcMap.h:52
FONcArray::write
virtual void write(int ncid)
Write the array out to the netcdf file.
Definition: FONcArray.cc:366
FONcArray::~FONcArray
virtual ~FONcArray()
Destructor that cleans up the array.
Definition: FONcArray.cc:76
FONcArray::name
virtual std::string name()
returns the name of the DAP Array
Definition: FONcArray.cc:536
libdap
Definition: BESDapFunctionResponseCache.h:35
FONcDim
A class that represents the dimension of an array.
Definition: FONcDim.h:44
FONcBaseType
A DAP BaseType with file out netcdf information included.
Definition: FONcBaseType.h:58
FONcArray::convert
virtual void convert(std::vector< std::string > embed)
Converts the DAP Array to a FONcArray.
Definition: FONcArray.cc:107
FONcArray::define
virtual void define(int ncid)
define the DAP Array in the netcdf file
Definition: FONcArray.cc:272
FONcArray::dump
virtual void dump(std::ostream &strm) const
dumps information about this object for debugging purposes
Definition: FONcArray.cc:549