Type: | Package |
Title: | Cs-137 Conversion Model |
Version: | 1.0.8 |
Date: | 2025-05-09 |
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. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Depends: | R (≥ 4.3.0) |
Imports: | Rcpp (≥ 1.0.11), dplyr (≥ 1.1.4), roxygen2 (≥ 7.2.3), usethis (≥ 2.2.2), jsonlite (≥ 1.8.7), data.table (≥ 1.14.8), devtools (≥ 2.4.5), ggplot2 (≥ 3.4.4), patchwork (≥ 1.1.3), utils (≥ 4.3.1), stats (≥ 4.3.1) |
LinkingTo: | Rcpp |
Encoding: | UTF-8 |
NeedsCompilation: | yes |
Packaged: | 2025-05-09 19:23:20 UTC; artur |
RoxygenNote: | 7.3.2 |
Author: | 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 <radero@eead.csic.es> |
Repository: | CRAN |
Date/Publication: | 2025-05-09 19:40:02 UTC |
RadEro: Physically Based Compartmental Model for 137Cs Analysis and Soil Redistribution Rates Estimation
Description
RadEro is a straightforward model to estimate soil migration rates across various soil contexts. Building on the compartmental, vertically-resolved, physically-based mass balance model of Soto and Navas (2004, 2008), RadEro is accessible as a user-friendly R package. Input data, including 137Cs inventories and parameters directly derived from soil samples (e.g., fine fraction density, effective volume), accurately capture 137Cs distribution within the soil profile. The model simulates annual 137Cs fallout, radioactive decay, and vertical diffusion, using a diffusion coefficient derived from 137Cs reference inventory profiles. RadEro also accommodates user-defined parameters as calibration coefficients. The package, code, and test data are openly accessible for widespread use.
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 /kg1) 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.
Author(s)
See Also
Examples
# Step 1: RadEro requires a specific structure for data and configuration files.
# The "RadEro_examples" function creates sample files (.csv and .js)
# in the specified output directory.
RadEro_example()
# These files can be used as templates for user projects.
# Step 2: Run the model with the example files and define the output directory.
RadEro_run(data = "input-data_example.csv",
config = "input-config_example.js")
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 templates files for a reference site and two template files for study sires in the specified directory: each set has one file 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.
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.
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."