| seasonder_readSeaSondeCSFileBlock | R Documentation |
Reads a block of fields from a binary file based on provided specifications. Each field is read and then processed with a specified quality control function.
seasonder_readSeaSondeCSFileBlock(spec, connection, endian = "big")
spec |
A named list of specifications for fields to read. Each specification should be in the form: list(type = "data_type", qc_fun = "qc_function_name", qc_params = list(param1 = value1, ...)) Where:
|
connection |
A connection to the binary file. |
endian |
A character string indicating the byte order. Options are "big" and "little" (default is "big"). |
The quality control (QC) functions (qc_fun) specified within spec play a pivotal role in ensuring the
reliability of the data that's read. Here's the expected behavior of these QC functions:
Input:
field_value: Value of the field that has been read from the binary file using the seasonder_readCSField function.
...: Additional parameters specified in qc_params that are passed to qc_fun for quality control.
Functioning: The QC function receives a read value and performs checks or transformations based on defined rules or parameters.
On QC failure:
The QC function itself is responsible for determining the action to take. It can log an error, return a default value, impute the value, and more.
For critical errors, the QC function could halt the execution. However, note that logging is managed by the QC function and won't necessarily halt execution in every case.
On success: The QC function will return the value (either unchanged or transformed).
Output: Value that has been validated or transformed based on quality control rules.
Additional Notes:
The action on QC failure is directly implemented within the QC function.
Reading errors are managed by the seasonder_readCSField function, which returns NULL in the case of an error. It
is up to the QC function to decide what to do if it receives a NULL.
A named list where each entry corresponds to a field that has been read. Each key is the field name, and its associated value is the data for that field after quality control.
read_and_qc_field
spec <- list(field1 = list(type = "UInt8", qc_fun = "qc_check_unsigned", qc_params = list()))
con <- rawConnection(as.raw(c(0x01)))
block <- seasonder_readSeaSondeCSFileBlock(spec, con, endian = "big")
print(block)
close(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.