Commit 97190eba authored by Purves, Murray's avatar Purves, Murray
Browse files

Switching ARLIndexHeader and ARLRecordHeader names for clarity

parent 5f76c673
Pipeline #16672 passed with stages
in 16 minutes and 29 seconds
......@@ -13,65 +13,66 @@ class ARLDataStream::PImpl
public:
std::string file;
std::shared_ptr<radix::eafstream> stream;
int recordSize = 0;
static const int indexHeaderLength = 50, recordHeaderLength = 108;
int recordSize = 0;
static const int recordHeaderLength = 50, indexHeaderLength = 108;
};
void ARLDataStream::expand(const std::string& val, ARLIndexHeader& index)
void ARLDataStream::expand(const std::string& val, ARLRecordHeader& rheader)
{
if (val.size() < ARLDataStream::PImpl::indexHeaderLength)
if (val.size() < ARLDataStream::PImpl::recordHeaderLength)
{
throw std::runtime_error(
"Incorrect size for string expansion to ARLIndexHeader.");
"Incorrect size for string expansion to ARLRecordHeader.");
}
index.year = std::atoi(val.substr(0, 2).c_str());
index.month = std::atoi(val.substr(2, 2).c_str());
index.day = std::atoi(val.substr(4, 2).c_str());
index.hour = std::atoi(val.substr(6, 2).c_str());
index.ic = std::atoi(val.substr(8, 2).c_str());
index.il = std::atoi(val.substr(10, 2).c_str());
index.cgrid = val.substr(12, 2).c_str();
index.kvar = val.substr(14, 4);
index.nexp = std::atoi(val.substr(18, 4).c_str());
index.prec = float(std::atof(val.substr(22, 14).c_str()));
index.var1 = float(std::atof(val.substr(36, 14).c_str()));
rheader.year = std::atoi(val.substr(0, 2).c_str());
rheader.month = std::atoi(val.substr(2, 2).c_str());
rheader.day = std::atoi(val.substr(4, 2).c_str());
rheader.hour = std::atoi(val.substr(6, 2).c_str());
rheader.ic = std::atoi(val.substr(8, 2).c_str());
rheader.il = std::atoi(val.substr(10, 2).c_str());
rheader.cgrid = val.substr(12, 2).c_str();
rheader.kvar = val.substr(14, 4);
rheader.nexp = std::atoi(val.substr(18, 4).c_str());
rheader.prec = float(std::atof(val.substr(22, 14).c_str()));
rheader.var1 = float(std::atof(val.substr(36, 14).c_str()));
}
void ARLDataStream::expand(const std::string& val, const ARLIndexHeader& index,
ARLRecordHeader& header)
void ARLDataStream::expand(const std::string& val,
const ARLRecordHeader& rheader,
ARLIndexHeader& iheader)
{
if (val.size() < ARLDataStream::PImpl::recordHeaderLength)
if (val.size() < ARLDataStream::PImpl::indexHeaderLength)
{
throw std::runtime_error(
"Incorrect size for string expansion to ARLHeader.");
}
header.model_id = val.substr(0, 4);
header.icx = std::atoi(val.substr(4, 3).c_str());
header.mn = std::atoi(val.substr(7, 2).c_str());
header.pole_lat = float(std::atof(val.substr(9, 7).c_str()));
header.pole_lon = float(std::atof(val.substr(16, 7).c_str()));
header.ref_lat = float(std::atof(val.substr(23, 7).c_str()));
header.ref_lon = float(std::atof(val.substr(30, 7).c_str()));
header.size = float(std::atof(val.substr(37, 7).c_str()));
header.orient = float(std::atof(val.substr(44, 7).c_str()));
header.tang_lat = float(std::atof(val.substr(51, 7).c_str()));
header.sync_xp = float(std::atof(val.substr(58, 7).c_str()));
header.sync_yp = float(std::atof(val.substr(65, 7).c_str()));
header.sync_lat = float(std::atof(val.substr(72, 7).c_str()));
header.sync_lon = float(std::atof(val.substr(79, 7).c_str()));
header.dummy = float(std::atof(val.substr(86, 7).c_str()));
header.nx = std::atoi(val.substr(93, 3).c_str());
header.ny = std::atoi(val.substr(96, 3).c_str());
header.nz = std::atoi(val.substr(99, 3).c_str());
header.z_flag = std::atoi(val.substr(102, 2).c_str());
header.lenh = std::atoi(val.substr(104, 4).c_str());
int knx = ordinal(index.cgrid[0]);
int kny = ordinal(index.cgrid[1]);
iheader.model_id = val.substr(0, 4);
iheader.icx = std::atoi(val.substr(4, 3).c_str());
iheader.mn = std::atoi(val.substr(7, 2).c_str());
iheader.pole_lat = float(std::atof(val.substr(9, 7).c_str()));
iheader.pole_lon = float(std::atof(val.substr(16, 7).c_str()));
iheader.ref_lat = float(std::atof(val.substr(23, 7).c_str()));
iheader.ref_lon = float(std::atof(val.substr(30, 7).c_str()));
iheader.size = float(std::atof(val.substr(37, 7).c_str()));
iheader.orient = float(std::atof(val.substr(44, 7).c_str()));
iheader.tang_lat = float(std::atof(val.substr(51, 7).c_str()));
iheader.sync_xp = float(std::atof(val.substr(58, 7).c_str()));
iheader.sync_yp = float(std::atof(val.substr(65, 7).c_str()));
iheader.sync_lat = float(std::atof(val.substr(72, 7).c_str()));
iheader.sync_lon = float(std::atof(val.substr(79, 7).c_str()));
iheader.dummy = float(std::atof(val.substr(86, 7).c_str()));
iheader.nx = std::atoi(val.substr(93, 3).c_str());
iheader.ny = std::atoi(val.substr(96, 3).c_str());
iheader.nz = std::atoi(val.substr(99, 3).c_str());
iheader.z_flag = std::atoi(val.substr(102, 2).c_str());
iheader.lenh = std::atoi(val.substr(104, 4).c_str());
int knx = ordinal(rheader.cgrid[0]);
int kny = ordinal(rheader.cgrid[1]);
// Check for the grid domain extending beyond 3 digits
if (knx >= 64 || kny >= 64)
{
header.nx = (knx - 64) * 1000 + header.nx;
header.ny = (kny - 64) * 1000 + header.ny;
iheader.nx = (knx - 64) * 1000 + iheader.nx;
iheader.ny = (kny - 64) * 1000 + iheader.ny;
}
}
......@@ -88,55 +89,55 @@ ARLDataStream::ARLDataStream(const std::string& file,
}
}
bool ARLDataStream::read_index_header(ARLIndexHeader& iheader)
bool ARLDataStream::read_record_header(ARLRecordHeader& rheader)
{
bool result = false;
std::string headerString =
p->stream->readString(ARLDataStream::PImpl::indexHeaderLength);
expand(headerString, iheader);
radix_line("Read index header: year = " << iheader.year);
radix_line(" month = " << iheader.month);
radix_line(" day = " << iheader.day);
radix_line(" hour = " << iheader.hour);
radix_line(" variable = " << iheader.kvar);
radix_line(" scaling exponent = " << iheader.nexp);
radix_line(" initial value = " << iheader.var1);
p->stream->readString(ARLDataStream::PImpl::recordHeaderLength);
expand(headerString, rheader);
radix_line("Read record header: year = " << rheader.year);
radix_line(" month = " << rheader.month);
radix_line(" day = " << rheader.day);
radix_line(" hour = " << rheader.hour);
radix_line(" variable = " << rheader.kvar);
radix_line(" scaling exponent = " << rheader.nexp);
radix_line(" initial value = " << rheader.var1);
radix_line(" header as string:\n " << headerString);
result = true;
return result;
}
bool ARLDataStream::write_index_header(const ARLIndexHeader& iheader)
bool ARLDataStream::write_record_header(const ARLRecordHeader& rheader)
{
bool result = false;
radix_line("Write index header: year = " << iheader.year);
radix_line(" month = " << iheader.month);
radix_line(" day = " << iheader.day);
radix_line(" hour = " << iheader.hour);
radix_line(" variable = " << iheader.kvar);
radix_line(" scaling exponent = " << iheader.nexp);
radix_line(" initial value = " << iheader.var1);
radix_line("Write index header: year = " << rheader.year);
radix_line(" month = " << rheader.month);
radix_line(" day = " << rheader.day);
radix_line(" hour = " << rheader.hour);
radix_line(" variable = " << rheader.kvar);
radix_line(" scaling exponent = " << rheader.nexp);
radix_line(" initial value = " << rheader.var1);
// Construct index header string
char indexHeader[50];
sprintf(indexHeader, "%2d%2d%2d%2d%2d%2d%2d%4s%4d%14.7E%14.7E", iheader.year,
iheader.month, iheader.day, iheader.hour, iheader.ic, iheader.il,
std::stoi(iheader.cgrid.c_str()), iheader.kvar.c_str(), iheader.nexp,
iheader.prec, iheader.var1);
char recordHeader[50];
sprintf(recordHeader, "%2d%2d%2d%2d%2d%2d%2d%4s%4d%14.7E%14.7E", rheader.year,
rheader.month, rheader.day, rheader.hour, rheader.ic, rheader.il,
std::stoi(rheader.cgrid.c_str()), rheader.kvar.c_str(), rheader.nexp,
rheader.prec, rheader.var1);
p->stream->writeString(std::string(indexHeader), 50);
p->stream->writeString(std::string(recordHeader), 50);
radix_line(" header as string:\n " << indexHeader);
radix_line(" header as string:\n " << recordHeader);
result = true;
return result;
}
bool ARLDataStream::read_next_index_header(ARLIndexHeader& iheader)
bool ARLDataStream::read_next_record_header(ARLRecordHeader& rheader)
{
int bytesToSkip = roundUpInt(p->stream->bytesRead(), p->recordSize) -
p->stream->bytesRead();
......@@ -144,26 +145,26 @@ bool ARLDataStream::read_next_index_header(ARLIndexHeader& iheader)
p->stream->skipBytes(bytesToSkip);
return read_index_header(iheader);
return read_record_header(rheader);
}
bool ARLDataStream::read_record_header(const ARLIndexHeader& iheader,
ARLRecordHeader& rheader)
bool ARLDataStream::read_index_header(const ARLRecordHeader& rheader,
ARLIndexHeader& iheader)
{
bool result = false;
std::string headerString =
p->stream->readString(ARLDataStream::PImpl::recordHeaderLength);
expand(headerString, iheader, rheader);
p->stream->readString(ARLDataStream::PImpl::indexHeaderLength);
expand(headerString, rheader, iheader);
// Calculate and save record size
p->recordSize =
(rheader.nx * rheader.ny) + ARLDataStream::PImpl::indexHeaderLength;
(iheader.nx * iheader.ny) + ARLDataStream::PImpl::recordHeaderLength;
radix_line(" Read record header: model = " << rheader.model_id);
radix_line(" nx = " << rheader.nx);
radix_line(" ny = " << rheader.ny);
radix_line(" nz = " << rheader.nz);
radix_line(" Read record header: model = " << iheader.model_id);
radix_line(" nx = " << iheader.nx);
radix_line(" ny = " << iheader.ny);
radix_line(" nz = " << iheader.nz);
radix_line(" Size of each record = " << p->recordSize);
radix_line(" header as string:\n " << headerString);
......@@ -171,32 +172,32 @@ bool ARLDataStream::read_record_header(const ARLIndexHeader& iheader,
return result;
}
bool ARLDataStream::write_record_header(const ARLIndexHeader& iheader,
const ARLRecordHeader& rheader)
bool ARLDataStream::write_index_header(const ARLRecordHeader& rheader,
const ARLIndexHeader& iheader)
{
bool result = false;
// Calculate and save record size
p->recordSize =
(rheader.nx * rheader.ny) + ARLDataStream::PImpl::indexHeaderLength;
(iheader.nx * iheader.ny) + ARLDataStream::PImpl::recordHeaderLength;
radix_line(" Write record header: model = " << rheader.model_id);
radix_line(" nx = " << rheader.nx);
radix_line(" ny = " << rheader.ny);
radix_line(" nz = " << rheader.nz);
radix_line(" Write record header: model = " << iheader.model_id);
radix_line(" nx = " << iheader.nx);
radix_line(" ny = " << iheader.ny);
radix_line(" nz = " << iheader.nz);
radix_line(" Size of each record = " << p->recordSize);
char recordHeader[108];
sprintf(recordHeader,
char indexHeader[108];
sprintf(indexHeader,
"%4s%3d%2d%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7."
"2f%3d%3d%3d%2d%4d",
rheader.model_id.c_str(), rheader.icx, rheader.mn, rheader.pole_lat,
rheader.pole_lon, rheader.ref_lat, rheader.ref_lon, rheader.size,
rheader.orient, rheader.tang_lat, rheader.sync_xp, rheader.sync_yp,
rheader.sync_lat, rheader.sync_lon, rheader.dummy, rheader.nx,
rheader.ny, rheader.nz, rheader.z_flag, rheader.lenh);
iheader.model_id.c_str(), iheader.icx, iheader.mn, iheader.pole_lat,
iheader.pole_lon, iheader.ref_lat, iheader.ref_lon, iheader.size,
iheader.orient, iheader.tang_lat, iheader.sync_xp, iheader.sync_yp,
iheader.sync_lat, iheader.sync_lon, iheader.dummy, iheader.nx,
iheader.ny, iheader.nz, iheader.z_flag, iheader.lenh);
p->stream->writeString(std::string(recordHeader), 108);
p->stream->writeString(std::string(indexHeader), 108);
// Skip enough bytes to get to the next index header
int bytesToSkip = roundUpInt(p->stream->bytesWritten(), p->recordSize) -
......@@ -206,33 +207,33 @@ bool ARLDataStream::write_record_header(const ARLIndexHeader& iheader,
p->stream->writeString("", bytesToSkip);
radix_line(" header as string:\n " << recordHeader);
radix_line(" header as string:\n " << indexHeader);
result = true;
return result;
}
bool ARLDataStream::read_record(const ARLIndexHeader& iheader,
const ARLRecordHeader& rheader,
bool ARLDataStream::read_record(const ARLRecordHeader& rheader,
const ARLIndexHeader& iheader,
std::vector<std::vector<float> >& record)
{
bool result = false;
// Set up the vector size
record.clear();
record.resize(rheader.nx);
record.resize(iheader.nx);
for (std::vector<float>& vec : record)
{
vec.resize(rheader.ny);
vec.resize(iheader.ny);
}
// Calculate the scaling factor
float scaleFactor = pow(2.0, 7.0 - (float)iheader.nexp), lastValue = 0.0;
float scaleFactor = pow(2.0, 7.0 - (float)rheader.nexp), lastValue = 0.0;
radix_line(" Reading record data:");
for (int y = 0; y < rheader.ny; ++y)
for (int y = 0; y < iheader.ny; ++y)
{
for (int x = 0; x < rheader.nx; ++x)
for (int x = 0; x < iheader.nx; ++x)
{
// Read the raw value
unsigned char ch = (unsigned char)p->stream->readChar();
......@@ -245,7 +246,7 @@ bool ARLDataStream::read_record(const ARLIndexHeader& iheader,
{
if (y == 0)
{
lastValue = iheader.var1;
lastValue = rheader.var1;
}
else
{
......@@ -257,7 +258,7 @@ bool ARLDataStream::read_record(const ARLIndexHeader& iheader,
record[x][y] = unpackedValue;
lastValue = unpackedValue;
if ((x < 2 && y < 2) || ((rheader.nx - x < 3) && (rheader.ny - y < 3)))
if ((x < 2 && y < 2) || ((iheader.nx - x < 3) && (iheader.ny - y < 3)))
{
radix_line(" [" << x << "," << y << "]: packed = " << packedValue
<< ", unpacked = " << unpackedValue);
......@@ -269,8 +270,8 @@ bool ARLDataStream::read_record(const ARLIndexHeader& iheader,
return result;
}
bool ARLDataStream::write_record(const ARLIndexHeader& iheader,
const ARLRecordHeader& rheader,
bool ARLDataStream::write_record(const ARLRecordHeader& rheader,
const ARLIndexHeader& iheader,
const std::vector<std::vector<float> >& record)
{
bool result = false;
......@@ -282,19 +283,19 @@ bool ARLDataStream::write_record(const ARLIndexHeader& iheader,
}
// Calculate the scaling factor
float scaleFactor = pow(2.0, 7.0 - (float)iheader.nexp), lastValue = 0.0;
float scaleFactor = pow(2.0, 7.0 - (float)rheader.nexp), lastValue = 0.0;
radix_line(" Writing record data:");
for (int y = 0; y < rheader.ny; ++y)
for (int y = 0; y < iheader.ny; ++y)
{
for (int x = 0; x < rheader.nx; ++x)
for (int x = 0; x < iheader.nx; ++x)
{
// Get the correct 'last value' if we are at a 0 index
if (x == 0)
{
if (y == 0)
{
lastValue = iheader.var1;
lastValue = rheader.var1;
}
else
{
......@@ -312,7 +313,7 @@ bool ARLDataStream::write_record(const ARLIndexHeader& iheader,
lastValue = unpackedValue;
if ((x < 2 && y < 2) || ((rheader.nx - x < 3) && (rheader.ny - y < 3)))
if ((x < 2 && y < 2) || ((iheader.nx - x < 3) && (iheader.ny - y < 3)))
{
radix_line(" [" << x << "," << y << "]: packed = " << packedInt
<< ", unpacked = " << unpackedValue);
......
......@@ -31,7 +31,7 @@ class RADIX_PUBLIC ARLDataStream
* @param val String for expansion
* @param index ARLIndexHeader
*/
static void expand(const std::string& val, ARLIndexHeader& index);
static void expand(const std::string& val, ARLRecordHeader& rheader);
/**
* @brief expand Expands string of 108 characters to ARLHeader
......@@ -40,8 +40,8 @@ class RADIX_PUBLIC ARLDataStream
* beyond 3 digits
* @param header ARLHeader
*/
static void expand(const std::string& val, const ARLIndexHeader& index,
ARLRecordHeader& header);
static void expand(const std::string& val, const ARLRecordHeader& rheader,
ARLIndexHeader& iheader);
public:
ARLDataStream() = delete;
......@@ -52,20 +52,20 @@ class RADIX_PUBLIC ARLDataStream
* @param iheader ARLIndexHeader&
* @return
*/
bool read_index_header(ARLIndexHeader& iheader);
bool read_record_header(ARLRecordHeader& rheader);
bool write_index_header(const ARLIndexHeader& iheader);
bool write_record_header(const ARLRecordHeader& rheader);
/**
* @brief read_next_index_header Sets the stream position to that of the next
* index header and reads that header
* @return
*/
bool read_next_index_header(ARLIndexHeader& iheader);
bool read_next_record_header(ARLRecordHeader& rheader);
bool read_record_header(const ARLIndexHeader& iheader,
ARLRecordHeader& rheader);
bool write_record_header(const ARLIndexHeader& iheader,
const ARLRecordHeader& rheader);
bool read_index_header(const ARLRecordHeader& rheader,
ARLIndexHeader& iheader);
bool write_index_header(const ARLRecordHeader& rheader,
const ARLIndexHeader& iheader);
/**
* @brief read_record Reads a single record from the stream
......@@ -73,20 +73,20 @@ class RADIX_PUBLIC ARLDataStream
*
* @return bool on if inventory was populated
*/
bool read_record(const ARLIndexHeader& iheader,
const ARLRecordHeader& rheader,
bool read_record(const ARLRecordHeader& rheader,
const ARLIndexHeader& iheader,
std::vector<std::vector<float> >& record);
// TODO
bool write_record(const ARLIndexHeader& iheader,
const ARLRecordHeader& rheader,
bool write_record(const ARLRecordHeader& rheader,
const ARLIndexHeader& iheader,
const std::vector<std::vector<float> >& record);
void close_stream();
}; // class ARLDataStream
struct RADIX_PUBLIC ARLRecordHeader
struct RADIX_PUBLIC ARLIndexHeader
{
public:
bool prime;
......@@ -115,7 +115,7 @@ struct RADIX_PUBLIC ARLRecordHeader
std::string model_id;
}; // ARLHeader
struct RADIX_PUBLIC ARLIndexHeader
struct RADIX_PUBLIC ARLRecordHeader
{
public:
int year;
......
......@@ -14,43 +14,43 @@ TEST(RadixIO, ReadArlElements)
std::string testFile = "RP195111.gbl";
ARLDataStream testStream(testFile, std::ios::in);
// Read the initial index header
ARLIndexHeader testTopIndexHeader;
bool success = testStream.read_index_header(testTopIndexHeader);
// Read the initial record header
ARLRecordHeader testTopRecordHeader;
bool success = testStream.read_record_header(testTopRecordHeader);
ASSERT_TRUE(success);
// Test the content
EXPECT_EQ(51, testTopIndexHeader.year);
EXPECT_EQ(11, testTopIndexHeader.month);
EXPECT_EQ(1, testTopIndexHeader.day);
EXPECT_EQ(0, testTopIndexHeader.hour);
EXPECT_STREQ("INDX", testTopIndexHeader.kvar.c_str());
EXPECT_EQ(51, testTopRecordHeader.year);
EXPECT_EQ(11, testTopRecordHeader.month);
EXPECT_EQ(1, testTopRecordHeader.day);
EXPECT_EQ(0, testTopRecordHeader.hour);
EXPECT_STREQ("INDX", testTopRecordHeader.kvar.c_str());
ARLRecordHeader testRecordHeader;
success = testStream.read_record_header(testTopIndexHeader, testRecordHeader);
ARLIndexHeader testIndexHeader;
success = testStream.read_index_header(testTopRecordHeader, testIndexHeader);
ASSERT_TRUE(success);
// Test the content
EXPECT_EQ(144, testRecordHeader.nx);
EXPECT_EQ(73, testRecordHeader.ny);
EXPECT_EQ(18, testRecordHeader.nz);
EXPECT_EQ(144, testIndexHeader.nx);
EXPECT_EQ(73, testIndexHeader.ny);
EXPECT_EQ(18, testIndexHeader.nz);
// Read the data starting from the next index header
ARLIndexHeader testIndexHeader;
success = testStream.read_next_index_header(testIndexHeader);
// Read the data starting from the next record header
ARLRecordHeader testRecordHeader;
success = testStream.read_next_record_header(testRecordHeader);
ASSERT_TRUE(success);
// Test the content
EXPECT_EQ(51, testIndexHeader.year);
EXPECT_EQ(11, testIndexHeader.month);
EXPECT_EQ(1, testIndexHeader.day);
EXPECT_EQ(0, testIndexHeader.hour);
EXPECT_STREQ("PRSS", testIndexHeader.kvar.c_str());
EXPECT_EQ(51, testRecordHeader.year);
EXPECT_EQ(11, testRecordHeader.month);
EXPECT_EQ(1, testRecordHeader.day);
EXPECT_EQ(0, testRecordHeader.hour);
EXPECT_STREQ("PRSS", testRecordHeader.kvar.c_str());
// Read data
std::vector<std::vector<float>> testRecord;
success =
testStream.read_record(testIndexHeader, testRecordHeader, testRecord);
testStream.read_record(testRecordHeader, testIndexHeader, testRecord);
// Test content
ASSERT_TRUE(success);
ASSERT_EQ(testRecordHeader.nx, testRecord.size());
ASSERT_EQ(testRecordHeader.ny, testRecord[0].size());
ASSERT_EQ(testIndexHeader.nx, testRecord.size());
ASSERT_EQ(testIndexHeader.ny, testRecord[0].size());
EXPECT_NEAR(665.9, testRecord[0][0], 665.9 * tolerance);
EXPECT_NEAR(665.9, testRecord[1][0], 665.9 * tolerance);
EXPECT_NEAR(677.9, testRecord[0][1], 677.9 * tolerance);
......@@ -61,21 +61,21 @@ TEST(RadixIO, ReadArlElements)
EXPECT_NEAR(1015.9, testRecord[143][72], 1015.9 * tolerance);
// Try another one
success = testStream.read_next_index_header(testIndexHeader);
success = testStream.read_next_record_header(testRecordHeader);
ASSERT_TRUE(success);
// Test the content
EXPECT_EQ(51, testIndexHeader.year);
EXPECT_EQ(11, testIndexHeader.month);
EXPECT_EQ(1, testIndexHeader.day);
EXPECT_EQ(0, testIndexHeader.hour);
EXPECT_STREQ("T02M", testIndexHeader.kvar.c_str());
EXPECT_EQ(51, testRecordHeader.year);
EXPECT_EQ(11, testRecordHeader.month);
EXPECT_EQ(1, testRecordHeader.day);
EXPECT_EQ(0, testRecordHeader.hour);
EXPECT_STREQ("T02M", testRecordHeader.kvar.c_str());
// Read data
success =
testStream.read_record(testIndexHeader, testRecordHeader, testRecord);
testStream.read_record(testRecordHeader, testIndexHeader, testRecord);
// Test content
ASSERT_TRUE(success);
ASSERT_EQ(testRecordHeader.nx, testRecord.size());
ASSERT_EQ(testRecordHeader.ny, testRecord[0].size());
ASSERT_EQ(testIndexHeader.nx, testRecord.size());
ASSERT_EQ(testIndexHeader.ny, testRecord[0].size());
EXPECT_NEAR(233.4, testRecord[0][0], 233.4 * tolerance);
EXPECT_NEAR(233.4, testRecord[1][0], 233.4 * tolerance);
EXPECT_NEAR(227.1, testRecord[0][1], 227.1 * tolerance);
......@@ -95,52 +95,52 @@ TEST(RadixIO, WriteArlElements)
std::string testReadFile = "RP195111.gbl";
ARLDataStream setupStream(testReadFile, std::ios::in);
// Read the initial data
ARLIndexHeader setupTopIndexHeader;
bool success = setupStream.read_index_header(setupTopIndexHeader);
ARLRecordHeader setupTopRecordHeader;
bool success = setupStream.read_record_header(setupTopRecordHeader);
ASSERT_TRUE(success);
ARLRecordHeader setupRecordHeader;
ARLIndexHeader setupIndexHeader;
success =
setupStream.read_record_header(setupTopIndexHeader, setupRecordHeader);
setupStream.read_index_header(setupTopRecordHeader, setupIndexHeader);
ASSERT_TRUE(success);
ARLIndexHeader setupIndexHeader;
success = setupStream.read_next_index_header(setupIndexHeader);
ARLRecordHeader setupRecordHeader;
success = setupStream.read_next_record_header(setupRecordHeader);
ASSERT_TRUE