Skip to content

Commit

Permalink
Compress external data
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Oct 11, 2022
1 parent 1a0a673 commit b8bcb27
Show file tree
Hide file tree
Showing 32 changed files with 65 additions and 57 deletions.
27 changes: 6 additions & 21 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ preferred-citation:
abstract: Extension of the tidyverse for SpatRaster and SpatVector objects of the
terra package. It includes also new geom_ functions that provide a convenient
way of visualizing terra objects with ggplot2.
repository: https://CRAN.R-project.org/package=tidyterra
repository-code: https://github.com/dieghernan/tidyterra
url: https://dieghernan.github.io/tidyterra/
contact:
Expand Down Expand Up @@ -73,7 +74,6 @@ references:
given-names: Gábor
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=cli
version: '>= 3.0.0'
- type: software
title: crayon
Expand All @@ -84,7 +84,7 @@ references:
given-names: Gábor
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=crayon
url: https://github.com/r-lib/crayon#readme
- type: software
title: data.table
abstract: 'data.table: Extension of `data.frame`'
Expand All @@ -97,7 +97,6 @@ references:
given-names: Arun
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=data.table
- type: software
title: dplyr
abstract: 'dplyr: A Grammar of Data Manipulation'
Expand All @@ -116,7 +115,6 @@ references:
given-names: Kirill
orcid: https://orcid.org/0000-0002-1416-3412
year: '2022'
url: https://CRAN.R-project.org/package=dplyr
version: '>= 1.0.0'
- type: software
title: ggplot2
Expand Down Expand Up @@ -151,7 +149,6 @@ references:
given-names: Dewey
orcid: https://orcid.org/0000-0002-9415-4582
year: '2022'
url: https://CRAN.R-project.org/package=ggplot2
version: '>= 3.1.0'
- type: software
title: magrittr
Expand All @@ -165,7 +162,6 @@ references:
given-names: Hadley
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=magrittr
- type: software
title: rlang
abstract: 'rlang: Functions for Base Types and Core R and ''Tidyverse'' Features'
Expand All @@ -178,7 +174,6 @@ references:
given-names: Hadley
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=rlang
- type: software
title: scales
abstract: 'scales: Scale Functions for Visualization'
Expand All @@ -190,7 +185,6 @@ references:
- family-names: Seidel
given-names: Dana
year: '2022'
url: https://CRAN.R-project.org/package=scales
- type: software
title: sf
abstract: 'sf: Simple Features for R'
Expand All @@ -201,7 +195,6 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0001-8049-7069
year: '2022'
url: https://CRAN.R-project.org/package=sf
version: '>= 1.0.0'
- type: software
title: terra
Expand All @@ -213,7 +206,7 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0001-5872-2872
year: '2022'
url: https://CRAN.R-project.org/package=terra
url: https://rspatial.org/terra/
version: '>= 1.5-12'
- type: software
title: tibble
Expand All @@ -227,7 +220,6 @@ references:
given-names: Hadley
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=tibble
version: '>= 3.0.0'
- type: software
title: tidyr
Expand All @@ -240,7 +232,6 @@ references:
- family-names: Girlich
given-names: Maximilian
year: '2022'
url: https://CRAN.R-project.org/package=tidyr
version: '>= 1.0.0'
- type: software
title: isoband
Expand All @@ -257,7 +248,7 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0002-5147-4711
year: '2022'
url: https://CRAN.R-project.org/package=isoband
url: https://wilkelab.org/isoband/
- type: software
title: knitr
abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
Expand All @@ -268,7 +259,7 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0003-0645-5666
year: '2022'
url: https://CRAN.R-project.org/package=knitr
url: https://yihui.org/knitr/
- type: software
title: lifecycle
abstract: 'lifecycle: Manage the Life Cycle of your Package Functions'
Expand All @@ -282,7 +273,6 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0003-4757-117X
year: '2022'
url: https://CRAN.R-project.org/package=lifecycle
- type: software
title: maptiles
abstract: 'maptiles: Download and Display Map Tiles'
Expand All @@ -293,7 +283,7 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0002-1932-3323
year: '2022'
url: https://CRAN.R-project.org/package=maptiles
url: https://github.com/riatelab/maptiles/
- type: software
title: rmarkdown
abstract: 'rmarkdown: Dynamic Documents for R'
Expand Down Expand Up @@ -332,7 +322,6 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0003-3925-190X
year: '2022'
url: https://CRAN.R-project.org/package=rmarkdown
- type: software
title: s2
abstract: 's2: Spherical Geometry Operators Using the S2 Geometry Library'
Expand All @@ -350,7 +339,6 @@ references:
given-names: Ege
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=s2
- type: software
title: testthat
abstract: 'testthat: Unit Testing for R'
Expand All @@ -360,7 +348,6 @@ references:
given-names: Hadley
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=testthat
version: '>= 3.0.0'
- type: software
title: tidyverse
Expand All @@ -371,7 +358,6 @@ references:
given-names: Hadley
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=tidyverse
- type: software
title: vdiffr
abstract: 'vdiffr: Visual Regression Testing and Graphical Diffing'
Expand All @@ -394,4 +380,3 @@ references:
given-names: Vaudor
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=vdiffr
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

- Add new function `stat_spatraster()`.

- Reduce the size of external files.

# tidyterra 0.2.2

- Changes on how **dplyr**, **tibble** and **tidyr** are attached. Now these
Expand Down
1 change: 1 addition & 0 deletions R/as_tibble.Spat.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#' @seealso [tibble::as_tibble()], [terra::as.data.frame()]
#'
#' @family coerce
#' @family tibble.methods
#'
#' @section terra equivalent:
#'
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ install.packages("tidyterra")
You can install the development version of {tidyterra} like so:

``` r

remotes::install_github("dieghernan/tidyterra")
```

Expand Down Expand Up @@ -147,6 +148,7 @@ ggplot() +

``` r


# Create maximum differences

variation <- rastertemp %>%
Expand Down Expand Up @@ -182,6 +184,7 @@ ggplot() +
{ggplot2}

``` r

f_tile <- system.file("extdata/cyl_tile.tif", package = "tidyterra")

rgb_tile <- rast(f_tile)
Expand All @@ -196,6 +199,7 @@ ggplot() +
<img src="https://raw.githubusercontent.com/dieghernan/tidyterra/main/img/README-example-tile-1.png" width="100%" />

``` r

# Recognizes coord_sf()

ggplot() +
Expand All @@ -212,6 +216,7 @@ ggplot() +
{ggplot2}:

``` r

asia <- rast(system.file("extdata/asia.tif", package = "tidyterra"))

terra::plot(asia)
Expand All @@ -220,6 +225,7 @@ terra::plot(asia)
<img src="https://raw.githubusercontent.com/dieghernan/tidyterra/main/img/README-hypso-1.png" width="100%" />

``` r

ggplot() +
geom_spatraster(data = asia) +
scale_fill_hypso_tint_c(
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.2.1 (2022-06-23 ucrt)",
"runtimePlatform": "R version 4.2.1 (2022-06-23)",
"author": [
{
"@type": "Person",
Expand Down Expand Up @@ -325,7 +325,7 @@
},
"SystemRequirements": null
},
"fileSize": "3291.684KB",
"fileSize": "2868.418KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
32 changes: 24 additions & 8 deletions data-raw/asia.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,35 @@
asiaraw <- terra::rast("data-raw/asia.tif")
template <- terra::project(asiaraw, "epsg:3857")
terra::ncell(template)
template <- terra::spatSample(template, 250000, method = "regular", as.raster = TRUE)
template <- terra::spatSample(template, 100000, method = "regular", as.raster = TRUE)
terra::ncell(template)

asia <- terra::project(asiaraw, template)
asia <- terra::project(asiaraw, template, method = "cubic")
asiaraw
asia

terra::plot(asia)

devtools::load_all()
# library(ggplot2)
#
# ggplot() +
# geom_spatraster(data=asia) +
# scale_fill_cpt_city_c(palette = "etopo1", as_tint = TRUE)
library(ggplot2)

ggplot() +
geom_spatraster(data = asia) +
scale_fill_hypso_tint_c(
palette = "gmt_globe",
labels = scales::label_number(),
breaks = c(-10000, -5000, 0, 2500, 5000, 8000),
guide = guide_colorbar(
direction = "horizontal",
title.position = "top",
barwidth = 20
)
) +
labs(
fill = "elevation (m)",
title = "Hypsometric map of Asia"
) +
theme_minimal() +
theme(legend.position = "bottom")

unlink("inst/extdata/asia.tif")
terra::writeRaster(asia, "inst/extdata/asia.tif")
4 changes: 3 additions & 1 deletion data-raw/cyl-gpkg.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ ggplot() +
library(maptiles)

cyl_sf <- st_as_sf(cyl) %>% st_transform(3857)
tile <- get_tiles(cyl_sf, crop = TRUE)
sf::st_crs(cyl_sf)
tile <- get_tiles(cyl_sf, crop = TRUE, verbose = TRUE, zoom = 7)
terra::plotRGB(tile)

unlink("inst/extdata/cyl_tile.tif")
writeRaster(tile, "inst/extdata/cyl_tile.tif")
Binary file modified data/cross_blended_hypsometric_tints_db.rda
Binary file not shown.
Binary file modified data/hypsometric_tints_db.rda
Binary file not shown.
Binary file modified img/README-example-temp-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-example-temp-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-example-tile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-example-tile-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-hypso-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-hypso-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified inst/extdata/asia.tif
Binary file not shown.
14 changes: 4 additions & 10 deletions inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,14 @@
],
"description": "Extension of the 'tidyverse' for 'SpatRaster' and 'SpatVector' objects of the 'terra' package. It includes also new 'geom_' functions that provide a convenient way of visualizing 'terra' objects with 'ggplot2'.",
"license": "https://spdx.org/licenses/MIT",
"name": "tidyterra: 'tidyverse' Methods and 'ggplot2' Utils for 'terra' Objects",
"name": "tidyterra: 'tidyverse' Methods and 'ggplot2' Helpers for 'terra' Objects",
"programmingLanguage": {
"type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"provider": {
"id": "https://cran.r-project.org",
"type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.2.0 (2022-04-22)",
"version": "0.2.1.9000"
"runtimePlatform": "R version 4.2.1 (2022-06-23)",
"version": "0.3.0"
},
{
"id": "https://doi.org/10.5281/zenodo.6572471",
Expand All @@ -51,7 +45,7 @@
"familyName": "Hernangómez",
"givenName": "Diego"
},
"name": "{tidyterra}: tidyverse Methods and ggplot2 Utils for terra Objects"
"name": "{tidyterra}: tidyverse Methods and ggplot2 Helpers for terra Objects"
}
]
}
1 change: 1 addition & 0 deletions man/as_tibble.Spat.Rd

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

1 change: 1 addition & 0 deletions man/roxygen/meta.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
list(
rd_family_title = list(
coerce = "Coercing objects:",
tibble.methods = "Other tibble methods:",
dplyr.methods = "Other dplyr methods:",
tidyr.method = "Other tidyr methods:",
ggplot2.utils = "Other ggplot2 utils:",
Expand Down
Loading

0 comments on commit b8bcb27

Please sign in to comment.