bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
HDF5CFGeoCF1D.cc
1
2// This file is part of the hdf5 data handler for the OPeNDAP data server.
3// Authors: Kent 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 <libdap/debug.h>
12
13#include <libdap/InternalErr.h>
14#include <BESDebug.h>
15using namespace std;
16using namespace libdap;
17
18// This now only applies to Sinusoidal projection. I need to handle LAMAZ and PS.
19bool HDF5CFGeoCF1D::read()
20{
21
22 // Declaration of offset,count and step
23 vector<int64_t> offset;
24 offset.resize(1);
25 vector<int64_t> count;
26 count.resize(1);
27 vector<int64_t> step;
28 step.resize(1);
29
30 // Obtain offset,step and count from the client expression constraint
31 int64_t nelms = -1;
32 nelms = format_constraint(offset.data(), step.data(), count.data());
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(int64_t i = 1;i<tnumelm; i++)
50 val[i] = val[i-1] + step_v;
51
52 if (nelms == tnumelm) {
53 set_value_ll((dods_float64 *) val.data(), nelms);
54 }
55 else {
56 vector<double>val_subset;
57 val_subset.resize(nelms);
58 for (int64_t i = 0; i < count[0]; i++)
59 val_subset[i] = val[offset[0] + step[0] * i];
60 set_value_ll((dods_float64 *) val_subset.data(), nelms);
61 }
62
63 return false;
64}
65
66
67void HDF5CFGeoCF1D::read_data_NOT_from_mem_cache(bool /*add_cache*/,void */*buf*/){
68 //Not implement yet/
69 return;
70
71
72}