FileWriterCDFISTP.cc
2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* FileWriterCDFISTP.cc
*
* Created on: 28 feb. 2022
* Author: AKKA
*/
#include "FileWriterCDFISTP.hh"
#include "FileWriterCDF.hh"
#include "TimeUtil.hh"
#include "FileWriter.hh"
#include "ParamMgr.hh"
#include "DataSetMgr.hh"
#include "InstrumentMgr.hh"
#include "MissionMgr.hh"
#include <sstream>
#include <cstring>
#include <stdlib.h>
#include <boost/cast.hpp>
#define CDF_TIME_VAR "AMDA_TIME"
namespace AMDA {
namespace ParamOutputImpl {
namespace Download {
namespace FileWriter {
using namespace AMDA::Info;
FileWriterCDFISTP::FileWriterCDFISTP(AMDA::Parameters::ParameterManager& pParameterManager) :
FileWriterCDF(pParameterManager)
{
}
FileWriterCDFISTP::~FileWriterCDFISTP(void)
{
closeFile();
}
std::string FileWriterCDFISTP::getExtension(void)
{
return "cdf";
}
bool FileWriterCDFISTP::writeTimeData(std::string /* paramId */, double data, OutputFormatTime /* timeFormat */, bool isFirstParam)
{
if (_cdfid == NULL)
return false;
if (!isFirstParam)
return true;
std::stringstream isoTime;
TimeUtil::formatTimeDateInIso(data, isoTime);
isoTime << "000000";
char epString[TT2000_0_STRING_LEN + 1];
memset(&epString, 0, sizeof(epString));
if (!isoTime.str().empty())
strncpy(epString, isoTime.str().c_str(), TT2000_0_STRING_LEN);
long long epochTime = parseTT2000(epString);
return writeOneData(CDF_TIME_VAR, 0, &epochTime);
}
/*bool FileWriterCDFISTP::writeMissionInfo(MissionInfoSPtr missionInfo, long varNum)
{
if (missionInfo == nullptr) {
std::cout << std::endl << std::endl << std::endl << "FER - HAHAHAHA" << std::endl << std::endl << std::endl<< std::endl;
addAttribute("Source_name", "unk>Unknown mission", GLOBAL_SCOPE);
return false;
}
std::vector<std::pair<std::string,std::string>> infoMap = missionInfo->getInfoMap();
for (auto info : infoMap)
std::cout << std::endl << std::endl << std::endl << "FER - " << &info << std::cout << std::endl << std::endl << std::endl << std::endl;
//for (auto info : infoMap)
// if(info.first == "MISSION_NAME")
// addAttribute(info.first + ">" + info["MISSION_DESCRIPTION"]);
//write info about mission
// std::vector<std::pair<std::string,std::string>> infoMap = missionInfo->getInfoMap();
//
// for (auto info : infoMap)
// addAttribute(info.first, info.second, VARIABLE_SCOPE, varNum);
// return true;
// }
return true;
}*/
} /* namespace FileWriter */
} /* namespace Download */
} /* namespace ParamOutputImpl */
} /* namespace AMDA */