Package 'leafSTAR'

Title: Silhouette to Area Ratio of Tilted Surfaces
Description: Implementation of trigonometric functions to calculate the exposure of flat, tilted surfaces, such as leaves and slopes, to direct solar radiation. It implements the equations in A.G. Escribano-Rocafort, A. Ventre-Lespiaucq, C. Granado-Yela, et al. (2014) <doi:10.1111/2041-210X.12141> in a few user-friendly R functions. All functions handle data obtained with 'Ahmes' 1.0 for Android, as well as more traditional data sources (compass, protractor, inclinometer). The main function (star()) calculates the potential exposure of flat, tilted surfaces to direct solar radiation (silhouette to area ratio, STAR). It is equivalent to the ratio of the leaf projected area to total leaf area, but instead of using area data it uses spatial position angles, such as pitch, roll and course, and information on the geographical coordinates, hour, and date. The package includes additional functions to recalculate STAR with custom settings of location and time, to calculate the tilt angle of a surface, and the minimum angle between two non-orthogonal planes.
Authors: Agustina Ventre Lespiaucq [aut, cre], Silvia Santamaria Bueno [aut]
Maintainer: Agustina Ventre Lespiaucq <[email protected]>
License: AGPL-3
Version: 1.0
Built: 2025-02-15 03:08:23 UTC
Source: https://github.com/cran/leafSTAR

Help Index


Application for smartphones for measuring the position angles of flat, tilted surfaces.

Description

Application for smartphones that allows to characterize the 3-dimensional position of flat surfaces. It measures four position angles, namely pitch, roll, azimuth and course relative to the Earth's magnetic and gravitational fields using the integrated sensors of the cell phone. The latest version is 'Ahmes' 1.0 and runs under Android 2.2 or later version.

Usage

Ahmes

Format

An object of class character of length 1.

Details

The details of 'Ahmes' are described in Escribano-Rocafort et al. (2014).

References

Ahmes 1.0 https://play.google.com/store/apps/details?id=com.movil.hoja.movihoja.ahmes&hl=en

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014) Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.


Calculate the dihedral angle between two planes

Description

Calculate the minimum angle between two non-orthogonal planes, such as the angle describing leaf torsion, the angle between two halves of conduplicate or plicate leaves, the angle between the petiole and the branch, between two leaves and between two branches.

Usage

dihedral(plane1, plane2, Ahmes = FALSE, ID = NULL, pitch1, roll1, course1,
  pitch2, roll2, course2, horiz = TRUE)

Arguments

plane1, plane2

Objects of class data.frame containing the angles of plane1 and plane2 and row labels.

Ahmes

Logical. Do data come from 'Ahmes'? Defaults to FALSE

ID

An optional vector with the labels of the observations. Defaults to NULL.

pitch1, pitch2

Numeric. The name of the variables containing the pitch angles of planes 1 and 2 in degrees. See details.

roll1, roll2

Numeric. The name of the variables containing the roll angles of planes 1 and 2 in degrees. See details.

course1, course2

Numeric. The name of the variables containing the course angles of planes 1 and 2 in degrees. See details.

horiz

Logical. Set the position of the start (zero, 0) of pitch, roll and tilt angle data. horiz = F indicates the zero is located at zenith. This is the reference system used by Ahmes. horiz = T indicates the start is at the horizon. To use tilt in further calculations (star, sal...), angle data should be expressed in the horizontal reference system (0 = horizon). Defaults to TRUE.

Details

pitch values span from 0 to 180 degrees. If horiz = TRUE (default) 0 and 180 refer to the flat horizontal surface and 90 refers to the flat vertical surface. If horiz = FALSE 0 and 180 refer to the flat vertical surface and 90 refers to the flat horizontal surface.

roll values span from 0 to 180 degrees.

course values span from 0 (North) to 360 degrees, clockwise. Course is the angle between north and the horizontal projection of a normal vector to the surface.

For a graphical explanation of leaf angles, see Fig. 2 in Escribano-Rocafort et al. (2014).

Author(s)

Agustina Ventre-Lespiaucq and Silvia Santamaria Bueno.

References

dihedral Santalo, L.A. (1970). Vectores y tensores con sus aplicaciones. p. 61, 8 Edicion. EUDEBA (eds), Buenos Aires, Argentina.

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014). Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.

orchids Ventre-Lespiaucq, A.B., Delgado, J.A., Ospina-Calderon, N.H., Otero, J.T., Escudero, A., Sanchez, M.A., Balaguer, L., Flanagan, N.S. (2017). A tropical epiphytic orchid uses a low-light interception strategy in a spatially heterogeneous light environment. Biotropica, 49:318-327. doi:10.1111/btp.12425.

Examples

data(orchids)
  pseudobulbs<-subset(orchids,organ=="pseudobulb") #subset
  leaves<-subset(orchids,organ=="leaf")
  dihedral(plane1=pseudobulbs,plane2=leaves,Ahmes=FALSE,ID=NULL,pitch1=pseudobulbs$pitch,
  roll1=pseudobulbs$roll,course1=pseudobulbs$course,pitch2=leaves$pitch,roll2=leaves$roll,
  course2=leaves$course,horiz=FALSE)  
#dihedral()

Fix the output of 'Ahmes' 1.0

Description

Convert the output of 'Ahmes' 1.0 to a dataframe that can be handled by 'leafSTAR' and 'R' in general.

Usage

fixfile(x)

Arguments

x

The output of 'Ahmes' 1.0. A .csv file

Details

This function does not modify the original dataset. To have a permanent fixed version of the data, see Example. If using the new data within the package, be aware that the argument Ahmes should be set to FALSE.

Author(s)

Agustina Ventre-Lespiaucq and Silvia Santamaria Bueno.

See Also

Ahmes, fixhour

Examples

data(olea)
 olea_fixed<-fixfile(olea) ## Store the fixed file as a new object.
#fixfile()

Fix the hour format

Description

Convert the hour from sexagesimal character to decimal numeric format.

Usage

fixhour(x, seconds = FALSE)

Arguments

x

A character vector with the hour expressed as sexagesimal characters HH:MM or HH:MM:SS.

seconds

Logical. Is the hour expressed as HH:MM:SS (seconds=TRUE) or as HH:MM (seconds=FALSE)? Defaults to FALSE.

Author(s)

Silvia Santamaria Bueno.

See Also

fixfile

Examples

datahours<-c("00:30","10:00","18:20","20:55")
 datahours_fixed<-fixhour(datahours,seconds=FALSE)
#fixhour()

Leaf angles of guava trees

Description

The guava data frame has 239 rows and 11 columns

Usage

guava

Format

This data frame contains the following columns:

tree.ID Identification of the tree.

leaf.ID Identification of the leaf.

measure.ID Number of observation (from 'Ahmes').

sector Sector of the tree where leaf data was collected, with five levels corresponding to the north, east, south, and west sectors of the crown base (1N, 2E, 3S, 4W, respectively) and the top crown sector (5A).

azimuth Azimuth angle in degrees.

pitch Pitch angle in degrees.

roll Roll angle in degrees.

course Course angle in degrees with the zero placed at South (old 'Ahmes' version)

LA.cm2 Leaf area.

tilt.degrees Tilt angle calculated from pitch and roll with a changed reference system (horiz = T).

course.degrees Course angle in degrees with the zero placed at North (latest 'Ahmes' version 1.0).

Details

These data are measurements of four leaf position angles of 239 leaves in five guava trees (Psidium guajava), each leaf in a row. guava is an object of class data.frame and results from applying the function fixfile to the output of an earlier version of 'Ahmes', where the reference for course was placed at South.

References

guava Ventre-Lespiaucq, A., et al. Unpublished data.

Ahmes 1.0 https://play.google.com/store/apps/details?id=com.movil.hoja.movihoja.ahmes&hl=en

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014) Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.


Leaf angles of olive tree measured with 'Ahmes' 1.0

Description

The olea data frame has 24 rows and 15 columns

Usage

olea

Format

This data frame contains the following columns:

Num.Medida Number of observation.

Cabeceo Pitch angle in degrees.

Alabeo Roll angle in degrees.

Azimuth Azimuth angle in degrees.

Rumbo Course angle in degrees.

Estado_Brujula Compass_State. The values depend on the sensors of each cell phone.

Estado_Acelerometro Accelerometer_State. The values depend on the sensors of each cell phone.

Estado_Campo_Magnetico Magnetic_Field_State. The values depend on the sensors of each cell phone.

Fecha Date. Note this is a date-hour column. See details.

Hora Hour. Instead of the hour, it contains the values of the next column. See details.

Bateria Battery. State of the battery.

Temperatura Temperature. Only available when using temperature sensors coupled to the cell phone.

Presion Pressure. Only available when using pressure sensors coupled to the cell phone.

Error_Relativo Relative error. See Escribano-Rocafort et al. (2014).

Empty column

Details

These data are measurements of four leaf position angles of 20 leaves in an olive tree (Olea europaea), each leaf in a row. The format of the data is an example of the raw output from 'Ahmes' 1.0. olea is a .csv file. This file presents some issues that need to be corrected. There are four extra rows to be deleted (1:3, final row). The hour and date are in the same colum, which needs to be separated in order to extract hour and date information directly from the data. This makes column headers to be displaced from columns 10 to 15. In addition, the headers of the output of Ahmes are provided in Spanish. Function fixfile implements solutions to these issues and renames the variables in English.

References

olea Ventre-Lespiaucq, A., Santamaria Bueno, S., unpublished data.

Ahmes 1.0 https://play.google.com/store/apps/details?id=com.movil.hoja.movihoja.ahmes&hl=en

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014) Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.


Leaf angles of olive tree measured with a compass and inclinometer

Description

The olive data frame has 20 rows and 10 columns

Usage

olive

Format

This data frame contains the following columns:

location Where measurements were taken.

latitude Latitude where measurements were taken, in decimal format.

longitude Longitude where measurements were taken, in decimal format.

date Date.

hour Hour.

tz UTC time zone. Time zones west of Greenwich should be indicated with a minus sign (e.g., tz = -2).

leaf.ID Identification of the leaf.

tilt Tilt angle measured with a digital clinometer.

course Course angle measured with a compass.

azimuth Azimuth angle measured with a compass.

Details

These data are measurements of three leaf position angles of 20 leaves in an olive tree (Olea europaea), each leaf in a row. This dataset is an example of compass and inclinometer measurements. Tilt was measured instead of pitch and roll. The data.frame includes data on the geographic location, date and time. All these variables can be used directly as arguments in the functions of the star family.

References

olive Ventre-Lespiaucq, A., Santamaria Bueno, S., unpublished data.

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014) Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.


Leaf and pseudobulb angles of epiphytic orchids

Description

The orchids data.frame has 500 rows and 7 columns

Usage

orchids

Format

This data.frame contains the following columns:

measure.ID Number of observation (from Ahmes).

orchid.ID Identification of the orchid.

organ Tags each observation with "leaf" or "pseudobulb".

module Identifies the leaf-pseudobulb pair.

pitch Pitch angle in degrees.

roll Roll angle in degrees.

course Course angle in degrees.

Details

Subset of the dataset in Ventre-Lespiaucq et al. (2017). These data are measurements of three leaf position angles of 250 leaf-pseudobulb pairs in 84 epiphytic orchids (Rodriguezia granadensis). Each row contains either pseudobulb or leaf angle data.

References

orchids Ventre-Lespiaucq, A., Delgado, J.A., Ospina-Calderon, N.H., Otero, J.T., Escudero, A., Sanchez, M.A., Balaguer, L., Flanagan, N.S. (2017) A tropical epiphytic orchid uses a low-light interception strategy in a spatially heterogeneous light environment. Biotropica 49:318-327. doi:10.1111/btp.12425.

Ahmes 1.0 https://play.google.com/store/apps/details?id=com.movil.hoja.movihoja.ahmes&hl=en

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014) Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.


Calculate the projected surface area of a tilted plane

Description

Retrieves the projected area of the surface in area units.

Usage

sal(x, LA)

Arguments

x

Numeric vector, commonly the output of functions of the star family, containing STAR (%).

LA

Numeric vector containing the total area of the surface of each observation.

Author(s)

Agustina Ventre-Lespiaucq and Silvia Santamaria Bueno.

See Also

SAL can be calculated with STAR data coming from star, simu.star, star.app, and simu.star.app

Examples

data(guava)
 ## Calculate SAL for a given location, date and time
    gua<-star(guava,lat=40.82,long=-4.21,local.time=12,tz=1,
         Ahmes=FALSE,ID=NULL,pitch=guava$pitch,roll=guava$roll,
         horiz=FALSE,course=guava$course,date=30,o.format=NULL)
         sal(gua,LA=guava$LA.cm2)

 ## Calculate SAL from simu.star() 
    sim.gua<-simu.star(guava,lat=40.82,long=-4.21,local.time=12,tz=1,
             Ahmes=FALSE,ID=NULL, pitch=guava$pitch,roll=guava$roll,
             horiz=FALSE,course=guava$course,date=30,o.format=NULL,
             c.hour=c(7,9.5,12),c.date=30,c.lat=40.8,c.long=-4.2,c.tz=1,
             LA=guava$LA.cm2,details=TRUE)
             sal.guava<-sal(sim.gua$STAR,LA=sim.gua$LA)
#sal()

Calculate simulated silhouette to area ratios

Description

Recalculate the percentage of potential exposure of flat, tilted surfaces to direct solar radiation with different custom settings of location and time.

Usage

simu.star(x, lat = NULL, long = NULL, local.time = NULL, tz = NULL,
  Ahmes = F, ID = NULL, pitch, roll, tilt.ang = NULL, horiz = T, course,
  date = NULL, o.format = NULL, c.hour = NULL, c.date = NULL,
  c.long = NULL, c.lat = NULL, c.tz = NULL, LA = NULL, details = TRUE)

Arguments

x

A dataframe with observations in the rows and at least two spatial position angles in the columns (see Details). Data can come either from 'Ahmes' 1.0 or from measurements performed with traditional instrumentation.

lat

A vector with the latitude of each observation in decimal format. If all observations correspond to the same latitude, lat can be introduced directly as a single number (see examples).

long

A vector with the longitude of each observation in decimal format. If all observations correspond to the same longitude, long can be introduced directly as a single number (see examples).

local.time

A numeric vector with the local time of each observation in decimal format. Hours from 00 to 24. Minutes in decimal format, from 0 to 99. E.g., 12:30 should be written as 12.50. If available, seconds should also be specified in decimal format. See fixhour. If all observations correspond to the same local time, local.time can be introduced directly as a single number (see examples).

tz

A vector with the time zone of each observation. If all observations correspond to the same time zone, tz can be introduced directly as a single number. Time zones located at the West of Greenwich are negative, and at the East are positive; e.g., for Colombia, tz = -5; for Reunion Island, tz = 4.

Ahmes

Logical. Do data come from 'Ahmes' 1.0? Defaults to FALSE.

ID

An optional vector with the labels of the observations. Defaults to NULL.

pitch

A vector with pitch angles in degrees. See details.

roll

A vector with roll rotation angles in degrees. See details.

tilt.ang

A vector with tilt angles in degrees. Tilt is calculated from pitch and roll angles. This argument allows to specify tilt directly if available.

horiz

Logical. Set the position of the start (zero, 0) of pitch, roll and tilt angle data. horiz = F indicates the zero is located at zenith. This is the reference system used by Ahmes. horiz = T indicates the start is at the horizon. To use tilt in further calculations (star, sal...), angle data should be expressed in the horizontal reference system (0 = horizon). Defaults to TRUE.

course

A vector with course angles in degrees. See details.

date

A vector containing the date(s) when observations were made. If input data do not come from 'Ahmes', o.format needs to be specified. See details.

o.format

A character indicating the date format in the input data. It is similar to the argument format in the function as.Date{base}. Defaults to NULL. See details and examples.

c.hour

A vector of custom hours of length equal to or greater than 1. Hours in decimal format, from 0 to 24. Minutes in decimal format, from 0 to 99. E.g., 12:30 should be written as 12.50. If available, seconds should also be specified in decimal format. See fixhour. If all observations correspond to the same local time, local.time can be introduced directly as a single number (see examples).

c.date

A vector of custom dates of length equal to or greater than 1.

c.long

A vector of custom longitude coordinates in decimal format.

c.lat

A vector of custom latitude coordinates in decimal format.

c.tz

A vector of custom time zone/s. Time zones located at the West of Greenwich are negative; e.g., for Colombia, c.tz = -5; for Reunion Island, c.tz = 4.

LA

Indicates whether leaf area data needs to be replicated to match the dimensions of the dataframe corresponding to the custom factors (see 'custom settings' in Details). When LA is specified, all the five custom factors (c.hour, c.date, c.lat, c.long, c.tz) need to be specified (i.e., they should be different from NULL). Defaults to NULL. LA does not affect the calculation of STAR. See examples.

details

Logical. If (details =FALSE) the output of simu.star() is a vector with STAR values. If details = TRUE the output is the complete dataset plus a column with STAR values. Defaults to TRUE.

Details

x may also content geographical coordinates and hour and date information.

date Internally the function uses Julian dates. Julian date is the recommended input format. Conversion tables are available at https://landweb.nascom.nasa.gov/browse/calendar.html for leap and regular years.

o.format Needs to be specified if Ahmes = FALSE AND input data format is other than Julian or the default formats handled by as.Date{base} ("%Y/%m/%d" and "%Y-%m-%d"). When Ahmes = TRUE, o.format is not needed because functions from the Ahmes family solve date issues internally.

pitch values span from 0 to 180 degrees. If horiz = TRUE (default) 0 and 180 refer to the flat horizontal surface and 90 refers to the flat vertical surface. If horiz = FALSE 0 and 180 refer to the flat vertical surface and 90 refers to the flat horizontal surface.

roll values span from 0 to 180 degrees.

course values span from 0 (North) to 360 degrees, clockwise. Course is the angle between north and the horizontal projection of a normal vector to the surface.

For a graphical explanation, see Fig. 2 in Escribano-Rocafort et al. (2014).

Custom settings. In the functions of the simu family, the original dataframe is repeated as a block times the number of levels of the custom arguments specified (c.hour, c.date, c.lat, c.long, and c.tz). E.g., if a dataset with 10 observations is to be recalculated at two days of the year, the function will create a new dataframe with 20 rows (10 observation X 2 days). For this reason, LA needs to be specified if the user intends to calculate SAL using the output of simu.star(). In addition, the argument details allows the user to visualize the new dataframe created by the function.

Author(s)

Agustina Ventre-Lespiaucq and Silvia Santamaria Bueno.

References

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014). Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.

See Also

simu.star.app, star

Examples

# With custom vectors from outside of the dataframe
 data(guava)
  myhours<-seq(8,16,0.25) # Create a vector of hours from 8:00 to 16:00 every 15 minutes.
  mydates<-seq(1,365,60) # Create a vector of days from January 1st to December 31st, 
                         # every 60 days.
  myguava<-simu.star(guava,lat=40.8,long=-4.2,local.time=6,tz=1,
           Ahmes=FALSE,ID=NULL,pitch=guava$pitch,roll=guava$roll,
           horiz=FALSE,course=guava$course,date=30,o.format=NULL,
           c.hour=myhours,c.date=mydates,c.long=NULL,c.lat=NULL, 
           c.tz=NULL, LA=NULL)

 # LA is not NULL
  wrong<-simu.star(guava,lat=40.8,long=-4.2,local.time=6,tz=1,
         Ahmes=FALSE,ID=NULL,pitch=guava$pitch,roll=guava$roll,
         horiz=FALSE,course=guava$course,date=30,o.format=NULL,
         c.hour=c(7,9.5,12),c.date=c(0,180),LA=guava$LA.cm2,details=TRUE)
     # Some custom settings are missing. STAR is retrieved as if LA = NULL, 
     # meaning LA data will not be readily available for calculating SAL. 

  correct<-simu.star(guava,lat=40.8,long=-4.2,local.time=6,tz=1,
           Ahmes=FALSE,ID=NULL,pitch=guava$pitch,roll=guava$roll,
           horiz=FALSE,course=guava$course,date=30,o.format=NULL,
           c.hour=c(7,9.5,12),c.date=c(0,180),c.lat=40.8,c.long=-4.2, 
           c.tz=1, LA=guava$LA.cm2,details=TRUE)
     # Returns LA and STAR

 # LA is NULL
  correct1<-simu.star(guava,lat=40.8,long=-4.2,local.time=6,tz=1,
            Ahmes=FALSE,ID=NULL,pitch=guava$pitch,roll=guava$roll,
            horiz=FALSE,course=guava$course,date=30,o.format=NULL,
            c.hour=c(7,9.5,12),c.date=c(0,180),c.long=NULL,c.lat=NULL, 
            c.tz=NULL, LA=NULL,details=TRUE)
          # Is the same as
  correct2<-simu.star(guava,lat=40.8,long=-4.2,local.time=6,tz=1,
            Ahmes=FALSE,ID=NULL,pitch=guava$pitch,roll=guava$roll,
            horiz=FALSE,course=guava$course,date=30,o.format=NULL,
            c.hour=c(7,9.5,12),c.date=c(0,180),details=TRUE)
#simu.star()

Calculate simulated silhouette to area ratios from 'Ahmes' 1.0

Description

This is a version of simu.star function that only works with the output of 'Ahmes' 1.0. simu.star.app() re-calculates the percentage of potential exposure of flat, tilted surfaces to direct solar radiation with different custom settings of location and time.

Usage

simu.star.app(x, lat, long, tz, o.format = NULL, c.hour = NULL,
  c.date = NULL, c.long = NULL, c.lat = NULL, c.tz = NULL, LA = NULL,
  details = FALSE)

Arguments

x

Output of 'Ahmes' 1.0. A .csv file.

lat

A vector with the latitude of each observation in decimal format. If all observations correspond to the same latitude, lat can be introduced directly as a single number (see examples).

long

A vector with the longitude of each observation in decimal format. If all observations correspond to the same longitude, long can be introduced directly as a single number (see examples).

tz

A vector with the time zone of each observation. If all observations correspond to the same time zone, tz can be introduced directly as a single number (see examples). Time zones located at the West of Greenwich are negative, and at the East are positive; e.g., for Colombia, tz = -5; for Reunion Island, tz = 4.

o.format

A character indicating the date format in the input data. It is similar to the argument format in the function as.Date{base}. Defaults to NULL. See details and examples.

c.hour

A vector of custom hours of length equal to or greater than 1. Hours in decimal format, from 0 to 24. Minutes in decimal format, from 0 to 99. E.g., 12:30 should be written as 12.50. If available, seconds should also be specified in decimal format. See fixhour. If all observations correspond to the same local time, local.time can be introduced directly as a single number (see examples).

c.date

A vector of custom dates of length equal to or greater than 1.

c.long

A vector of custom longitude coordinates in decimal format.

c.lat

A vector of custom latitude coordinates in decimal format.

c.tz

A vector of custom time zone/s. Time zones located at the West of Greenwich are negative; e.g., for Colombia, c.tz = -5; for Reunion Island, c.tz = 4.

LA

Indicates whether leaf area data needs to be replicated to match the dimensions of the dataframe corresponding to the custom factors (see 'custom settings' in Details). When LA is specified, all the five custom factors (c.hour, c.date, c.lat, c.long, c.tz) need to be specified (i.e., they should be different from NULL). Defaults to NULL. LA does not affect the calculation of STAR. See examples.

details

Logical. If (details =FALSE), the output of simu.star.app() is a vector with STAR values. If details = TRUE the output is the complete dataset plus a column with STAR values. Defaults to TRUE.

Details

This function calls fixfile internally before calculating STAR. However, it does not modify the original dataset. To have a permanent fixed version of the data, use new.file<-fixfile(your.data). If using new.file within the package, be aware that the argument Ahmes should be set to FALSE.

o.format Needs to be specified if Ahmes = FALSE AND input data format is other than Julian or the default formats handled by as.Date{base} ("%Y/%m/%d" and "%Y-%m-%d"). When Ahmes = TRUE, o.format is not needed because functions of the Ahmes family solve date issues internally.

Custom settings. In the functions of the simu family, the original dataframe is repeated as a block times the number of levels of the custom arguments specified (c.hour, c.date, c.lat, c.long, and c.tz). E.g., if a dataset with 10 observations is to be recalculated at two days of the year, the function will create a new dataframe with 20 rows (10 observation X 2 days). For this reason, LA needs to be specified if the user intends to calculate SAL using the output of simu.star. In addition, the argument details allows the user to visualize the new dataframe created by the function.

Author(s)

Agustina Ventre-Lespiaucq and Silvia Santamaria Bueno.

References

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014). Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.

See Also

fixfile, simu.star, star.app

Examples

data(olea)
simustar_olea<-simu.star.app(olea,lat=40,long=4,tz=2,
 c.hour=c(8,12,18),c.date=c(1,60,120,180,240))

#simu.star.app()

Calculate the silhouette to area ratio

Description

Calculate the percentage of potential exposure of flat, tilted surfaces to direct solar radiation. It is equivalent to the ratio of the surface projected area to total surface area, but instead of using area data it uses spatial position angles (pitch, roll and course or tilt and course), geographical coordinates, hour and date information. This function implements equation 3 in Escribano-Rocafort et al. (2014).

Usage

star(x, lat, long, local.time = NULL, tz, Ahmes = F, ID = NULL,
  pitch = NULL, roll = NULL, horiz = T, tilt.ang = NULL,
  course = NULL, date = NULL, o.format = NULL)

Arguments

x

A dataframe with observations in the rows and at least two spatial position angles in the columns (see Details). Data can either come from 'Ahmes' 1.0 or from measurements performed with traditional instrumentation.

lat

A vector with the latitude of each observation in decimal format. If all observations correspond to the same latitude, lat can be introduced directly as a single number (see examples).

long

A vector with the longitude of each observation in decimal format. If all observations correspond to the same longitude, long can be introduced directly as a single number (see examples).

local.time

A numeric vector with the approximate local time of each observation in decimal format. Hours from 0 to 24. Minutes in decimal format, from 0 to 99. E.g., 12:30 should be written as 12.50. If available, seconds should also be specified in decimal format. See fixhour. If all observations correspond to the same local time, local.time can be introduced directly as a single number (see examples).

tz

A vector with the time zone of each observation. If all observations correspond to the same time zone, tz can be introduced directly as a single number (see examples). Time zones located at the West of Greenwich are negative, and at the East are positive; e.g., for Colombia, tz = -5; for Reunion Island, tz = 4.

Ahmes

Logical. Do data come from 'Ahmes' 1.0? Defaults to FALSE.

ID

An optional vector with the labels of the observations. Defaults to NULL.

pitch

A vector with pitch angles in degrees. See details.

roll

A vector with roll rotation angles in degrees. See details.

horiz

Logical. Set the position of the start (zero, 0) of pitch, roll and tilt angle data. horiz = F indicates the zero is located at zenith. This is the reference system used by 'Ahmes'. horiz = T indicates the start is at the horizon. To use tilt in further calculations (simu.star, sal...), angle data should be expressed in the horizontal reference system (0 = horizon). Defaults to TRUE.

tilt.ang

A vector with tilt angles in degrees. Tilt is calculated from pitch and roll angles. This argument allows to specify tilt directly if available.

course

A vector with course angles in degrees. See details.

date

A vector containing the date(s) when observations were made. If input data do not come from 'Ahmes', o.format needs to be specified. See details.

o.format

A character indicating the date format in the input data. It is similar to the argument format in the function as.Date{base}. Defaults to NULL. See details and examples.

Details

x may also content geographical coordinates and hour and date information.

date Internally the function uses Julian dates. Julian date is the recommended input format. Conversion tables are available at https://landweb.nascom.nasa.gov/browse/calendar.html for leap and regular years.

o.format Needs to be specified if Ahmes = FALSE AND input data format is other than Julian or the default formats handled by as.Date{base} ("%Y/%m/%d" and "%Y-%m-%d"). When Ahmes = TRUE, o.format is not needed because functions of the Ahmes family solve date issues internally.

pitch values span from 0 to 180 degrees. If horiz = TRUE (default) 0 and 180 refer to the flat horizontal surface and 90 refers to the flat vertical surface. If horiz = FALSE 0 and 180 refer to the flat vertical surface and 90 refers to the flat horizontal surface.

roll values span from 0 to 180 degrees.

course values span from 0 (North) to 360 degrees, clockwise. Course is the angle between north and the horizontal projection of a normal vector to the surface.

For a graphical explanation, see Fig. 2 in Escribano-Rocafort et al. (2014).

Author(s)

Agustina Ventre-Lespiaucq and Silvia Santamaria Bueno.

References

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014). Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.

Examples

## Example with an 'Ahmes'-type input
data(olea)
star_olea<-star(olea,lat=40,long=4,tz=2,Ahmes=TRUE)
 # Add results to the original dataset
    olea1<-fixfile(olea) # Fix the original dataset
    olea2<-cbind(olea1,as.data.frame(star_olea))

 # Example with an input different to 'Ahmes' data
  data(olive)
   star_olive<-star(olive,lat=olive$latitude,long=olive$longitude,
               local.time=olive$hour,tz=olive$tz, Ahmes=FALSE,
               ID=olive$leafID,tilt.ang=olive$tilt,horiz=TRUE,
               course=olive$course,date=olive$date)
  # Add results to the original dataset.
   olive2<-cbind(olive,as.data.frame(star_olive)) # Since it does not
                                                 # come from 'Ahmes', 
                                                 # it is not necessary 
                                                 # to run fixfile().

## Input date formats. The three examples give the same result.
   # 1. With Julian date
        julian_olive<-star(olive,lat=olive$latitude,long=olive$longitude,
                      local.time=olive$hour,tz=olive$tz,
                      Ahmes=FALSE,ID=olive$leafID,tilt.ang=olive$tilt,horiz=TRUE,
                      course=olive$course,date=25) # January 25th
 
   # 2. With standard date
        std_olive<-star(olive,lat=olive$latitude,long=olive$longitude,
                   local.time=olive$hour,tz=olive$tz,
                   Ahmes=FALSE,ID=olive$leafID,tilt.ang=olive$tilt,horiz=TRUE,
                   course=olive$course,date="2017/01/25") # January 25th 2017.
                         # Date should be quoted. o.format is not needed.

   # 3. With non-standard date
        nonstd_olive<-star(olive,lat=olive$latitude,long=olive$longitude,
                      local.time=olive$hour,tz=olive$tz, Ahmes=FALSE,
                      ID=olive$leafID,tilt.ang=olive$tilt,horiz=TRUE,
                      course=olive$course,date="25/01/2017",o.format="%d/%m/%Y") 
               # January 25th 2017. Date should be quoted. o.format is necessary.

# star()

Calculate the silhouette to area ratio from 'Ahmes' 1.0

Description

This is a version of star() function that only works with the output of 'Ahmes' 1.0. This function calculates the percentage of potential exposure of flat, tilted surfaces to direct solar radiation. It is equivalent to the ratio of the surface projected area to total surface area, but instead of using area data it uses spatial position angles (pitch, roll and course or tilt and course), geographical coordinates, hour and date information. This function implements equation 3 in Escribano-Rocafort et al. (2014).

Usage

star.app(x, lat, long, tz)

Arguments

x

Output of 'Ahmes' 1.0, a .csv file.

lat

A vector with the latitude of each observation in decimal format. If all observations correspond to the same latitude, lat can be introduced directly as a single number (see examples).

long

A vector with the longitude of each observation in decimal format. If all observations correspond to the same longitude, long can be introduced directly as a single number (see examples).

tz

A vector with the time zone of each observation. If all observations correspond to the same time zone, tz can be introduced directly as a single number. Time zones located at the West of Greenwich are negative, and at the East are positive; e.g., for Colombia, tz = -5; for Reunion Island, tz = 4.

Details

This function calls fixfile internally before calculating STAR. However, it does not modify the original dataset. To have a permanent fixed version of the data, use new.file<-fixfile(your.data). If using new.file within the package, be aware that the argument Ahmes should be set to FALSE.

Author(s)

Agustina Ventre-Lespiaucq and Silvia Santamaria Bueno.

References

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014). Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.

See Also

fixfile, star, simu.star.app

Examples

data(olea)
  starapp_olea<-star.app(olea,lat=40,long=4,tz=2)

 ## Add results to the original dataset
  olea1<-fixfile(olea) ## Fix the original dataset
  olea2<-cbind(olea1,as.data.frame(starapp_olea))

#star.app()

Calculate the tilt angle

Description

Calculate the tilt angle of a tilted surface from pitch and roll angles.

Usage

tilt(x, Ahmes = F, ID = NULL, pitch, roll, horiz = T)

Arguments

x

A dataframe with observations in the rows and at least two spatial position angles in the columns. Data can come either from 'Ahmes' 1.0 or from measurements performed with traditional instrumentation.

Ahmes

Logical. Do data come from 'Ahmes'? Defaults to FALSE.

ID

An optional vector with the labels of the observations. Defaults to NULL.

pitch

A vector with pitch angles in degrees. See details.

roll

A vector with roll angles in degrees. See details.

horiz

Logical. Set the position of the start (zero, 0) of pitch, roll and tilt angle data. horiz = F indicates the zero is located at zenith. This is the reference system used by 'Ahmes'. horiz = T indicates the start is at the horizon. To use tilt in further calculations (star, sal...), angle data should be expressed in the horizontal reference system (0 = horizon). Defaults to TRUE.

Details

The output of tilt() is a matrix with two columns "tilt.raw" and "tilt". "tilt.raw" contains tilt values relative to the zenith. "tilt" contains tilt values relative to the horizon. The latter are used in the equations of the star() family. When horiz = T, "tilt" = "tilt.raw".

pitch values span from 0 to 180 degrees. If horiz = TRUE (default) 0 and 180 refer to the flat horizontal surface and 90 refers to the flat vertical surface. If horiz = FALSE 180 refers to the flat vertical surface and 90 refers to the flat horizontal surface.

roll values span from 0 to 180 degrees.

For a graphical explanation, see Fig. 2 in Escribano-Rocafort et al. (2014).

Author(s)

Agustina Ventre-Lespiaucq and Silvia Santamaria Bueno.

References

Escribano-Rocafort, A.G., Ventre-Lespiaucq, A.B., Granado-Yela, C., Lopez-Pintor, A., Delgado, J.A., Munoz, V., Dorado, G.A., Balaguer, L. (2014). Simplifying data acquisition in plant canopies- Measurements of leaf angles with a cell phone. Methods in Ecology and Evolution 5:132-140. doi:10.1111/2041-210X.12141.

tropical Posada, J.M., Lechowicz, M.J., Kitajima, K. (2009). Optimal photosynthetic use of light by tropical tree crowns achieved by adjustment of individual leaf angles and nitrogen content. Annals of Botany, 103: 795-805. doi:10.1093/aob/mcn265.

Examples

# Data comes from 'Ahmes'
data(olea)
    tilt_olea<-tilt(olea,Ahmes=TRUE)

 # Data comes from other sources
   data(tropical)
    tropi_tilt<-tilt(tropical,pitch=tropical$pitch,roll=tropical$roll,horiz=TRUE)
    tropical2<-cbind(tropical,as.data.frame(tropi_tilt)) 
    # When horiz = TRUE, tilt.raw = tilt!

   data(guava)
    tilt_guava<-tilt(guava,pitch=guava$pitch,roll=guava$roll,horiz=FALSE) 
    # horiz = FALSE

#tilt()

Leaf angles of tropical canopy trees measured with traditional instrumentation

Description

The tropical data frame has 41 rows and 4 columns

Usage

tropical

Format

This data frame contains the following columns:

species A code for each species (letters) and individuals (numbers)

environment Factor with three levels of exposure to solar radiation.

pitch Pitch angle in degrees.

roll Roll angle in degrees.

Details

These data are a subset of leaf angle data in Posada et al. (2009) measured with a compass and a protractor. Contains measurements of two leaf position angles of 41 leaves in two individuals of (Castilla elastica) and one of (Ficus insipida), each leaf in a row. The format of the data is an example of a field-data table handled by 'leafSTAR'.

References

tropical Posada, J.M., Lechowicz, M.J., Kitajima, K. (2009) Optimal photosynthetic use of light by tropical tree crowns achieved by adjustment of individual leaf angles and nitrogen content. Annals of Botany, 103: 795-805. doi:10.1093/aob/mcn265.