Skip to content

Commit

Permalink
prefix base::format
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Sep 26, 2022
1 parent 23f606c commit 9f9a3b8
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions R/WCSCoverageSummary.R
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ WCSCoverageSummary <- R6Class("WCSCoverageSummary",
beginPosition <- env$beginPosition
endPosition <- env$endPosition
bbox <- matrix(c(
env$lowerCorner, format(env$beginPosition$value,"%Y-%m-%dT%H:%M:%S"),
env$upperCorner, format(env$endPosition$value,"%Y-%m-%dT%H:%M:%S")
env$lowerCorner, base::format(env$beginPosition$value,"%Y-%m-%dT%H:%M:%S"),
env$upperCorner, base::format(env$endPosition$value,"%Y-%m-%dT%H:%M:%S")
),length(env$lowerCorner)+1,2)
env <- GMLEnvelope$new(bbox = bbox)
env$attrs <- envattrs
Expand All @@ -458,8 +458,8 @@ WCSCoverageSummary <- R6Class("WCSCoverageSummary",
beginPosition <- env$beginPosition
endPosition <- env$endPosition
bbox <- matrix(c(
env$lowerCorner, format(env$beginPosition$value,"%Y-%m-%dT%H:%M:%S"),
env$upperCorner, format(env$endPosition$value,"%Y-%m-%dT%H:%M:%S")
env$lowerCorner, base::format(env$beginPosition$value,"%Y-%m-%dT%H:%M:%S"),
env$upperCorner, base::format(env$endPosition$value,"%Y-%m-%dT%H:%M:%S")
),length(env$lowerCorner)+1,2)
env <- GMLEnvelope$new(bbox = bbox)
env$attrs <- envattrs
Expand Down Expand Up @@ -487,8 +487,8 @@ WCSCoverageSummary <- R6Class("WCSCoverageSummary",
upperCorner <- NULL

if(is(refEnvelope, "GMLEnvelopeWithTimePeriod")){
lowerCorner <- cbind(envelope$lowerCorner, format(refEnvelope$beginPosition$value, "%Y-%m-%dT%H:%M:%S"))
upperCorner <- cbind(envelope$upperCorner, format(refEnvelope$endPosition$value, "%Y-%m-%dT%H:%M:%S"))
lowerCorner <- cbind(envelope$lowerCorner, base::format(refEnvelope$beginPosition$value, "%Y-%m-%dT%H:%M:%S"))
upperCorner <- cbind(envelope$upperCorner, base::format(refEnvelope$endPosition$value, "%Y-%m-%dT%H:%M:%S"))
}else{
if(axisLatIdx == 1 || axisLonIdx == 1){
lowerCorner <- cbind(envelope$lowerCorner, refEnvelope$lowerCorner[,3:length(refEnvelope$lowerCorner)])
Expand Down Expand Up @@ -529,9 +529,9 @@ WCSCoverageSummary <- R6Class("WCSCoverageSummary",
time <- defaultTime
}else{
if(!(time %in% timeDim$coefficients)){
error <- sprintf("The 'time' specified value is not valid. Allowed values for this coverage are [%s]",
errorMsg <- sprintf("The 'time' specified value is not valid. Allowed values for this coverage are [%s]",
paste(timeDim$coefficients, collapse=","))
self$ERROR(error)
self$ERROR(errorMsg)
stop(errorMsg)
}
}
Expand Down Expand Up @@ -603,7 +603,10 @@ WCSCoverageSummary <- R6Class("WCSCoverageSummary",
#for WCS 1.0.x / 2.x take directly the data
covfile <- NULL
if(!is.null(filename)){ covfile <- filename }else{
covfile <- WCSCoverageFilenameHandler(identifier = self$CoverageId, time = time, elevation = elevation, format = format, bbox = bbox)
covfile <- file.path(
tempdir(),
WCSCoverageFilenameHandler(identifier = self$CoverageId, time = time, elevation = elevation, format = format, bbox = bbox)
)
}
writeBin(resp, covfile)
coverage_data <- terra::rast(covfile)
Expand Down

0 comments on commit 9f9a3b8

Please sign in to comment.