bes  Updated for version 3.20.6
HDF5CFGeoCF1D.cc
1 // This file is part of the hdf5 data handler for the OPeNDAP data server.
3 // Authors: MuQun Yang <myang6@hdfgroup.org>
4 // Copyright (c) 2017 The HDF Group
6 
7 #include "HDF5CFGeoCF1D.h"
8 #include <iostream>
9 #include <sstream>
10 #include <cassert>
11 #include <debug.h>
12 
13 #include <InternalErr.h>
14 #include <BESDebug.h>
15 using namespace std;
16 using namespace libdap;
17 
18 // This now only applies to Sinusoidal projection. I need to handle LAMAZ and PS.
19 bool HDF5CFGeoCF1D::read()
20 {
21 
22  // Declaration of offset,count and step
23  vector<int> offset;
24  offset.resize(1);
25  vector<int> count;
26  count.resize(1);
27  vector<int> step;
28  step.resize(1);
29 
30  // Obtain offset,step and count from the client expression constraint
31  int nelms = -1;
32  nelms = format_constraint(&offset[0], &step[0], &count[0]);
33 
34  vector<double> val;
35  val.resize(tnumelm);
36 
37  //Based on the HFRHANDLER-303, the number of element represents cells according
38  //to the data scientist at LP DAAC.
39  // Use meter instead of km. KY 2016-04-22
40 #if 0
41  //double step_v = (evalue - svalue)/((tnumelm-1)*1000);
42  // double newsvalue = svalue/1000;
43  //val[0] = svalue/1000;
44  //double step_v = (evalue - svalue)/(tnumelm*1000);
45 #endif
46 
47  double step_v = (evalue - svalue)/tnumelm;
48  val[0] = svalue;
49  for(int i = 1;i<tnumelm; i++)
50  val[i] = val[i-1] + step_v;
51 
52  if (nelms == tnumelm) {
53  set_value((dods_float64 *) &val[0], nelms);
54  }
55  else {
56  vector<double>val_subset;
57  val_subset.resize(nelms);
58  for (int i = 0; i < count[0]; i++)
59  val_subset[i] = val[offset[0] + step[0] * i];
60  set_value((dods_float64 *) &val_subset[0], nelms);
61  }
62 
63  return false;
64 }
65 
66 
67 void HDF5CFGeoCF1D::read_data_NOT_from_mem_cache(bool /*add_cache*/,void */*buf*/){
68  //Not implement yet/
69  return;
70 
71 
72 }
libdap
Definition: BESDapFunctionResponseCache.h:35