From 2bfe435ea947929142d4438844444332f641c571 Mon Sep 17 00:00:00 2001 From: Hollos Roland Date: Wed, 18 Dec 2019 14:05:49 +0100 Subject: [PATCH] weather downloader --- RBBGCMuso/NAMESPACE | 2 +- RBBGCMuso/R/getMeteoData1.R | 14 +++++---- RBBGCMuso/man/getMeteoData1.Rd | 52 ---------------------------------- 3 files changed, 10 insertions(+), 58 deletions(-) delete mode 100644 RBBGCMuso/man/getMeteoData1.Rd diff --git a/RBBGCMuso/NAMESPACE b/RBBGCMuso/NAMESPACE index 84fbaee..219bca4 100644 --- a/RBBGCMuso/NAMESPACE +++ b/RBBGCMuso/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +export(ERA5MTClimCreator) export(calibMuso) export(changeMusoC) export(checkMeteoBGC) @@ -7,7 +8,6 @@ export(cleanupMuso) export(compareMuso) export(copyMusoExampleTo) export(corrigMuso) -export(getMeteoData1) export(getyearlycum) export(getyearlymax) export(mtclim) diff --git a/RBBGCMuso/R/getMeteoData1.R b/RBBGCMuso/R/getMeteoData1.R index 709031c..1e2ca9d 100644 --- a/RBBGCMuso/R/getMeteoData1.R +++ b/RBBGCMuso/R/getMeteoData1.R @@ -1,4 +1,4 @@ -#' getMeteoData1 +#' ERA5MTClimCreator #' #' This function downloads hourly 2m air temperature and total precipitation values in NetCDF file format #' at one grid point to create MTClim files which contain daily data. @@ -22,7 +22,7 @@ #' @importFrom tcltk tk_choose.dir tk_choose.files #' @export -getMeteoData1 <- function(startYear=2017, endYear=2017, lon=18.8, lat=47.3, timeOut=7200, +ERA5MTClimCreator <- function(startYear=2017, endYear=2017, lon=18.8, lat=47.3, timeOut=7200, monthList=sprintf("%02d",1:12), dayList=sprintf("%02d",1:31), hourList=sprintf("%02d:00",0:23), @@ -43,9 +43,13 @@ getMeteoData1 <- function(startYear=2017, endYear=2017, lon=18.8, lat=47.3, time # print("Please choose the file in the pop-up window which contains the CDS API key.") # With tk_choose.files, it is not working in R Server. - # if(is.null(apiFile)){ - # apiFile <- tk_choose.files(caption = "Please choose the file which contains the CDS API key.") - # } + if(is.null(apiFile)){ + apiFile <- tk_choose.files(caption = "Please choose the file which contains the CDS API key.") + } + + if(is.null(fileDir)){ + apiFile <- tk_choose.files(caption = "Please choose the fileDir.") + } apiCodes <- suppressWarnings(readLines(apiFile)[2]) apiCodes <- unlist(strsplit(apiCodes,split=":")) diff --git a/RBBGCMuso/man/getMeteoData1.Rd b/RBBGCMuso/man/getMeteoData1.Rd deleted file mode 100644 index 8ccf89a..0000000 --- a/RBBGCMuso/man/getMeteoData1.Rd +++ /dev/null @@ -1,52 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getMeteoData1.R -\name{getMeteoData1} -\alias{getMeteoData1} -\title{getMeteoData1} -\usage{ -getMeteoData1( - startYear = 2017, - endYear = 2017, - lon = 18.8, - lat = 47.3, - timeOut = 7200, - monthList = sprintf("\%02d", 1:12), - dayList = sprintf("\%02d", 1:31), - hourList = sprintf("\%02d:00", 0:23), - destDir = NULL, - apiFile = NULL, - fileDir = NULL -) -} -\arguments{ -\item{startYear}{Start year of the downloading data. It shall be greater than 1978.} - -\item{endYear}{End year of the downloading data. It shall be smaller than 2019.} - -\item{lon}{Geographical longitude of the selected grid point (negative values: W, positive values: E). It shall be between -180 and 180. The value is rounded to two decimal places.} - -\item{lat}{Geographical latitude of the selected grid point (negative values: S, positive values: N). It shall be between -90 and 90. The value is rounded to two decimal places.} - -\item{timeOut}{Time in seconds to wait to download from Copernicus.} - -\item{monthList}{Month selector (e.g. to download data for April then write "01", to download data for September and October then write c("04","05")} - -\item{dayList}{Day selector (e.g. to download data for the 1st day of the month(s) then write "01", to download data for the 2nd and 4th day of the month then write c("02","04")} - -\item{hourList}{Hour selector (e.g. to download data for 00 UTC then write "00:00", to download data for 01 UTC and 15 UTC then write c("01","15")} - -\item{destDir}{Directory where the mtc43 file will be created. If it is NULL then destDir is the same as fileDir.} - -\item{apiFile}{Directory where the cdsapirc file is located} - -\item{fileDir}{Directory where the .ini and .mtcin files will be created} -} -\description{ -This function downloads hourly 2m air temperature and total precipitation values in NetCDF file format -at one grid point to create MTClim files which contain daily data. -Please note that, to download ERA5, you need Copernicus registration and API key. -According to default settings, data will be downloaded in the gridpoint of Martonvasar (Hungary), in 2017. -} -\author{ -Erzsebet Kristof, Roland Hollos -}