read_caim_raw: Read a canopy image from a raw file

View source: R/read_caim_raw.R

read_caim_rawR Documentation

Read a canopy image from a raw file

Description

Function that complements read_caim()

Usage

read_caim_raw(
  path = NULL,
  z = NULL,
  a = NULL,
  zenith_colrow = NULL,
  radius = 700,
  rmax = 100,
  k = 1,
  p = 1,
  only_blue = FALSE,
  offset_value = NULL
)

Arguments

path

Character vector of length one.Path to a raw file, including file extension.

z

SpatRaster built with zenith_image().

a

SpatRaster built with azimuth_image().

zenith_colrow

Numeric vector of length two. Raster coordinates of the zenith. See calc_zenith_colrow().

radius

Numeric integer of length one. Radius of the reprojected hemispherical image (i.e., the output).

rmax

Numeric vector of length one. Maximum radius where to search for knn. Increase this value if pixels with value 0 or FALSE appears where other values are expected.

k

Numeric vector of length one. Number of k-nearest neighbors.

p

Numeric vector of length one. Power for inverse-distance weighting.

only_blue

Logical vector of length one. If TRUE, only values from the blue or cyan wavelength will be processed.

offset_value

numeric vector. This values will replace the black_level_per_channel metadata obtained with rawpy.

Details

This function facilitates the integration of the rawpy Python package into the R environment via the reticulate package. This integration allows rcaiman to access and pre-process raw data.

Here is a step-by-step guide to assist users in setting up the environment for efficient processing:

Check Python Accessibility:

To ensure that R can access a Python installation, run the following test:

reticulate::py_eval("1+1")

If R can access Python successfully, you will see 2 in the console. If not, you will receive instructions on how to install Python.

Create a Virtual Environment:

After passing the Python accessibility test, create a virtual environment using the following command:

reticulate::virtualenv_create()

Install rawpy:

Install the rawpy package within the virtual environment:

reticulate::py_install("rawpy")

For RStudio Users:

If you are an RStudio user who works with projects, you will need a .Renviron file in the root of each project. To create a .Renviron file, follow these steps:

  • Create a "New Blank File" named ".Renviron" (without an extension) in the project's root directory.

  • Run bellow code:

path <- file.path(reticulate::virtualenv_root(),
reticulate::virtualenv_list(), "Scripts", "python.exe")
paste("RETICULATE_PYTHON =", path)

  • Copy/paste the line from the console (the string between the quotes) into the .Renviron file. This is an example ⁠RETICULATE_PYTHON = ~/.virtualenvs/r-reticulate/Scripts/python.exe⁠

  • Do not forget to save the changes

By following these steps, users can easily set up their environment to access raw data efficiently, but it is not the only way of doing it.

Value

An object from class SpatRaster. Single-layer raster if only_blue is equal to TRUE. Otherwise, a raster with as many layers as there are distinct colors in the Color Filter Array. Layer names are taken from the color description metadata.

See Also

Other Tool Functions: colorfulness(), correct_vignetting(), defuzzify(), extract_dn(), extract_feature(), extract_rl(), extract_sky_points_simple(), extract_sky_points(), extract_sun_coord(), find_sky_pixels_nonnull(), find_sky_pixels(), masking(), optim_normalize(), percentage_of_clipped_highlights(), read_bin(), read_caim(), write_bin(), write_caim()


rcaiman documentation built on Nov. 15, 2023, 1:08 a.m.