% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/moon.R
\name{generate_moon_latlong}
\alias{generate_moon_latlong}
\title{Generate the atmosphere with the moon}
\usage{
generate_moon_latlong(
  datetime,
  lat,
  lon,
  filename = NA,
  albedo = 0.5,
  turbidity = 3,
  altitude = 0,
  resolution = 2048,
  number_cores = 1,
  moon_atmosphere = FALSE,
  earthshine = TRUE,
  earthshine_albedo = 0.19,
  solar_irradiance_w_m2 = 1300,
  moon_extinction_kV = 0.172,
  hosek = TRUE,
  wide_spectrum = FALSE,
  visibility = 50,
  moon_texture_width = 801,
  moon_texture_height = 801,
  verbose = FALSE
)
}
\arguments{
\item{datetime}{POSIX-compatible date-time.}

\item{lat}{Observer latitude (degrees N).}

\item{lon}{Observer longitude (degrees E; west < 0).}

\item{filename}{Default \code{NA}. Path to the image file to write.}

\item{albedo}{Default \code{0.5}. Ground albedo, range 0 to 1.}

\item{turbidity}{Default \code{3}. Atmospheric turbidity, range
1.7 to 10 (\emph{Hosek only}).}

\item{altitude}{Default \code{0}. Observer altitude (m), range
0 to 15000 (\emph{Prague only}).}

\item{resolution}{Default \code{2048}. Image height in pixels (width = 2 * height).}

\item{number_cores}{Default \code{1}. CPU threads to use.}

\item{moon_atmosphere}{Default \code{FALSE}. If \code{TRUE}, this generates atmospheric scattering from light from the moon.}

\item{earthshine}{Default \code{TRUE}. If \code{FALSE}, disable earthshine contribution on the moon.}

\item{earthshine_albedo}{Default \code{0.19}. Effective Earth albedo term used
in the earthshine irradiance approximation.}

\item{solar_irradiance_w_m2}{Default \code{1300}. Reference solar irradiance at
1 AU (W/m^2) used to normalize earthshine emission intensity.}

\item{moon_extinction_kV}{Default \code{0.172}. V-band atmospheric extinction
coefficient for direct moonlight attenuation.}

\item{hosek}{Default \code{TRUE}. \code{FALSE} selects the Prague model.}

\item{wide_spectrum}{Default \code{FALSE}. 55-channel Prague coefficients (altitude = 0m only).}

\item{visibility}{Default \code{50}. Meteorological range (km); \emph{Prague only}.}

\item{moon_texture_width}{Default \code{801}. Internal moon-texture render width.}

\item{moon_texture_height}{Default \code{801}. Internal moon-texture render height.}

\item{verbose}{Default \code{FALSE}. Whether to print progress bars/diagnostic info.}
}
\value{
Either the image array, or the array is invisibly returned if a file
is written. The array has dimensions \verb{(resolution, 2 * resolution, 4)}.
}
\description{
Note that this is just a scaled version of \code{generate_sky()}, scaled down by the luminance
of the moon as compared to the sun. This function takes the phase of the moon into account,
along with the increase in luminosity around a full moon (known as opposition surge). Moonlight
attenuation uses the Rozenberg/Krisciunas-Schaefer airmass approximation with configurable \code{moon_extinction_kV}.
}
\note{
Writing to non-EXR formats will introduce precision loss because HDR
data are quantised to the destination format, and low dynamic range outputs like PNG
and JPEG files will not represent the true luminosity values encoded in the array.
}
\examples{
\dontshow{if (interactive() || identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf}
# Moonlit sky (Hosek), mid-evening in DC
generate_moon_latlong(
  datetime = as.POSIXct("2025-09-05 19:30:00", tz = "America/New_York"),
  lat = 38.9072,
  lon = -77.0369,
  resolution = 400,
  turbidity = 3,
  verbose = TRUE
) |>
  rayimage::render_exposure(15) |>
  rayimage::plot_image()
\dontshow{\}) # examplesIf}
}
