bes  Updated for version 3.20.13
HDFEOS2ArraySwathGeoMultiDimMapField.h
1 // Retrieves the latitudes and longitudes of an HDF-EOS2 Swath using multiple dimension maps
3 
4 // Authors: MuQun Yang <myang6@hdfgroup.org>
5 // Copyright (c) 2010-2020 The HDF Group
7 // For the swath using the multiple dimension maps,
8 // Latitude/longitude will be interpolated accordingly.
9 #ifdef USE_HDFEOS2_LIB
10 #ifndef HDFEOS2ARRAY_SWATHGEOMULTIDIMMAPFIELD_H
11 #define HDFEOS2ARRAY_SWATHGEOMULTIDIMMAPFIELD_H
12 
13 #include <libdap/Array.h>
14 #include "HDFCFUtil.h"
15 #include "HdfEosDef.h"
16 
17 
18 class HDFEOS2ArraySwathGeoMultiDimMapField:public libdap::Array
19 {
20  public:
21  HDFEOS2ArraySwathGeoMultiDimMapField (int rank, const std::string & filename,
22  const int swathfd, const std::string & swathname,
23  const std::string & fieldname,
24  const int dim0size,const int dim0offset,const int dim0inc,
25  const int dim1size,const int dim1offset,const int dim1inc,
26  const std::string & n = "",
27  libdap::BaseType * v = nullptr):
28  libdap::Array (n, v),
29  rank (rank),
30  filename(filename),
31  swathfd (swathfd),
32  swathname (swathname),
33  fieldname (fieldname),
34  dim0size(dim0size),
35  dim0offset(dim0offset),
36  dim0inc(dim0inc),
37  dim1size(dim1size),
38  dim1offset(dim1offset),
39  dim1inc(dim1inc){
40  }
41  ~ HDFEOS2ArraySwathGeoMultiDimMapField () override = default;
42 
43  // Standard way to pass the coordinates of the subsetted region from the client to the handlers
44  int format_constraint (int *cor, int *step, int *edg);
45 
46  libdap::BaseType *ptr_duplicate () override
47  {
48  return new HDFEOS2ArraySwathGeoMultiDimMapField (*this);
49  }
50 
51  // Read the data
52  bool read () override;
53 
54  private:
55 
56  // Field array rank
57  int rank;
58 
59  // HDF-EOS2 file name
60  std::string filename;
61 
62  int swathfd;
63 
64  // HDF-EOS2 swath name
65  std::string swathname;
66 
67  // HDF-EOS2 field name
68  std::string fieldname;
69 
70  int dim0size;
71  int dim0offset;
72  int dim0inc;
73  int dim1size;
74  int dim1offset;
75  int dim1inc;
76  // Obtain Field value
77  template < class T > int GetFieldValue (int32, const std::string &,const std::vector <int>&,const std::vector <int>&,const std::vector<int>&, std::vector < T > &, std::vector<int32>&);
78 
79  // The internal routine to do the interpolation
80  template < class T > int _expand_dimmap_field (std::vector < T > *pvals, int32 rank, int32 dimsa[], int dimindex, int32 ddimsize, int32 offset, int32 inc) const;
81 
82  // subsetting routine to ensure the subsetted 2D field to be returned.
83  template < class T > bool Field2DSubset (T * outlatlon, const int majordim, const int minordim, T * latlon, const int32 * offset, const int32 * count, const int32 * step) const;
84 
85 
86 
87 };
88 
89 
90 #endif
91 #endif