VAPOR3 3.9.4
DCUGRID.h
Go to the documentation of this file.
1#include <vector>
2#include <algorithm>
3#include <map>
4#include <iostream>
5#include <vapor/MyBase.h>
7#include <vapor/DerivedVar.h>
10#include <vapor/utils.h>
11#include <vapor/DCCF.h>
12
13#pragma once
14
15namespace VAPoR {
16
28class VDF_API DCUGRID : public VAPoR::DCCF {
29public:
30 int OpenVariableRead(size_t ts, string varname, int level = 0, int lod = 0) override;
31
32 int Read(int fd, int *data) override;
33 int ReadRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, int *data) override;
34
35 int CloseVariable(int fd) override;
36
37protected:
38 int initialize(const vector<string> &paths, const std::vector<string> &options) override;
39
40 int initAuxilliaryVars(NetCDFCFCollection *ncdfc, std::map<string, DC::AuxVar> &auxVarsMap) override;
41
42 int initDataVars(NetCDFCFCollection *ncdfc, std::map<string, DC::DataVar> &dataVarsMap) override;
43
44 int initMesh(NetCDFCFCollection *ncdfc, std::map<string, DC::Mesh> &meshMap) override;
45
46 string getMapProjection() const override { return ("+proj=eqc +ellps=WGS84 +lon_0=0.0 +lat_0=0.0"); }
47
48private:
49 // Struct to contain the most general form of UGRID mesh
50 //
51 struct uGridMeshType {
52 int topology;
53 vector<string> nodeCoordinates;
54 string faceNodeConnectivity;
55 string faceDimension;
56 string edgeNodeConnectivity;
57 string edgeDimension;
58 string faceEdgeConnectivity;
59 string faceFaceConnectivity;
60 string edgeFaceConnectivity;
61 string boundaryNodeConnectivity;
62 vector<string> faceCoordinates;
63 vector<string> edgeCoordinates;
64 };
65 std::map<string, uGridMeshType> _uGridMeshMap;
66
67 std::map<string, vector<int>> _faceNodeConnectivityMap;
68 std::map<int, string> _openConnectivityMaps;
69
70 string _getLayeredVerticalCoordVar(NetCDFCFCollection *ncdfc, string varName) const;
71
72 void _getUGridMeshFromFile(NetCDFCFCollection *ncdfc, string meshVarName, uGridMeshType &m);
73
74 string _getMeshNodeDimName(NetCDFCFCollection *ncdf, const uGridMeshType &m) const;
75
76 string _getMeshFaceDimName(NetCDFCFCollection *ncdf, const uGridMeshType &m) const;
77
78 size_t _getMeshMaxNodesPerFace(NetCDFCFCollection *ncdf, const uGridMeshType &m) const;
79
80 bool _getVarTimeCoords(NetCDFCFCollection *ncdfc, string varName, string &coordName) const;
81
82 int _initFaceNodeConnectivityMap(NetCDFCFCollection *ncdfc);
83};
84}; // namespace VAPoR
Class for reading a NetCDF Climate Forecast (CF) data set stored as a series of NetCDF files.
Definition: DCCF.h:30
Class for reading a UGRID data set stored as a series of NetCDF files: https://ugrid-conventions....
Definition: DCUGRID.h:28
int initDataVars(NetCDFCFCollection *ncdfc, std::map< string, DC::DataVar > &dataVarsMap) override
int ReadRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, int *data) override
int CloseVariable(int fd) override
int initMesh(NetCDFCFCollection *ncdfc, std::map< string, DC::Mesh > &meshMap) override
int OpenVariableRead(size_t ts, string varname, int level=0, int lod=0) override
int initAuxilliaryVars(NetCDFCFCollection *ncdfc, std::map< string, DC::AuxVar > &auxVarsMap) override
string getMapProjection() const override
Definition: DCUGRID.h:46
int Read(int fd, int *data) override
int initialize(const vector< string > &paths, const std::vector< string > &options) override
Wrapper for a collection of netCDF files.
#define VDF_API
Definition: common.h:73