Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
5a8c55dd
Commit
5a8c55dd
authored
Oct 23, 2018
by
Purves, Murray
Browse files
WIP testing next section
parent
5dc70502
Pipeline
#16597
failed with stages
in 16 minutes and 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixio/arldatastream.cc
View file @
5a8c55dd
...
...
@@ -106,6 +106,7 @@ bool ARLDataStream::read_next_index_header(ARLIndexHeader& iheader)
{
int
bytesToSkip
=
roundUpInt
(
p
->
stream
->
bytesRead
(),
p
->
recordSize
)
-
p
->
stream
->
bytesRead
();
radix_line
(
"Skipping "
<<
bytesToSkip
<<
" bytes to the next index header"
);
p
->
stream
->
skipBytes
(
bytesToSkip
);
...
...
@@ -135,6 +136,7 @@ bool ARLDataStream::read_record(const ARLIndexHeader& iheader,
std
::
vector
<
std
::
vector
<
double
>
>&
record
)
{
// Set up the vector size
record
.
clear
();
record
.
resize
(
rheader
.
nx
);
for
(
std
::
vector
<
double
>&
vec
:
record
)
{
...
...
radixio/tests/tstArlDataStream.cc
View file @
5a8c55dd
...
...
@@ -6,8 +6,10 @@
using
namespace
radix
;
TEST
(
RadixIO
,
ReadArl
Stream
)
TEST
(
RadixIO
,
ReadArl
Elements
)
{
double
tolerance
=
0.001
;
std
::
string
testFile
=
"/home/ohp/data/met/RP195111.gbl"
;
ARLDataStream
testStream
(
testFile
);
...
...
@@ -44,4 +46,46 @@ TEST(RadixIO, ReadArlStream)
std
::
vector
<
std
::
vector
<
double
>>
testRecord
;
success
=
testStream
.
read_record
(
testIndexHeader
,
testRecordHeader
,
testRecord
);
// Test content
ASSERT_TRUE
(
success
);
ASSERT_EQ
(
testRecordHeader
.
nx
,
testRecord
.
size
());
ASSERT_EQ
(
testRecordHeader
.
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
);
EXPECT_NEAR
(
677.9
,
testRecord
[
1
][
1
],
677.9
*
tolerance
);
EXPECT_NEAR
(
1013.9
,
testRecord
[
142
][
71
],
1013.9
*
tolerance
);
EXPECT_NEAR
(
1011.9
,
testRecord
[
143
][
71
],
1011.9
*
tolerance
);
EXPECT_NEAR
(
1015.9
,
testRecord
[
142
][
72
],
1015.9
*
tolerance
);
EXPECT_NEAR
(
1015.9
,
testRecord
[
143
][
72
],
1015.9
*
tolerance
);
// Try another one
success
=
testStream
.
read_next_index_header
(
testIndexHeader
);
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
());
// Read data
success
=
testStream
.
read_record
(
testIndexHeader
,
testRecordHeader
,
testRecord
);
// Test content
ASSERT_TRUE
(
success
);
ASSERT_EQ
(
testRecordHeader
.
nx
,
testRecord
.
size
());
ASSERT_EQ
(
testRecordHeader
.
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
);
EXPECT_NEAR
(
227.1
,
testRecord
[
1
][
1
],
227.1
*
tolerance
);
EXPECT_NEAR
(
236.0
,
testRecord
[
142
][
71
],
236.0
*
tolerance
);
EXPECT_NEAR
(
236.1
,
testRecord
[
143
][
71
],
236.1
*
tolerance
);
EXPECT_NEAR
(
240.6
,
testRecord
[
142
][
72
],
240.6
*
tolerance
);
EXPECT_NEAR
(
240.6
,
testRecord
[
143
][
72
],
240.6
*
tolerance
);
}
// TEST(RadixIO, ReadArlWholeFile)
//{
//}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment