From 8a54e574b875c3cdb639458f4967c077c3dc67d7 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Tue, 12 Mar 2024 01:02:21 +0530 Subject: [PATCH 1/3] Refactor solar_angle.R to improve readability and add documentation --- modules/data.atmosphere/R/solar_angle.R | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/modules/data.atmosphere/R/solar_angle.R b/modules/data.atmosphere/R/solar_angle.R index 80403070d65..306642ff0d3 100644 --- a/modules/data.atmosphere/R/solar_angle.R +++ b/modules/data.atmosphere/R/solar_angle.R @@ -1,14 +1,25 @@ -#' Cosine of solar zenith angle +#' Cosine of Solar Zenith Angle +#' +#' Calculates the cosine of the solar zenith angle based on the given parameters. +#' This angle is crucial in determining the amount of solar radiation reaching a point on Earth. #' #' For explanations of formulae, see https://web.archive.org/web/20180307133425/http://www.itacanet.org/the-sun-as-a-source-of-energy/part-3-calculating-solar-angles/ #' #' @author Alexey Shiklomanov -#' @param doy Day of year -#' @param lat Latitude -#' @param lon Longitude -#' @param dt Timestep -#' @param hr Hours timestep -#' @return `numeric(1)` of cosine of solar zenith angle +#' @param doy Day of year. Integer representing the day of the year (1-365). +#' @param lat Latitude in degrees. Positive for the Northern Hemisphere and negative for the Southern Hemisphere. +#' @param lon Longitude in degrees. Positive for East and negative for West. +#' @param dt Time interval in seconds. Represents the duration over which the measurement is averaged or integrated. +#' @param hr Hour of the day (0-23). Specifies the specific hour for which the calculation is made. +#' +#' @return Numeric value representing the cosine of the solar zenith angle. +#' +#' @references +#' "Understanding Solar Position and Solar Radiation" - RAMMB: [Link](https://rammb.cira.colostate.edu/wmovl/vrl/tutorials/euromet/courses/english/nwp/n5720/n5720005.htm) +#' +#' @examples +#' cos_solar_zenith_angle(doy = 150, lat = 45, lon = -93, dt = 3600, hr = 12) +#' #' @export cos_solar_zenith_angle <- function(doy, lat, lon, dt, hr) { et <- equation_of_time(doy) From 8f8cef4520bb2ca87bad8c747e8b1b9616830268 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Tue, 12 Mar 2024 10:45:16 +0530 Subject: [PATCH 2/3] Update DESCRIPTION for cos_solar_zenith_angle --- modules/data.atmosphere/DESCRIPTION | 2 +- .../man/cos_solar_zenith_angle.Rd | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/modules/data.atmosphere/DESCRIPTION b/modules/data.atmosphere/DESCRIPTION index faa34789aa3..feff1a1df10 100644 --- a/modules/data.atmosphere/DESCRIPTION +++ b/modules/data.atmosphere/DESCRIPTION @@ -79,4 +79,4 @@ Copyright: Authors LazyLoad: yes LazyData: FALSE Encoding: UTF-8 -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/modules/data.atmosphere/man/cos_solar_zenith_angle.Rd b/modules/data.atmosphere/man/cos_solar_zenith_angle.Rd index 26fdc9f3fd5..2a5565c42bf 100644 --- a/modules/data.atmosphere/man/cos_solar_zenith_angle.Rd +++ b/modules/data.atmosphere/man/cos_solar_zenith_angle.Rd @@ -2,27 +2,38 @@ % Please edit documentation in R/solar_angle.R \name{cos_solar_zenith_angle} \alias{cos_solar_zenith_angle} -\title{Cosine of solar zenith angle} +\title{Cosine of Solar Zenith Angle} \usage{ cos_solar_zenith_angle(doy, lat, lon, dt, hr) } \arguments{ -\item{doy}{Day of year} +\item{doy}{Day of year. Integer representing the day of the year (1-365).} -\item{lat}{Latitude} +\item{lat}{Latitude in degrees. Positive for the Northern Hemisphere and negative for the Southern Hemisphere.} -\item{lon}{Longitude} +\item{lon}{Longitude in degrees. Positive for East and negative for West.} -\item{dt}{Timestep} +\item{dt}{Time interval in seconds. Represents the duration over which the measurement is averaged or integrated.} -\item{hr}{Hours timestep} +\item{hr}{Hour of the day (0-23). Specifies the specific hour for which the calculation is made.} } \value{ -`numeric(1)` of cosine of solar zenith angle +Numeric value representing the cosine of the solar zenith angle. } \description{ +Calculates the cosine of the solar zenith angle based on the given parameters. +This angle is crucial in determining the amount of solar radiation reaching a point on Earth. +} +\details{ For explanations of formulae, see https://web.archive.org/web/20180307133425/http://www.itacanet.org/the-sun-as-a-source-of-energy/part-3-calculating-solar-angles/ } +\examples{ +cos_solar_zenith_angle(doy = 150, lat = 45, lon = -93, dt = 3600, hr = 12) + +} +\references{ +"Understanding Solar Position and Solar Radiation" - RAMMB: [Link](https://rammb.cira.colostate.edu/wmovl/vrl/tutorials/euromet/courses/english/nwp/n5720/n5720005.htm) +} \author{ Alexey Shiklomanov } From dc3d443eae65a02112829a0c3f4fa374bc366693 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Tue, 12 Mar 2024 18:49:55 +0530 Subject: [PATCH 3/3] Update RoxygenNote version --- modules/data.atmosphere/DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/data.atmosphere/DESCRIPTION b/modules/data.atmosphere/DESCRIPTION index feff1a1df10..faa34789aa3 100644 --- a/modules/data.atmosphere/DESCRIPTION +++ b/modules/data.atmosphere/DESCRIPTION @@ -79,4 +79,4 @@ Copyright: Authors LazyLoad: yes LazyData: FALSE Encoding: UTF-8 -RoxygenNote: 7.3.1 +RoxygenNote: 7.2.3