https://github.com/obrl-soil/em38
decode n38 binary logfiles in R
https://github.com/obrl-soil/em38
data-logger decode em38 gps r
Last synced: 4 months ago
JSON representation
decode n38 binary logfiles in R
- Host: GitHub
- URL: https://github.com/obrl-soil/em38
- Owner: obrl-soil
- License: other
- Created: 2018-05-09T13:06:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-09-24T10:26:06.000Z (over 2 years ago)
- Last Synced: 2025-04-07T16:51:44.619Z (9 months ago)
- Topics: data-logger, decode, em38, gps, r
- Language: R
- Homepage: https://obrl-soil.github.io/em38/
- Size: 4.1 MB
- Stars: 4
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output:
md_document:
variant: gfm
---
[](https://github.com/obrl-soil/em38/actions)
[](https://github.com/obrl-soil/em38/actions)
[](https://github.com/obrl-soil/em38/actions)
[](https://codecov.io/github/obrl-soil/em38?branch=master)
[](https://opensource.org/licenses/MIT)
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# em38
em38 translates \*.n38 binary files generated by the [Geonics EM38-MKII ground conductivity meter](http://geonics.com/html/em38.html), commonly used in soil research and precision agriculture. EM38-MKII devices are supported by an official translation app called DAT38MK2, but this lacks a command-line interface and is not easy to use in a reproducible workflow.
## Installation
Install from github with
```{r 'installation', eval = FALSE}
library(devtools)
install_github("obrl-soil/em38")
```
This package is in early development phase. Improving its reliability requires access to a wide variety of test datasets, so if you have an \*.n38 file that fails to decode correctly, please consider sending it to me. I have been able to test decoding on around 50 sample files from two different EM38-MKII devices, but could always use more. The device and its logger have a large number of possible setting combinations, and I have not seen all of them. Additionally, a third-party GPS needs to be attached to the device and its data-logger, and GPS output data are notoriously variable by brand and model.
## Usage
em38 is accompanied by a demo dataset gathered during a training exercise:
```{r 'example', message=FALSE, results = 'hold'}
library(em38)
# all-in-one wrapper function:
demo_survey <- em38_from_file(path = system.file("extdata", "em38_demo.n38",
package = "em38"),
hdop_filter = 3)
# Plot spatialised output of survey line 1 (calibrated conductivity for coil
# separation 0.5m)
sl1 <- demo_survey$survey_lines[[1]]
plot(sl1[sl1$mode == 'Vertical', 'cond_05'], pch = 20,
main = 'Conductivity, Vertical Dipole Mode, Coil Separation 0.5m')
```
Its surprisingly difficult to walk in a straight line across a paddock :no_mouth:
If you want to look at the intermediate data more closely,
```{r 'longwayround'}
# import binary file as raw() type matrix
n38_mat <- n38_import(system.file("extdata", "em38_demo.n38", package = "em38"))
# break matrix into sections according to file spec
n38_chunks <- n38_chunk(n38_mat)
# decode matrix chunks into useable data
n38_decoded <- n38_decode(n38_chunks)
```
You can also create the equivalent of an \*.M38 text file, for comparison.
```{r ytho, eval = FALSE}
m38_example <- n38_to_m38(n38_decoded)
# write to file as e.g.
# write(m38_example, paste0('m38_from_R_', Sys.Date(), '.m38'))
```
***