Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remotes and start R update #18

Merged
merged 5 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Imports:
rstac,
caret,
randomForest,
sits
sits (>= 1.4.1)
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Collate:
Expand Down
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,18 @@ RUN R -e "install.packages('devtools')"
# Install gdalcubes package
RUN R -e "install.packages('gdalcubes')"

# Install sits package
RUN R -e "install.packages('sits')"

# Install other necessary packages
# install other necessary packages
RUN apt-get install -y libsodium-dev libudunits2-dev
RUN R -e "install.packages(c('plumber', 'useful', 'ids', 'R6', 'sf', 'stars','rstac','bfast', 'geojsonsf', 'torch'))"
RUN Rscript -e "install.packages(c('plumber', 'useful', 'ids', 'R6', 'sf', 'rstac','bfast'))"

# Create directories
# create directories
RUN mkdir -p /opt/dockerfiles/ && mkdir -p /var/openeo/workspace/ && mkdir -p /var/openeo/workspace/data/

# Install packages from the local directory
# install packages from local directory
COPY ./ /opt/dockerfiles/
RUN R -e "remotes::install_local('/opt/dockerfiles', dependencies = TRUE)"
RUN Rscript -e "remotes::install_local('/opt/dockerfiles',dependencies=TRUE)"

# CMD or entrypoint for startup
CMD ["R", "-q", "--no-save", "-f", "/opt/dockerfiles/Dockerfiles/start.R"]
# cmd or entrypoint for startup
CMD ["R", "-q", "--no-save", "-f /opt/dockerfiles/Dockerfiles/start.R"]

# Expose the port
EXPOSE 8000
EXPOSE 8000
4 changes: 2 additions & 2 deletions Dockerfiles/start.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ aws.host <-Sys.getenv("AWSHOST")
if (aws.host == ""){
aws.host = NULL
}else{
message("AWS host port id is:")
message(aws.host)
message("AWS host port id is:", aws.host)

}


Expand Down
78 changes: 41 additions & 37 deletions R/Collection-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@ Collection <- R6Class(
#' @param description Short description of the collection
#'
initialize = function(id = NA, title = NA, description = NA) {

self$id = id
self$title = title
self$description = description
self$id <- id
self$title <- title
self$description <- description
},

#' @description Add image collection to the collection class object
#'
#' @param ImageCollection Collection of class 'image collection'
#'
setCollection = function(ImageCollection) {
private$imageCollection = ImageCollection
if (!gdalcubes:::is.image_collection(ImageCollection)) {
stop("Assigned data is not an image collection")
}

private$imageCollection <- ImageCollection
self$setMetadata()
},

Expand All @@ -48,10 +51,9 @@ Collection <- R6Class(
#' @description add extent and bands to the metadata of the collection object
#'
setMetadata = function() {

private$metadata = list(
private$metadata <- list(
extent = extent(private$imageCollection),
bands = NULL #gdalcubes:::libgdalcubes_image_collection_info(private$imageCollection)$bands$name
bands = gdalcubes:::libgdalcubes_image_collection_info(private$imageCollection)$bands$name
)
},

Expand All @@ -68,12 +70,11 @@ Collection <- R6Class(
#' @return converted bandlist
#'
getEoBands = function() {

list = list()
bands = as.list(self$getMetadata()$bands)
list = lapply(bands, function(x) {
append(list, list(name = x))
})
list <- list()
bands <- as.list(self$getMetadata()$bands)
list <- lapply(bands, function(x) {
append(list, list(name = x))
})
return(list)
},

Expand All @@ -88,29 +89,31 @@ Collection <- R6Class(
license = "proprietary",
extent = list(
spatial = list(
bbox = list(list(self$getMetadata()$extent$left, self$getMetadata()$extent$bottom,
self$getMetadata()$extent$right, self$getMetadata()$extent$top))
bbox = list(list(
self$getMetadata()$extent$left, self$getMetadata()$extent$bottom,
self$getMetadata()$extent$right, self$getMetadata()$extent$top
))
),
temporal = list(
interval = list(list(self$getMetadata()$extent$t0, self$getMetadata()$extent$t1))
)
),
links = list(
list(
rel = "self",
href = paste(Session$getConfig()$base_url, "collections", self$id, sep = "/")
),
list(
rel = "parent",
href = paste(Session$getConfig()$base_url, "collections", sep = "/")
))
links = list(
list(
rel = "self",
href = paste(Session$getConfig()$base_url, "collections", self$id, sep = "/")
),
list(
rel = "parent",
href = paste(Session$getConfig()$base_url, "collections", sep = "/")
)
)
)
},

#' @description List extended metadata for the collection handler
#'
collectionInfoExtended = function() {

list(
stac_version = Session$getConfig()$stac_version,
stac_extensions = list(Session$getConfig()$stac_extensions),
Expand All @@ -120,29 +123,29 @@ Collection <- R6Class(
license = "proprietary",
extent = list(
spatial = list(
bbox = list(list(self$getMetadata()$extent$left, self$getMetadata()$extent$bottom,
self$getMetadata()$extent$right, self$getMetadata()$extent$top))
bbox = list(list(
self$getMetadata()$extent$left, self$getMetadata()$extent$bottom,
self$getMetadata()$extent$right, self$getMetadata()$extent$top
))
),
temporal = list(
interval = list(list(self$getMetadata()$extent$t0, self$getMetadata()$extent$t1))
)
),
links = list(list(
rel = "root",
href = paste(Session$getConfig()$base_url, "collections", sep = "/"))
),
href = paste(Session$getConfig()$base_url, "collections", sep = "/")
)),
"cube:dimensions" = list(
x = list(
type = "spatial",
axis = "x",
extent = list(self$getMetadata()$extent$left, self$getMetadata()$extent$right
)
extent = list(self$getMetadata()$extent$left, self$getMetadata()$extent$right)
),
y = list(
type = "spatial",
axis = "y",
extent = list(self$getMetadata()$extent$bottom, self$getMetadata()$extent$top
)
extent = list(self$getMetadata()$extent$bottom, self$getMetadata()$extent$top)
),
t = list(
type = "temporal",
Expand All @@ -153,7 +156,7 @@ Collection <- R6Class(
values = list(self$getMetadata()$bands)
)
),
summaries = list(constellation = list(""), 'eo:bands' = self$getEoBands())
summaries = list(constellation = list(""), "eo:bands" = self$getEoBands())
)
}
),
Expand All @@ -164,12 +167,13 @@ Collection <- R6Class(
)

#' @export
is.Collection = function(obj) {
is.Collection <- function(obj) {
return("Collection" %in% class(obj))
}


#' collections:
#'sentinel-2-l2a
#' sentinel-2-l2a
SENTINEL_2_L2A <- Collection$new(
id = "SENTINEL-2-L2A",
title = "Sentinel 2 L2A",
Expand Down
4 changes: 2 additions & 2 deletions man/SENTINEL_2_L2A.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/eo_ml_datacube.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/ml_datacube_schema.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading