gridCSV: Grid a dataframe (or csv file) using GMT 4.5.

Description Usage Arguments Details Value

View source: R/gridCSV.R

Description

Function to grid a dataframe or csv file using GMT 4.5.

Usage

1
2
3
4
gridCSV(dfr = NULL, lat = "latitude", lon = "longitude", col = NULL,
  logtr = FALSE, xyrng = "180/205/54/62", delx = 0.5, dely = 0.25,
  blocktype = c("MEAN", "SUM"), xyzFile = file.path(getwd(), "tmpXYZ.txt"),
  tmpGrid = file.path(getwd(), "tmpGrid.xyg"), cleanup = FALSE)

Arguments

dfr

- the dataframe to grid

lat

- column name containing latitude coordinates

lon

- column name containing longitude coordinates

col

- column with value to grid

logtr

- flag (T/F) to log10-transform z values before gridding

xyrng

- GMT range string for grid limits, e.g. 'minLon/maxLon/minLat/maxLat'

delx

- grid cell size in x (longitude)

dely

- grid cell size in y (latitude)

blocktype

- blocking type for values falling inside a grid cell ('SUM' or 'MEAN')

xyzFile

- temporary file name for xyz values

tmpGrid

- temporary file name for grid values

cleanup

- flag (T/F) to remove temporary files

Details

Input dataframe is processed using GMT 4.5's 'blockmean' function using center coordinates for the output blocks as intermediate locations. These coordinates are then shifted by 0.5*cell width in the x and y directions so that the cell locations correspond to a pixel-registered grid. Converting the result to a grid using GMT 4.5's xyz2grd with pixel registration turned on (using -F) results in the expected behavior.

* note that an intermediate file 'tmp.xyg' is created and deleted during this process

Value

dataframe with the gridded values as column names 'lon','lat', and col.


wStockhausen/wtsGMT documentation built on May 3, 2019, 7:36 p.m.