Skip to content

Commit 0a02d7d

Browse files
committed
ECC-1742: Tests
1 parent 8ca9411 commit 0a02d7d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

gribapi/gribapi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,11 +1127,13 @@ def grib_clone(msgid_src, headers_only=False):
11271127
11281128
Create a copy of a given message (\em msgid_src) resulting in a new
11291129
message in memory (\em msgid_dest) identical to the original one.
1130+
If the headers_only option is enabled, the clone will not contain
1131+
the Bitmap and Data sections
11301132
11311133
\b Examples: \ref grib_clone.py "grib_clone.py"
11321134
11331135
@param msgid_src id of message to be cloned
1134-
@param headers_only whether or not to load the message with the headers only
1136+
@param headers_only whether or not to clone the message with the headers only
11351137
@return id of clone
11361138
@exception CodesInternalError
11371139
"""

tests/test_eccodes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ def test_grib_clone_headers_only():
356356
with open(TEST_GRIB_ERA5_DATA, "rb") as f:
357357
msgid1 = eccodes.codes_grib_new_from_file(f)
358358
msgid2 = eccodes.codes_clone(msgid1, headers_only=True)
359+
msg1_size = eccodes.codes_get_message_size(msgid1)
360+
msg2_size = eccodes.codes_get_message_size(msgid2)
361+
assert msg1_size > msg2_size
359362
assert eccodes.codes_get(msgid1, "totalLength") == 14752
360363
assert eccodes.codes_get(msgid2, "totalLength") == 112
361364
assert eccodes.codes_get(msgid1, "bitsPerValue") == 16

0 commit comments

Comments
 (0)