File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1127,11 +1127,13 @@ def grib_clone(msgid_src, headers_only=False):
1127
1127
1128
1128
Create a copy of a given message (\em msgid_src) resulting in a new
1129
1129
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
1130
1132
1131
1133
\b Examples: \ref grib_clone.py "grib_clone.py"
1132
1134
1133
1135
@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
1135
1137
@return id of clone
1136
1138
@exception CodesInternalError
1137
1139
"""
Original file line number Diff line number Diff line change @@ -356,6 +356,9 @@ def test_grib_clone_headers_only():
356
356
with open (TEST_GRIB_ERA5_DATA , "rb" ) as f :
357
357
msgid1 = eccodes .codes_grib_new_from_file (f )
358
358
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
359
362
assert eccodes .codes_get (msgid1 , "totalLength" ) == 14752
360
363
assert eccodes .codes_get (msgid2 , "totalLength" ) == 112
361
364
assert eccodes .codes_get (msgid1 , "bitsPerValue" ) == 16
You can’t perform that action at this time.
0 commit comments