| Type: | Package |
| Title: | Climate Modeling with Point Data from Climate Stations |
| Version: | 1.0.0 |
| Author: | Alexander Klug [aut, cre, cph], Luise Wraase [aut], Seda Bekar [ctb], Dirk Zeuss [aut] |
| Maintainer: | Alexander Klug <kluga@students.uni-marburg.de> |
| Description: | An automated and streamlined workflow for predictive climate mapping using climate station data. Works within an environment the user provides a destined path to - otherwise it's tempdir(). Quick and relatively easy creation of resilient and reproducible climate models, predictions and climate maps, shortening the usually long and complicated work of predictive modelling. For more information, please find the provided URL. Many methods in this package are new, but the main method is based on a workflow from Meyer (2019) <doi:10.1016/j.ecolmodel.2019.108815> and Meyer (2022) <doi:10.1038/s41467-022-29838-9> , however, it was generalized and adjusted in the context of this package. |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| LazyData: | true |
| Imports: | caret, CAST, corrplot, doParallel, dplyr, grDevices, lares,magrittr, parallel, rlang, stats, stringr, terra, tidyr, utils |
| Depends: | R (≥ 2.10) |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0), pls, randomForest, sp |
| VignetteBuilder: | knitr |
| RoxygenNote: | 7.3.2 |
| Config/testthat/edition: | 3 |
| URL: | https://envima.github.io/climodr/ |
| BugReports: | https://github.com/envima/climodr/issues |
| NeedsCompilation: | no |
| Packaged: | 2025-06-10 08:11:00 UTC; Alexander |
| Repository: | CRAN |
| Date/Publication: | 2025-06-12 14:20:06 UTC |
Station File (G06)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_G06Format
## 'Station_G06'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (G17)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_G17Format
## 'Station_G17'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (G20)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_G20Format
## 'Station_G20'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (G21)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_G21Format
## 'Station_G21'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (G25)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_G25Format
## 'Station_G25'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (G48)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_G48Format
## 'Station_G48'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (W10)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_W10Format
## 'Station_W10'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (W11)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_W11Format
## 'Station_W11'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (W19)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_W19Format
## 'Station_W19'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Station File (W20)
Description
Contains made up climate data for imaginary climate stations for education purposes.
Usage
Station_W20Format
## 'Station_W20'A data frame with 10 rows and 5 columns
- plotID
Plot ID of imaginary climate station
- datetime
Timestamp of record for station
- Ta_200
Imaginary air temperature at 200 cm above ground
Source
Randomly created climate data at random created stations extracted from a random climate map made by climodr.
Autocorrelation
Description
Tests the final.csv created with 'fin.csv' on autocorrelation to producereliable models.
Usage
autocorr( envrmt = .GlobalEnv$envrmt, method = "monthly", resp, pred, plot.corrplot = TRUE, corrplot = "coef")Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
method | character. Choose the time scale your data is preserved in. Either "annual", "monthly" or "daily". |
resp | numerical. Vector or single input of the columns in the final.csv that contain your sensor data ("response variables"). The function will create one file per variable. |
pred | numerical. Vector or single input. The columns of your predictor variables, that you want to test for autocorrelation with the response variables. |
plot.corrplot | logical. Should correlation matrices be plotted? |
corrplot | character. Vector or single input. If plot.corrplot is true, you can choose the design of the correlation plot. You can choose from "coef", "crossout", "blank". Default is "coef". |
Value
One .csv file per response variable. These will later be used when 'autocorrelation' is set 'TRUE' during 'calc.model'.
See Also
'calc.model'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)#prepare csv-filesprep.csv(envrmt = envrmt, method = "proc", save_output = TRUE)#process csv-filescsv_data <- proc.csv(envrmt = envrmt, method = "monthly", rbind = TRUE, save_output = TRUE)# Crop all raster bandscrop.all(envrmt = envrmt, method = "MB_Timeseries", overwrite = TRUE)# Calculate Indices from cropped raster bandscalc.indices(envrmt = envrmt, vi = "all", bands = c("blue", "green", "red", "nir", "nirb", "re1", "re2", "re3", "swir1", "swir2"), overwrite = TRUE)#extract station coordinatescsv_spat <- spat.csv(envrmt = envrmt, method = "monthly", des_file = "plot_description.csv", save_output = TRUE)#extract predictor values from raster filescsv_fin <- fin.csv(envrmt = envrmt, method = "monthly", save_output = TRUE)# Test data for autocorrelation after running fin.csvautocorr(envrmt = envrmt, method = "monthly", resp = 5, pred = c(8:23), plot.corrplot = FALSE)Calculate spectral indices
Description
Calculates a set of spectral indices to have more predictor variables available when further modeling.
Usage
calc.indices( envrmt = .GlobalEnv$envrmt, vi = "all", bands = c("blue", "green", "red", "nir", "nirb", "re1", "re2", "re3", "swir1", "swir2"), overwrite = FALSE)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
vi | Character. Either "all" or vector containing the preferred spectral indices. See 'Details' for more information. |
bands | Character. Vector with lenght(bands) = 10. Contains the names of the bands in the Raster Stack.If bands from the *Usage* example vector dont exist, use "NA" in their position. See 'Details' for more information. |
overwrite | logical. Argument passed down from 'terra'-package. Overwrite existing files? |
Value
SpatRaster-Stack
See Also
'crop.all', 'fin.csv'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)# Crop all raster bandscrop.all(envrmt = envrmt, method = "MB_Timeseries", overwrite = TRUE)# Calculate Indices from cropped raster bandscalc.indices(envrmt = envrmt, vi = "all", bands = c("blue", "green", "red", "nir", "nirb", "re1", "re2", "re3", "swir1", "swir2"), overwrite = TRUE)Modelling
Description
Creates Models for each climate value
Usage
calc.model( envrmt = .GlobalEnv$envrmt, method = "monthly", timespan, climresp, classifier = c("rf", "pls", "lm", "glm"), seed = NULL, p = 0.8, folds = "all", predrows, mnote = NULL, k = NULL, tc_method = "cv", metric = "RMSE", doParallel = FALSE, autocorrelation = FALSE, ...)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
method | character. Time period of your desired model. Default: "monthly" |
timespan | numeric. Vector or single input. Should contain all years tobe modeled. The years have to be the same format as in thetabular data. |
climresp | numeric. Vector or single input. Should contain all column'sin the tabular data that contain response variables. |
classifier | vector or character. Model variants to be used. Supportedmodels: Random Forest = "rf", Partial-Least-Squares = "pls",Neural Networks = "nnet", Linear Regression = "lm" orgeneralized boosted regression = "gbm". |
seed | integer. Seed to reproduce the same model over and over. |
p | numeric. Between 0 and 1. Percentage of data used for crossvalidation. Default = 0.8 |
folds | character. Vector or single input. Either folding over locationonly "LLO", over time only "LTO", or over both "LLTO". Use"all" to use all possibilitys. |
predrows | numeric. Vector or single input. Should contain the rows whereall the predictor values are stored in. |
mnote | character. Model note for special modifications used.Default: "normal" |
k | integer. When 'fold' = "LLO" or "LTO". Set k to the numberof unique spatial or temporal units. Leave out to use presetvalues. |
tc_method | character. Method for train control function from caretpackage. Default = "cv". |
metric | character. See 'train'. |
doParallel | logical. Parallelization accelerates the modellingprocess. Warning: Your PC will slow down drastically. Makesure to not run any other heavy processes during this. |
autocorrelation | logical. Should autocorrelating data in the predictorvariables be excluded from the model run? Only works if'autocorr' has been executed beforehand. |
... | arguments passed down from other functions. |
Value
data frame.
See Also
'autocorr'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)#prepare csv-filesprep.csv(envrmt = envrmt, method = "proc", save_output = TRUE)#process csv-filescsv_data <- proc.csv(envrmt = envrmt, method = "monthly", rbind = TRUE, save_output = TRUE)# Crop all raster bandscrop.all(envrmt = envrmt, method = "MB_Timeseries", overwrite = TRUE)# Calculate Indices from cropped raster bandscalc.indices(envrmt = envrmt, vi = "all", bands = c("blue", "green", "red", "nir", "nirb", "re1", "re2", "re3", "swir1", "swir2"), overwrite = TRUE)#extract station coordinatescsv_spat <- spat.csv(envrmt = envrmt, method = "monthly", des_file = "plot_description.csv", save_output = TRUE)#extract predictor values from raster filescsv_fin <- fin.csv(envrmt = envrmt, method = "monthly", save_output = TRUE)# Test data for autocorrelation after running fin.csvautocorr(envrmt = envrmt, method = "monthly", resp = 5, pred = c(8:23), plot.corrplot = FALSE)# Create 36 different models (12 months x 3 classifiers) for every month in 2017calc.model(envrmt = envrmt, method = "monthly", timespan = c(2017), climresp = 5, classifier = c("rf", "pls", "lm"), seed = 707, p = 0.8, folds = "LLO", mnote = "normal", predrows = c(8:23), tc_method = "cv", metric = "RMSE", autocorrelation = TRUE, doParallel = FALSE)Load in Example Data
Description
Climodr comes with a full set of example data. But since this package runs primarily with data,that is not linked to the global environment, but saved in local folders build via 'envi.create',one can't just load example data. This function will load all the example data used in the vignetteinto your climodr environment. This way you can run all the code from the vignette.
Usage
clim.sample(envrmt = .GlobalEnv$envrmt)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
Value
Multiple files used by the climodr vignette
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)Create Maps using the 'terra' package graphic parameters
Description
Plot results of climodr into maps. Right now maps are created using the terra package.The maps created are very basic. Will be updated to run with tidyterra in future.
Usage
climplot( envrmt = .GlobalEnv$envrmt, mnote, sensor, aoa = FALSE, mapcolors = rev(grDevices::terrain.colors(50)), scale_position = "bottomleft", north_position = "topright")Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
mnote | character. The modelnote you want to create maps of. |
sensor | character. The sensor you want to create maps for. |
aoa | logical. Do you want the area of applicability to be added to your map? |
mapcolors | The color pallete you want to use for the map. Default is 'rev(grDevices::terrain.colors(50))' |
scale_position | character. Graphical parameter. The relative positiion of the Scale for the map. See 'terra::plot' for more details. |
north_position | character. Graphical parameter. The relative positiion of the Scale for the map. See 'terra::plot' for more details. |
Value
Maps in PNG-Format to your harddrive.
See Also
'terra::plot'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)#prepare csv-filesprep.csv(envrmt = envrmt, method = "proc", save_output = TRUE)#process csv-filescsv_data <- proc.csv(envrmt = envrmt, method = "monthly", rbind = TRUE, save_output = TRUE)# Crop all raster bandscrop.all(envrmt = envrmt, method = "MB_Timeseries", overwrite = TRUE)# Calculate Indices from cropped raster bandscalc.indices(envrmt = envrmt, vi = "all", bands = c("blue", "green", "red", "nir", "nirb", "re1", "re2", "re3", "swir1", "swir2"), overwrite = TRUE)#extract station coordinatescsv_spat <- spat.csv(envrmt = envrmt, method = "monthly", des_file = "plot_description.csv", save_output = TRUE)#extract predictor values from raster filescsv_fin <- fin.csv(envrmt = envrmt, method = "monthly", save_output = TRUE)# Test data for autocorrelation after running fin.csvautocorr(envrmt = envrmt, method = "monthly", resp = 5, pred = c(8:23), plot.corrplot = FALSE)# Create 36 different models (12 months x 3 classifiers) for every month in 2017calc.model(envrmt = envrmt, method = "monthly", timespan = c(2017), climresp = 5, classifier = c("rf", "pls", "lm"), seed = 707, p = 0.8, folds = "LLO", mnote = "normal", predrows = c(8:23), tc_method = "cv", metric = "RMSE", autocorrelation = TRUE, doParallel = FALSE)# Make predictionsclimpred(envrmt = envrmt, method = "monthly", mnote = "normal", AOA = TRUE)# Create a Temperature Map from the vignette modelclimplot(envrmt = envrmt, mnote = "normal", sensor = "Ta_200", aoa = TRUE, mapcolors = rev(heat.colors(50)), scale_position = "bottomleft", north_position = "topright")Predict sensor data area wide
Description
Use the models created using 'calc.model' to predict the modeled data onto afull spatial raster scene.
Usage
climpred(envrmt = .GlobalEnv$envrmt, method = "monthly", mnote, AOA = TRUE)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
method | Character. Either "daily", monthly" or "annual". Also depends on the available data. |
mnote | Character. Model note to filter models for the fitting model run. |
AOA | Logical. Should the Area of Applicability be calculated additional to the models? |
Value
Multiple models.rds stored in the /workflow/models folder.
See Also
'autocorr', 'predict'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)#prepare csv-filesprep.csv(envrmt = envrmt, method = "proc", save_output = TRUE)#process csv-filescsv_data <- proc.csv(envrmt = envrmt, method = "monthly", rbind = TRUE, save_output = TRUE)# Crop all raster bandscrop.all(envrmt = envrmt, method = "MB_Timeseries", overwrite = TRUE)# Calculate Indices from cropped raster bandscalc.indices(envrmt = envrmt, vi = "all", bands = c("blue", "green", "red", "nir", "nirb", "re1", "re2", "re3", "swir1", "swir2"), overwrite = TRUE)#extract station coordinatescsv_spat <- spat.csv(envrmt = envrmt, method = "monthly", des_file = "plot_description.csv", save_output = TRUE)#extract predictor values from raster filescsv_fin <- fin.csv(envrmt = envrmt, method = "monthly", save_output = TRUE)# Test data for autocorrelation after running fin.csvautocorr(envrmt = envrmt, method = "monthly", resp = 5, pred = c(8:23), plot.corrplot = FALSE)# Create 36 different models (12 months x 3 classifiers) for every month in 2017calc.model(envrmt = envrmt, method = "monthly", timespan = c(2017), climresp = 5, classifier = c("rf", "pls", "lm"), seed = 707, p = 0.8, folds = "LLO", mnote = "normal", predrows = c(8:23), tc_method = "cv", metric = "RMSE", autocorrelation = TRUE, doParallel = FALSE)# Make predictionsclimpred(envrmt = envrmt, method = "monthly", mnote = "normal", AOA = TRUE)predlist <- list.files(envrmt$path_predictions, pattern = ".tif")head(predlist)Cropping tiff data
Description
Crops input data to the extent size and reprojects them into project Coordinate reference system.
Usage
crop.all( envrmt = .GlobalEnv$envrmt, method = "MB_Timeseries", crs = NULL, ext = NULL, overwrite = FALSE, ...)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
method | character. Use "MB_Timeseries" for now. More methods are planned and will be added in future. |
crs | Coordinate reference system Used to crop all images in folder_path. If crsit will automatically reprojected into this one. Default: crs of smallest Extent. |
ext | SpatRaster, SpatVector or SpatExtent. Extent all data is cropped into. Default: Smallest Extent in folder_path. |
overwrite | logical. Should existing files with the same filename beoverwritten? Default = FALSE |
... | arguments passed down from other functions. |
Value
SpatRaster-Stack. Also saved to /workflow/rworkflow
See Also
'fin.csv', 'calc.indices'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)# Crop all raster bandscrop.all(envrmt = envrmt, method = "MB_Timeseries", overwrite = TRUE)Create climodr environment
Description
Creates an environment climodr will use during the calculation process. A list is returned with all paths to all folders.After creating the environment, all necessary data should be stored into the depending Input sub-folders.There is also an additional temp-folder, where temporary data is stored, which can be deleted after not being used anymore.
Usage
envi.create(proj_path = tempdir(), memfrac = NULL, ...)Arguments
proj_path | character. Path to project directory. Climodr will work exclusively in this folder and create all project folders in here. |
memfrac | numeric. Value between 0 and 0.9. The fraction of RAM that may be used by the terra package |
... | arguments passed down from other functions. |
Value
list. Contains all paths to each folder in the project directory. Necessary for climodr to operate its functions.
Examples
# create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)Extent file for vignette
Description
A vector file containing the shape and extent of the Area used in thevignette
Usage
ext_vignetteFormat
## 'ext_vignette'
- class
SpatVector
- geometry
polygons
- dimensions
1, 1 (geometries, attributes)
- extent
805737, 812824, 5890352, 5896005 (xmin, xmax, ymin, ymax)
- coord. ref.
WGS 84 / UTM zone 32N (EPSG:32632)
- values
1
Spat Vector
Source
Randomly created in (QGIS)[https://www.qgis.org/download/thank-you/].
Final aggregation for CSV-Data
Description
Extract the raster values of all raster layers from a scene at the stationcoordinates at each time stamp. The extracted data will be attached to thestation data so there is a .csv-file with coordinates, sensor data (response values)and extracted raster data (predictor values). The data is ready to be used for modelling.
Usage
fin.csv( envrmt = .GlobalEnv$envrmt, method = "monthly", crs = NULL, save_output = TRUE, ...)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
method | character. Either "daily", monthly" or "annual". Also depends on the available data. |
crs | character. If null, coordinate reference system from project files will be taken. Otherwisedata will be reprojected into this crs. |
save_output | logical. If cleaned data should be saved permanently in the Environment put save_output = TRUE.Otherwise the output will be saved in the temporary directory. Default: FALSE. |
... | arguments passed down from other functions. |
Value
List
See Also
'prep.csv', 'proc.csv', 'spat.csv', 'calc.indices'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)#prepare csv-filesprep.csv(envrmt = envrmt, method = "proc", save_output = TRUE)#process csv-filescsv_data <- proc.csv(envrmt = envrmt, method = "monthly", rbind = TRUE, save_output = TRUE)# Crop all raster bandscrop.all(envrmt = envrmt, method = "MB_Timeseries", overwrite = TRUE)# Calculate Indices from cropped raster bandscalc.indices(envrmt = envrmt, vi = "all", bands = c("blue", "green", "red", "nir", "nirb", "re1", "re2", "re3", "swir1", "swir2"), overwrite = TRUE)#extract station coordinatescsv_spat <- spat.csv(envrmt = envrmt, method = "monthly", des_file = "plot_description.csv", save_output = TRUE)#extract predictor values from raster filescsv_fin <- fin.csv(envrmt = envrmt, method = "monthly", save_output = TRUE)head(csv_fin)Plot description file
Description
Contains made up coordinates for imaginary climate stations for education purposes.
Usage
plot_descriptionFormat
## 'plot_description'A data frame with 10 rows and 5 columns
- plot
imaginary station name and code
- general
imaginary category of climate station
- region
location name of climate station
- lat
Latitude Coordinate of climate station
- lon
Longitude Coordinate of climate station
- elevation
elevation of climate station
Source
Randomly created coordinates and stations extracted from a random climate map.
Preparing CSV-Data
Description
Crops input data to the extent size and removes NA-Values
Usage
prep.csv(envrmt = .GlobalEnv$envrmt, method = "proc", save_output = TRUE, ...)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
method | character. "proc" for ready-to-use data in separate .csv-files. "tube" for raw-data from the Tube Data Base. Default "proc"-Method. |
save_output | logical. If cleaned data should be saved permanently in the Environment put save_output = TRUE.Otherwise the output will be saved in the temporary directory. Default: FALSE. |
... | arguments passed down from other functions. |
Value
List
See Also
'proc.csv', 'spat.csv', 'fin.csv'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)#prepare csv-filesprep.csv(envrmt = envrmt, method = "proc", save_output = TRUE)#check the created csv filescsv_files <- grep("_no_NAs.csv$", list.files(envrmt$path_tworkflow), value=TRUE)csv_filesProcessing CSV-Data
Description
Calculate averaged sensor values aggregated to a given time interval.
Usage
proc.csv( envrmt = .GlobalEnv$envrmt, method = "monthly", rbind = TRUE, save_output = TRUE, ...)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
method | character. Either "daily", monthly" or "annual". Also depends on the available data. |
rbind | logical. Create a single file with all climate stations. If FALSE, every station will be saved in a seperate file. |
save_output | logical. If data should be saved permanently in the Environment put save_output = TRUE.Otherwise the output will be saved in the temporary directory. Default: TRUE. |
... | arguments passed down from other functions. |
Value
List
See Also
'prep.csv', 'spat.csv', 'fin.csv'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)#prepare csv-filesprep.csv(envrmt = envrmt, method = "proc", save_output = TRUE)#process csv-filescsv_data <- proc.csv(envrmt = envrmt, method = "monthly", rbind = TRUE, save_output = TRUE)head(csv_data)Resolution and Area
Description
This raster contains the area of interest as well as the desired modelresolution (100 m * 100 m) and the project extent.
Usage
res_areaFormat
## 'res_area'A binary Raster of pixels with value 1 in extent that belong to example area
- class
SpatRaster
- dimensions
57, 71, 1 (nrow, ncol, nlyr)
- resolution
100, 100 (x, y)
- extent
805732, 812832, 5890310, 5896010 (xmin, xmax, ymin, ymax)
- coord. ref.
WGS 84 / UTM zone 32N (EPSG:32632)
- name
res_area
- min/max
0/1
Source
Randomly created binary Spat Raster file with the project resolution of 100 m per pixel. Created in (QGIS)[https://www.qgis.org/download/thank-you/].
Spatial Raster File for Vignette
Description
A spatial Raster file from a random area choose for the Vignette or as dummy data.
Usage
sch_201707Format
## 'sch_201707'A Spat Raster with 8 spectral bands
- class
SpatRaster
- dimensions
86, 151, 10 (nrow, ncol, nlyr)
- resolution
100, 100 (x, y)
- extent
801522.5, 816622.5, 5888973, 5897573 (xmin, xmax, ymin, ymax)
- coord. ref.
WGS 84 / UTM zone 32N (EPSG:32632)
- names
blue, green, red, nir, nirb, re1, re2, re3, swir1, swir2
- min/max
33.90298/5479.6602
Source
Randomly created Spat Raster file from (Sentinel-2 Data)[https://browser.dataspace.copernicus.eu/?zoom=10&lat=52.96601&lng=13.86818&themeId=DEFAULT-THEME&visualizationUrl=U2FsdGVkX1
Digital Ground Model for Vignette
Description
A Digital Ground Model file from a random area choose for the Vignette or as dummy data.
Usage
sch_dgmFormat
## 'sch_dgm'A Digital Ground Model
- class
SpatRaster
- dimensions
86, 151, 10 (nrow, ncol, nlyr)
- resolution
100, 100 (x, y)
- extent
801522.5, 816622.5, 5888973, 5897573 (xmin, xmax, ymin, ymax)
- coord. ref.
WGS 84 / UTM zone 32N (EPSG:32632)
- names
elevation
- min/max
48.75315/94.67307
Source
Randomly extracted Digital Ground Model.
Spatial aggregation for CSV-Data
Description
Extract station coordinates from meta-data and reproject the coordinates to theproject coordinate reference system.
Usage
spat.csv( envrmt = .GlobalEnv$envrmt, method = "monthly", des_file, crs = NULL, save_output = TRUE, ...)Arguments
envrmt | variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
method | character. Either "daily", monthly" or "annual". Also depends on the available data. |
des_file | character. The filename and data type of the meta-data. (Only reads .csv) |
crs | character. EPSG of the Coordinate Reference System, if no **res_area.tif** file is provided. |
save_output | logical. If cleaned data should be saved permanently in the Environment put save_output = TRUE.Otherwise the output will be saved in the temporary directory. Default: TRUE |
... | arguments passed down from other functions. |
Value
Data Frame
See Also
'prep.csv', 'proc.csv', 'fin.csv'
Examples
#create climodr environment and allow terra-functions to use 70% of RAMenvrmt <- envi.create(proj_path = tempdir(), memfrac = 0.7)# Load the climodr example data into the current climodr environmentclim.sample(envrmt = envrmt)#prepare csv-filesprep.csv(envrmt = envrmt, method = "proc", save_output = TRUE)#process csv-filescsv_data <- proc.csv(envrmt = envrmt, method = "monthly", rbind = TRUE, save_output = TRUE)#extract station coordinatescsv_spat <- spat.csv(envrmt = envrmt, method = "monthly", des_file = "plot_description.csv", save_output = TRUE)head(csv_spat)