Commit 834a946e authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

put on gitlab

parents
^.*\.Rproj$
^\.Rproj\.user$
.Rproj.user
.Rhistory
.RData
Package: frostr
Type: Package
Version: 0.0.1
Authors@R: c(person("Jean-Marie", "Lepioufle", , "jml@nilu.no", role=c("aut","cre")),
person("NILU",role="cph"))
Title: frostr
Description: Extracting data from frostAPI.
The Frost API provides free access to MET Norway's archive of historical weather and climate data. These data include quality controlled daily, monthly, and yearly measurements of temperature, precipitation, and wind data. Other information, like metadata about weather stations, is also available through the API.
Depends:
R (>= 3.2.3)
Imports:
ecapi
Remotes: git::git@git.nilu.no:rextapi/ecapi.git
Suggests:
knitr
License: GPL-3
Encoding: UTF-8
VignetteBuilder: knitr
LazyData: false
RoxygenNote: 5.0.1
# Generated by roxygen2: do not edit by hand
S3method(print,frostr)
export(frostr)
#' frostr
#'
#' frostr
#' @keywords frostr
#' @export
#' @examples
#' \dontrun{
#' frostr()
#' }
frostr <- function(){
frostr_object()
}
frostr_object <- function(){
client_api <- ecapi::ecapi()
client_api$url_auth("ask for the id key")
client_api$auth_type("basic")
client_api$ua("frostr-r-package")
client_api$base_url(host="https://frost.met.no",basepath="/")
client_api$add_endpoint(name = "elements",
epoint = "elements/",
question = "v0.jsonld?",
debut = "",
end = "",
syntaxe = "ids=<<ids>>&names=<<names>>&descriptions=<<descriptions>>&units=<<units>>&codeTables=<<codeTables>>&statuses=<<statuses>>&calculationMethod=<<calculationMethod>>&categories=<<categories>>&timeOffsets=<<timeOffsets>>&sensorLevels=<<sensorLevels>>&oldElementCodes=<<oldElementCodes>>&oldUnits=<<oldUnits>>&cfStandardNames=<<cfStandardNames>>&cfCellMethods=<<cfCellMethods>>&cfUnits=<<cfUnits>>&cfStatuses=<<cfStatuses>>&fields=<<fields>>"
)
client_api$add_endpoint(name = "elements_code_tables",
epoint = "elements/codeTables/",
question = "v0.jsonld?",
debut = "",
end = "",
syntaxe = "ids=<<ids>>&fields=<<fields>>&lang=<<lang>>&format=<<format>>"
)
client_api$add_endpoint(name = "observations_available_timeseries",
epoint = "observations/availableTimeSeries/",
question = "v0.jsonld?",
debut = "",
end = "",
syntaxe = "sourceID=<<sourceID>>&referencetime=<<referencetime>>&elements=<<elements>>&timeoffsets=<<timeoffsets>>&timeresolutions=<<timeresolutions>>&timeseriesids=<<timeseriesids>>&performancecategories=<<performancecategories>>&exposurecategories=<<exposurecategories>>&levels=<<levels>>&levelTypes=<<levelTypes>>&levelUnits=<<levelUnits>>&fields=<<fields>>"
)
client_api$add_endpoint(name = "observations_quality",
epoint = "observations/quality/",
question = "v0.jsonld?",
debut = "",
end = "",
syntaxe = "flags=<<flags>>&fields=<<fields>>&lang=<<lang>>&format=<<format>>"
)
client_api$add_endpoint(name = "observations_available_quality_codes",
epoint = "observations/availableQualityCodes/",
question = "v0.jsonld?",
debut = "",
end = "",
syntaxe = "lang=<<lang>>&fields=<<fields>>&format=<<format>>"
)
client_api$add_endpoint(name = "observations",
epoint = "observations/",
question = "v0.jsonld?",
debut = "",
end = "",
syntaxe = "source=<<source>>&referencetime=<<referencetime>>&elements=<<elements>>&timeoffsets=<<timeoffsets>>&timeresolutions=<<timeresolutions>>&timeseriesids=<<timeseriesids>>&performancecategories=<<performancecategories>>&exposurecategories=<<exposurecategories>>&levels=<<levels>>&fields=<<fields>>&format=<<format>>"
)
object <- local({
elements <- function(ids="",names="",descriptions="",units="",codeTables="",statuses="",calculationMethod="",categories="",timeOffsets="",sensorLevels="",oldElementCodes="",oldUnits="",cfStandardNames="",cfCellMethods="",cfUnits="",cfStatuses="",fields="",username,password,type){
client_api$verb_get(name="elements",ids=ids,names=names,descriptions=descriptions,units=units,codeTables=codeTables,statuses=statuses,calculationMethod=calculationMethod,categories=categories,timeOffsets=timeOffsets,sensorLevels=sensorLevels,oldElementCodes=oldElementCodes,oldUnits=oldUnits,cfStandardNames=cfStandardNames,cfCellMethods=cfCellMethods,cfUnits=cfUnits,cfStatuses=cfStatuses,fields=fields,out='data',username=username,password=password)
}
elements_code_tables <- function(ids="",fields="",lang="",format="",username,password,type){
client_api$verb_get(name="elements_code_tables",ids=ids,fields=fields,lang=lang,format=format,out='data',username=username,password=password)
}
observations_available_timeseries <- function(sourceID="",referencetime="",elements="",timeoffsets="",timeresolutions="",timeseriesids="",performancecategories="",exposurecategories="",levels="",levelTypes="",levelUnits="",fields="",username,password,type){
client_api$verb_get(name="observations_available_timeseries",sourceID=sourceID,referencetime=referencetime,elements=elements,timeoffsets=timeoffsets,timeresolutions=timeresolutions,timeseriesids=timeseriesids,performancecategories=performancecategories,exposurecategories=exposurecategories,levels=levels,levelTypes=levelTypes,levelUnits=levelUnits,fields=fields,out='data',username=username,password=password)
}
observations_quality <- function(flags="",fields="",lang="",format="",username,password,type){
client_api$verb_get(name="observations_quality",flags=flags,fields=fields,lang=lang,format=format,out='data',username=username,password=password)
}
observations_available_quality_codes <- function(lang="",fields="",format="",username,password,type){
client_api$verb_get(name="observations_available_quality_codes",lang=lang,fields=fields,format=format,out='data',username=username,password=password)
}
observations <- function(source,referencetime,elements,timeoffsets="",timeresolutions="",timeseriesids="",performancecategories="",exposurecategories="",levels="",fields="",format="",username,password,type){
client_api$verb_get(name="observations",source=source,referencetime=referencetime,elements=elements,timeoffsets=timeoffsets,timeresolutions=timeresolutions,timeseriesids=timeseriesids,performancecategories=performancecategories,exposurecategories=exposurecategories,levels=levels,fields=fields,format=format,out='data',username=username,password=password)
}
summary <- function(){
client_api$summary()
}
environment()
})
lockEnvironment(object, TRUE)
structure(object, class=c("frostr", class(object)))
}
#' @export
print.frostr <- function(x,...){
get("summary",x)()
}
# frostr
## Description
Extracting historical weather and climate data from the [MET Norway](http://met.no/), using the [frost API](https://frost.met.no/index.html)
These data include quality controlled daily, monthly, and yearly measurements of temperature, precipitation, and wind data.
Other information, like metadata about weather stations, is also available.
## Credentials
Get an ID through this [page](https://frost.met.no/auth/requestCredentials.html).
## Prerequisite
Install the "remotes" R-package
```R
source("https://raw.githubusercontent.com/r-lib/remotes/master/install-github.R")$value("r-lib/remotes")
```
## Installation
```R
library("remotes")
remotes::install_git("git@git.nilu.no:rextapi/frostr.git")
```
## Usage
Have a look at the vignettes
Version: 1.0
RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
Encoding: UTF-8
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
This diff is collapsed.
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/frostr.R
\name{frostr}
\alias{frostr}
\title{frostr}
\usage{
frostr()
}
\description{
frostr
}
\examples{
\dontrun{
frostr()
}
}
\keyword{frostr}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment