% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/weather.R
\name{weather}
\alias{weather}
\title{Retrieval of Weather Data  from WMO and NASA Surface meteorology and Solar Energy}
\usage{
weather(
  data = NULL,
  wmo = NULL,
  airport = NULL,
  date = "YYYY-m-d",
  time = NULL,
  latitude = NULL,
  longitude = NULL,
  NASA.SSE = list(from = "YYYY-m-d", to = "YYYY-m-d"),
  folder = NULL
)
}
\arguments{
\item{data}{dataframe that can contain all or part of the input data}

\item{wmo}{numeric. World Meteorological Organization weather station code.
You can use the  Worldwide Station List at 
\url{https://www.wunderground.com/}  [Accessed on 2016-5-6] or 
\url{https://www.wetterzentrale.de/} [Accessed on 2016-5-6]}

\item{airport}{numeric. IATA or ICAO code. They are alphabetically  listed at 
\url{https://en.wikipedia.org/wiki/List_of_airports_by_IATA_code:_A} [Accessed on 2016-5-6]}

\item{date}{date in the form of "YYYY-mm-dd" for example "2016-01-01"}

\item{time}{time in the form of "H:M" or decimal hours only. For example "14:21" or 14.35}

\item{latitude}{geographical coordinates in decimal degrees. It should be negative
for southern hemisphere}

\item{longitude}{The longitude of the measurement site 
i.e. geographical coordinates in decimal degrees for the weather station.
 It should be negative for West and positive for East.}

\item{NASA.SSE}{list of  NASA SSE data dates in the form of "YYYY-mm-dd".
For example NASA.SSE=list(from=""2001-01-01"", to="2001-04-01"). Note that SSE date
is from 1983 to 2005: 
\url{https://power.larc.nasa.gov/}
[Accessed on 2016-5-6] 
if the  parameter is not provided, date parameter will be used 
provided longitude and latitude are provided.}

\item{folder}{The path of the folder where the data can be written.}
}
\value{
WMO and NASE.SSE. The WMO contains hour and day data. The NASE.SSE contains 
meta and data. See example below.
}
\description{
The function retrieves weather data from the World Meteorological Organization
 and NASA SSE. The retrieval is based on airports  IATA or ICAO codes or WMO weather station 
 codes. The actual WMO data is from Weather Underground . Internet connection  is therefore 
 needed before data can be accessed
}
\examples{
\dontrun{
#all hours data at Lincoln Airport, Nabraska
lincoln=weather(airport = "KLNK", date="2011-08-04")
lincoln$WMO$hour
lincoln$WMO$day
#current hour data at London
london.now=weather(airport = "LON", date=format(Sys.time(), "\%Y-\%m-\%d"),
time=format(Sys.time(), "\%H:\%M"))
london.now$WMO$hour
#NASA SSE data for Kumasi, Ghana
kumasi=weather(longitude = -1.5,latitude = 6.7,NASA.SSE = list(from="2001-04-01",
to="2002-04-01"))

#Hour, daily and SSE data at JFK 
JFK=weather(airport = "JFK", date="2001-02-02",time="17:20", latitude=40.6413, 
longitude=73.7781)
JFK$WMO$hour
JFK$WMO$day
JFK$NASA.SEE$data
JFK$NASA.SEE$meta

#' #Hour, daily and SSE slice data at Kotoka International Airport, ACCRA 
accra=weather(airport = "ACC", date="2001-02-02",time="17:20", latitude=40.6413, longitude=73.7781, 
NASA.SSE=list(from="2001-01-01",to="2004-01-01"))
accra$WMO$hour
accra$WMO$hour
accra$NASA.SEE$data
accra$NASA.SEE$meta

#Using wmo code
kumasi.now=weather(wmo="65442", date=format(Sys.time(), "\%Y-\%m-\%d"),time=format(Sys.time(), 
"\%H:\%M"))
kumasi.now$WMO$hour

#retrieve daily data for a specific period i.e 1 month
lincoln=weather(airport = "KLNK", date=c("2011-08-04","2011-09-04"))
#kumasi and accra data for a time slice. May not work for different 
#geographical regions; write the results to a file
accrakumasi=weather(airport ="ACC", date=c("2011-08-04","2011-10-04"),
folder="C:/Users/george/Documents/")
}
}
\references{
\itemize{
\item Worldwide Station List.\url{https://www.wetterzentrale.de/} 
[Accessed on 2016-5-6] 
\item List of airports by IATA code. 
\url{https://en.wikipedia.org/wiki/List_of_airports_by_IATA_code} [Accessed on 2016-5-6] 
\item Weather Underground \url{https://www.wunderground.com/} [Accessed on 2016-5-6]
}
}
\author{
George Owusu
}
