Package 'RadEro'

Title: Cs-137 Conversion Model
Description: A straightforward model to estimate soil migration rates across various soil contexts. Based on the compartmental, vertically-resolved, physically-based mass balance model of Soto and Navas (2004) <doi:10.1016/j.jaridenv.2004.02.003> and Soto and Navas (2008) <doi:10.1016/j.radmeas.2008.02.024>. 'RadEro' provides a user-friendly interface in R, utilizing input data such as 137Cs inventories and parameters directly derived from soil samples (e.g., fine fraction density, effective volume) to accurately capture the 137Cs distribution within the soil profile. The model simulates annual 137Cs fallout, radioactive decay, and vertical diffusion, with the diffusion coefficient calculated from 137Cs reference inventory profiles. Additionally, it allows users to input custom parameters as calibration coefficients. The RadEro user manual and protocol, including detailed instructions on how to format input data and configuration files, can be found at the following link: <https://github.com/eead-csic-eesa/RadEro>.
Authors: Arturo Catala [aut, cre], Borja Latorre [aut, ctb, cph], Leticia Gaspar [aut], Ana Navas [aut], Dave Gamble [ctb] (Author of the cJSON.h library)
Maintainer: Arturo Catala <[email protected]>
License: GPL (>= 2)
Version: 1.0.5
Built: 2024-12-19 06:27:11 UTC
Source: CRAN

Help Index


Plot of experimental and simulated profile inventories

Description

The "plot" function generates two plots for each profile defined in the input data: one representing the experimental inventory and the other representing the simulated inventory. This function is automatically executed when you run RadEro_run. It creates a "results" folder in the current directory if it does not already exist.

Arguments

data1

Character. Read input data in CSV format.

data2

Filtered values of data1 for the current 'id'.

dir1

directory. Temporary working directory where the '_num.txt' and '_exp.txt' files were created.

dir2

directory. Current working directory.

AxisMaxValue

daximum value to determine the x axis limit. Only used if the user wants to escalate all the simulated profiles .

cell_value

Unit cell size in meters.

Value

A "results" folder in "dir2" containing "n" plots saved as PNG files, where "n" corresponds to the number of "id" entries defined in "data2". Additionally, a summary TXT file is saved in the results folder.


Copy Example Files from Package Data Directory to a Specified Directory

Description

This function copies example files (e.g., .js and .csv) from the "data" directory of the package to a specified working directory.

Usage

RadEro_example(target_dir = NULL, overwrite = TRUE)

Arguments

target_dir

The path to the directory where the files will be copied.

overwrite

Logical. Whether to overwrite the files if they already exist in the target directory (default is TRUE).

Details

The function uses "system.file()" to locate the example files within the package's "data" directory and copies them to a directory of your choice using "file.copy()".

Value

This function generates two template files in the specified directory: one for data input and another for configuration input. These templates serve as examples, demonstrating how to construct and format the input files.


Starts conversion model for soil redistribution

Description

Initiates the model based on the Cs137 inventory data from soil profiles according to the specified configuration in the working directory.

Usage

RadEro_run(data, config, AxisMaxValue = NULL, output_dir = NULL)

Arguments

data

A data frame containing the Cs137 inventory data from soil profiles. It must be located in the working directory.

config

A list or configuration file that defines the parameters for the model run. It must be located in the working directory.

AxisMaxValue

Optional. A numeric value specifying the maximum value for the axes in the plot. Defaults to NULL.

output_dir

The directory where the output files will be saved. Defaults to a temporary directory.

Value

A "results" folder containing for each analyzed profile: a) ID_plot.png: Experimental (blue) and simulated (red) inventory depth profile plots; b) ID_tempfile: Experimental inventory (Bq/kg) per cell unit in the defined profile depth; c) results.txt: Summary file with columns for ID, migration rate (e), erosion rate (m), diffusion coefficients (k and kv), total experimental inventory, and total simulated inventory; d) Additionally, a "temp" folder for advanced users is created for each profile, containing configuration and inventory files related to individual analyses.


Resample Configuration Data

Description

"resample_config" adjusts and modifies a input configuration file based on the input data. The function resamples, filters and restructures data according to the parameters passed in the configuration file. It also interacts with a directory specified by the user for output.

Usage

resample_config(data2, config1, dir1)

Arguments

data2

Input data by ID. The input data to be resampled or transformed.

config1

Input configuration. Configuration details that dictate how the data should be processed, including resampling methods, filters, and other transformation rules.

dir1

Temporal directory. Path to the folder where output config file should be saved.

Details

This function takes three arguments: a dataset ("data2"), a configuration object ("config1"), and a directory path ("dir1"). The function applies resampling methods to the data as specified by "config1". The resampled data is typically saved to the provided directory.

Value

A modified version of "config1" named "_config.js" that will be read by the C model.


Resample Input Data

Description

"resample_data" processes the data based on predefined rules before being read by the C model, and saves the output in a specified directory.

Usage

resample_data(data2, dir1)

Arguments

data2

Input data by ID. The input dataset to be resampled or transformed.

dir1

Temporal directory. Path to the folder where the resampled data will be saved.

Details

This function takes two arguments: a dataset ("data2") and the temporal directory path ("dir1").

Value

A resampled version of "data2" named "_exp.txt" saved in the directory specified by "dir1."