[原][c++][netcdf]通过c\c++读取字段的scale_factor与add_offset
2021-01-16 10:12
标签:off c++ varname offset lan tty reads amp 编译 函数:c++ 结果: 怎么编译 netcdf-c++?看这里! [原][c++][netcdf]通过c\c++读取字段的scale_factor与add_offset 标签:off c++ varname offset lan tty reads amp 编译 原文地址:https://www.cnblogs.com/lyggqm/p/12927292.htmlvoid readScaleAndOffset(const char* FileName,const char* VarName)
{
NcFile dataFile(FileName, NcFile::read);
NcVar Varf = dataFile.getVar(VarName);
//查看维度
cout "XSizef" 0).getSize() endl;
cout "YSizef" 1).getSize() endl;
cout "ZSizef" 2).getSize() endl;
cout "WSizef" 3).getSize() endl;
//查看压缩值
NcVarAtt AttT = Varf.getAtt("scale_factor");
NcType TypeT = AttT.getType();
int TypeId = TypeT.getId(); //float,长度是1
float fScale = 0.0f;
AttT.getValues(&fScale);
AttT = Varf.getAtt("add_offset");
float fOffset = 0.0f;
AttT.getValues(&fOffset);
cout "scale_factor" endl;
cout "add_offset" endl;
}
XSizef1
YSizef30
ZSizef501
WSizef751
scale_factor0.00189809
add_offset-7.62598
文章标题:[原][c++][netcdf]通过c\c++读取字段的scale_factor与add_offset
文章链接:http://soscw.com/index.php/essay/42661.html