grassmap: Publication quality maps with GRASS

View source: R/surfaceplot.R

grassmapR Documentation

Publication quality maps with GRASS

Description

Create publication quality maps with GRASS GIS. Only runs on Linux.

Usage

grassmap(fpath = NULL, rnge = NULL, params, mapextent = NA,
  numrow = NULL, numcol = NULL, fdir = getOption("fdir"),
  basin = "full", label_string = NULL, label_size = 21,
  labelling = TRUE, print_track = FALSE, cleanup = TRUE, rotated = TRUE)

Arguments

fpath

file.path to geotiff file

rnge

numeric string of 1, 2, or more dates dates in yyyymm format. A length 1 rnge will produce a single plot, a length 2 rnge will produce a series of plots bookended by the two dates, a rnge object with more than 2 dates will produce a series of plots exactly corresponding to the dates provided.

params

character vector of parameter fields to plot legends and color ramps are defined for sal, chlext, phycoc, and diffsal

mapextent

numeric vector of length 4. Format is bottomleft-x, topright-x, bottomleft-y, topright-y.

numrow

numeric number of rows in a multipanel

numcol

numeric number of columns in a multipanel

fdir

character file path to local data directory

basin

character basin name from fathom_basins_proj.shp

label_string

character label text

label_size

int label size

labelling

logical lablel output with yearmon?

print_track

logical print dataflow track?

cleanup

logical remove intermediate rasters and shapefiles?

rotated

logical rotate canvas to fit Florida Bay more squarely? This requires the i.rotate extension to be installed and addons configured (not working).

Details

Probably need to implement this as a seperate package to improve portability. Set param to "diffsal" to plot outpot of avmap function. Will output an imagemagick plot to the working directory and a pdf plot to the file.path(getOption("fdir"), "QGIS_Plotting") folder. The optional fpath argument only supports pointing to a single geotiff. This function can be called from the commandline using Rscript by loading the methods package and creating/loading a python 2 environment using the commands conda create –name python2 python=2 and source activate python2.

Value

output plots to the QGIS_plotting folder

Author(s)

Jemma Stachelek

Examples

## Not run: 
#list supported parameters
grassmap(rnge = c(201512), params = c("sal"))
grassmap(rnge = c(201512), params = c("diffsal"))
grassmap(rnge = c(201407), params = c("chlext"))

#multiple survey dates
grassmap(rnge = c(201509, 201512), params = c("sal"))

#exclude Card Sound
grassmap(rnge = c(201507), params = c("sal"), mapextent = c(494952.6, 564517.2, 2758908, 2799640))

#print survey track and zoom to Manatee + Barnes
grassmap(201513, "chlext", mapextent = c(557217, 567415, 2786102, 2797996), print_track = TRUE)

grassmap(rnge = 201512, params = "sal", mapextent = c(557217,
567415, 2786102, 2797996), label_string = "2015-12-01")

grassmap(rnge = c(201512), params = c("sal"), basin = "Manatee Bay")

#specify raster file directly
grassmap(fpath = file.path(getOption("fdir"), "DF_Surfaces", "200904", "sal.tif"), params = "sal")

#specify label string
grassmap(fpath = file.path("salpre.proj_mean.tif"), params = "sal", label_string = "Pre C-111")

#create a new color ramp by editing DF_Basefile/*.file and update figure makefile
logramp(n = 8, maxrange = 20) #chlext
scales::show_col(viridis::viridis_pal()(9))
logramp(n = 8, minrange = 10, maxrange = 65) #phycoc

grassmap(rnge = c(201509, 201512), params = "sal", numrow = 2, numcol = 1, labelling = FALSE)

grassmap(rnge = 201509, params = "phycoc", label_string = "phycoc test")

grassmap(rnge = c(200808, 200910), params = 'chlext', numrow = 2, numcol = 1,
labelling = TRUE, label_string = c("Aug 2008", "Oct 2009"))



## End(Not run)

jsta/DataflowR documentation built on Sept. 27, 2022, 11:13 p.m.