From edd78becf31e707f6bf3bd95012bfa777a7155af Mon Sep 17 00:00:00 2001 From: Edzer Pebesma Date: Fri, 15 Sep 2017 17:22:13 +0200 Subject: [PATCH] update --- DESCRIPTION | 13 ++++--------- R/stars.R | 9 +++++++-- documents/stars_data.md | 8 ++++---- vignettes/first.html | 10 ++++++---- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4b60d33a..3b212fd5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,18 +14,13 @@ Imports: units, sf Suggests: + ggplot2, + ggthemes, + viridis, testthat, knitr, covr, - tibble, - dplyr, - tidyr, - geosphere (>= 1.5-5), - maptools, - maps, - ggplot2, - ggthemes, - viridis + rmarkdown LinkingTo: Rcpp VignetteBuilder: knitr SystemRequirements: GDAL (>= 2.1.0), PROJ.4 (>= 4.8.0) diff --git a/R/stars.R b/R/stars.R index 225080be..da602092 100644 --- a/R/stars.R +++ b/R/stars.R @@ -142,17 +142,22 @@ st_stars.list = function(x, ..., dimensions = NULL) { #' image(x) image.stars = function(x, ..., band = 1, attr = 1, asp = 1, rgb = NULL, maxColorValue = 1, xlab = names(dims)[1], ylab = names(dims)[2]) { + + if (any(dim(x) == 1)) + x = adrop(x) + dims = expand_dimensions(x) - x = x[[attr]] + x = unclass(x[[ attr ]]) x = if (length(dim(x)) == 3) { if (is.null(rgb)) x[ , rev(seq_len(dim(x)[2])), band] else { + stop("not yet supported") xy = dim(x)[1:2] x = structure(x[ , , rgb], dim = c(prod(xy), 3)) # flattens x/y x = rgb(x, maxColorValue = maxColorValue) # FIXME: deal with NAs dim(x) = xy - return(rasterImage(x[ , rev(seq_len(dim(x)[2]))], 0, 0, 1, 1, interpolate = FALSE)) + #return(rasterImage(x[ , rev(seq_len(dim(x)[2]))], 0, 0, 1, 1, interpolate = FALSE)) } } else x[ , rev(seq_len(dim(x)[2]))] diff --git a/documents/stars_data.md b/documents/stars_data.md index 1262e296..7514e9db 100644 --- a/documents/stars_data.md +++ b/documents/stars_data.md @@ -1,14 +1,14 @@ # An Earth data processing backend for testing and evaluating stars [Edzer Pebesma](https://github.com/edzer/), -[Michael Sumner](https://github.com/mdsumer/) +[Michael Sumner](https://github.com/mdsumner/) ## Summary The amount of freely available data generated by either direct observation from satellites or from weather or climate model calculations exceeds our capacity to download and process locally. The only feasible approach to analyse such data is to send compute jobs to cloud servers with direct access to this data, and have the small summaries (maps, time series, numbers) returned. R lacks software to analyse such datasets on compute servers, and software to serve such processes. -The [stars](https://github.com/r-spatial/stars/) project foresees in -processing such data, and doing this from a client on a remote server, without +The [stars](https://github.com/r-spatial/stars/) project will enable the +processing such data, locally as well as on a remote server, without downloading the data. This project, `stars:backend`, will (i) create software to run a back-end, (ii) develop scripts and tutorials that explain how such a data server and processing backend can be set up, and (iii) create an instance @@ -42,7 +42,7 @@ The [rOpenSci](http://ropensci.org/) project has also developed several packages As mentioned, [Google Earth Engine](https://earthengine.google.com/) provides remote processing on Tb-Pb sized dateset, but is not open source, and hence to some extent a black box. In addition, users have limited control over which data it serves, and which software it runs (e.g., it has a python interface but does not allow using numpy) -The Spatial data at the Australian Antarctic Division has [R tools](https://github.com/AustralianAntarcticDivision/raadtools) to organise large amounts of Earth science data and serve it to researchers. +The Australian Antarctic Division has [R tools](https://github.com/AustralianAntarcticDivision/raadtools) to organise large amounts of Earth science data and serve it to researchers. ## The Plan: diff --git a/vignettes/first.html b/vignettes/first.html index 56b2beba..c7db7f30 100644 --- a/vignettes/first.html +++ b/vignettes/first.html @@ -331,7 +331,7 @@

single NetCDF

nc = system.file("nc/avhrr-only-v2.19810901.nc", package = "stars")
 (x = st_stars(nc))
 ## sst, anom, err, ice,
-## stars object with 2 dimensions and 4 attributes
+## stars object with 4 dimensions and 4 attributes
 ## attribute(s):
 ##       sst              anom             err              ice        
 ##  Min.   :-1.8     Min.   :-7.8     Min.   :0.1      Min.   :0.0     
@@ -342,9 +342,11 @@ 

single NetCDF

## Max. :33.7 Max. : 4.9 Max. :1.0 Max. :1.0 ## NA's :345650 NA's :345650 NA's :345650 NA's :898285 ## dimension(s): -## from to offset delta geotransform refsys -## x 1 1440 0 0.25 0, 0.25, 0, 90, 0, -0.25 NA -## y 1 720 90 -0.25 0, 0.25, 0, 90, 0, -0.25 NA +## from to offset delta geotransform refsys +## x 1 1440 0 0.25 0, 0.25, 0, 90, 0, -0.25 NA +## y 1 720 90 -0.25 0, 0.25, 0, 90, 0, -0.25 NA +## time 1 1 1339 NA NA, NA, NA, NA, NA, NA NA +## zlev 1 1 0 NA NA, NA, NA, NA, NA, NA NA image(x)

library(units)