% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/800_hours_clause_wrapper_ylt.R
\name{hours_clause_wrapper_ylt}
\alias{hours_clause_wrapper_ylt}
\title{Applies an hours clause to a long YLT stored in csv file, and returns the adjusted
YLT in memory and to a csv file}
\usage{
hours_clause_wrapper_ylt(
  ipfilename,
  settingsfilename,
  opfilename,
  nyearsinylt,
  hcdays,
  hckm,
  byregion,
  rust,
  rrrr,
  test = FALSE,
  verbose = FALSE
)
}
\arguments{
\item{ipfilename}{Input filename containing the input long YLT}

\item{settingsfilename}{Output filename for the settings output}

\item{opfilename}{Output filename containing the output YLT}

\item{nyearsinylt}{Number of years in the input YLT}

\item{hcdays}{Hours clause parameter, number of days}

\item{hckm}{Hours clause parameter, distance in km}

\item{byregion}{Whether to use regions, or distances, to measure closeness}

\item{rust}{Rust flag}

\item{rrrr}{R flag}

\item{test}{Logical, not sure what it does}

\item{verbose}{Logical, meaning obvious}
}
\value{
A data frame containing the original long YLT, and the adjusted YLTs.
}
\description{
Can be called from \code{800_hours_clause_wrapper_example}.
}
\details{
Just a pretty dumb wrapper, that writes out the settings, reads the input file, checks it,
looks at some diagnostics, calls the hours clause routine to
apply the hours clause, looks at some diagnostics, writes out the results and returns the results.
}
\examples{
#
# 1 make filenames
#
ipfilename=tempfile(fileext=".csv")
opfilename=tempfile(fileext=".csv")
settingsfilename=tempfile(fileext=".csv")
#
# 2 set the hours clause settings
#
hcdays=15
hckm=200
#
# 3 make an 8 year ylt with 10 events
#
cat("1. make longylt:\n")
nyearsinylt=8
year	=c(1	,1	,1	,2	,4	,5	,6	,7	,8	,8)
day		=c(1	,2	,51	,101,151,201,251,300,350,360)
evid	=c(1	,2	,3	,4	,5	,6	,7	,8	,9	,10)
lat		=c(10	,11	,30	,30	,30	,30	,30	,30	,30	,50)
lon		=c(10	,11	,30	,30	,30	,30	,30	,30	,30	,50)
region=c("A"	,"A"	,"B"	,"B"	,"B"	,"B"	,"B"	,"B"	,"B"	,"B")
loss	=seq(10,55,5)
longylt=data.frame(year,day,evid,lat,lon,loss,region)
write.csv(longylt,file=ipfilename,row.names=FALSE)
#
# 4 apply the hours clause and generate a new ylt
#
ylts=hours_clause_wrapper_ylt(ipfilename,settingsfilename,opfilename,nyearsinylt,
	hcdays,hckm,
	byregion=TRUE,
	rust=TRUE,rrrr=FALSE,
	test=FALSE,verbose=TRUE)
#
longylt1=ylts$longylt1
longylt2=ylts$longylt2
#
print(head(longylt1,n=6))
print(head(longylt2,n=6))
#
#
}
\author{
Stephen Jewson \email{stephen.jewson@gmail.com}
}
