View source: R/write_sky_cie.R
| write_sky_cie | R Documentation |
Persist and restore the out-of-the-box CIE sky model, its diagnostics, and
related rasters/points. The writer produces a human-readable .txt manifest
plus CSV and GeoPackage sidecar files. The reader reconstructs a list object
compatible with the out-of-the-box pipeline.
write_sky_cie(sky_cie, name)
read_sky_cie(name, r, z, a, refit_allowed = FALSE)
sky_cie |
list. Object holding the fitted CIE model, diagnostics, and derived rasters, as produced by the out-of-the-box workflow. |
name |
character vector of length one. File base name without extension.
A path can be included, e.g., |
r |
numeric terra::SpatRaster of one layer. The canopy image
used in the out-of-the-box workflow (used by |
z |
terra::SpatRaster generated with |
a |
terra::SpatRaster generated with |
refit_allowed |
logical vector of length one. If |
Encoding is UTF-8. Decimal point is .. Unknown keys are
ignored with a warning. Missing required keys trigger an error. The manifest
begins with format_version: which is checked for basic compatibility.
When read_sky_cie() detects manual edits (moved sun disk or changed sky
points) and refit_allowed = TRUE, it re-fits the CIE model using the
current r, z, and a, then revalidates.
See Functions.
write_sky_cieNo return value. Writes six files to disk with the
prefix name (see below).
read_sky_cieReturns a list similar to the output of
ootb_sky_cie() and suitable as input to ootb_sky_above().
write_sky_cie Plain text manifest: name.txt
CSV with sky radiance samples: name_rr.csv
CSV with sky radiance samples for the upward pass: name_rr_up.csv (optional)
GeoPackage with sky sample points: name_sky_points.gpkg
GeoPackage with the sun disk location: name_sun_disk.gpkg
CSV with validation pairs: name_val.csv
format_version:Semantic version of the manifest.
sun_theta:Solar zenith (deg).
sun_phi:Solar azimuth (deg).
method_sun:Method used to optimize sun coordinates.
zenith_dn:Reference DN at zenith.
start_a:…start_e:Initial CIE coefficients.
is_from_detected_sky_dn:Enables _rr_up.csv if TRUE.
fit_a:…fit_e:Fitted CIE coefficients.
method:Method used to fit CIE coefficients.
dist_to_black:Argument passed to extract_sky_points().
grid:Sky grid parameters (angle_width, first_ring_different).
min_spherical_dist:Sampling buffer distance (deg).
sky_points_no:Number of sky points.
outliers_no:Number of sky points that were detected as outliers.
rmse:Validation metrics. Root mean squared error.
r_squared:Validation metric. Coefficient of determination.
mae:Validation metrics. Mean absolute error.
[Tested: …]Enumerates tested methods/grids/distances.
## Not run:
caim <- read_caim()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
# Read a previously written model
path <- system.file("external/example.txt", package = "rcaiman")
sky_cie <- read_sky_cie(gsub(".txt", "", path), r = caim$Blue, z = z, a = a,
refit_allowed = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.