Package dggridr. August 29, 2016

Similar documents
Package OECD. R topics documented: January 17, Type Package Title Search and Extract Data from the OECD Version 0.2.

Package uptimerobot. October 22, 2015

Package retrosheet. April 13, 2015

Package ggrepel. February 8, 2016

Package LexisPlotR. R topics documented: April 4, Type Package

Package searchconsoler

Package urltools. October 11, 2015

Package MBA. February 19, Index 7. Canopy LIDAR data

Package sendmailr. February 20, 2015

Package DCG. R topics documented: June 8, Type Package

Package optirum. December 31, 2015

Package DSsim. September 25, 2015

Package decompr. August 17, 2016

Package tagcloud. R topics documented: July 3, 2015

Package SHELF. February 5, 2016

Package syuzhet. February 22, 2015

Package sjdbc. R topics documented: February 20, 2015

Guide to Viewing Maps in Google Earth

Contents. The OWRB Floodplain Viewer. Creating Maps Helpful Tips... 10

In mathematics, there are four attainment targets: using and applying mathematics; number and algebra; shape, space and measures, and handling data.

Exploring plate motion and deformation in California with GPS

Package TSfame. February 15, 2013

Package globe. August 29, 2016

Quick and Easy Web Maps with Google Fusion Tables. SCO Technical Paper

Ring of Fire. (15 minutes) Earthquakes and volcanoes occur in relationship to each other.

NEW MEXICO Grade 6 MATHEMATICS STANDARDS

Using Google Earth for Environmental Science Research

Package RIGHT. March 30, 2015

How to georectify an image in ArcMap 10

Package benford.analysis

Plotting Earthquake Epicenters an activity for seismic discovery

Detailed information about Gerber, NC Drill and NC Route.

Charlesworth School Year Group Maths Targets

Tutorial 8 Raster Data Analysis

Package packrat. R topics documented: March 28, Type Package

Lesson 15 - Fill Cells Plugin

Package jrvfinance. R topics documented: October 6, 2015

Primary Curriculum 2014

Package erp.easy. September 26, 2015

Introduction to GIS.

Package hazus. February 20, 2015

Package png. February 20, 2015

The following is an overview of lessons included in the tutorial.

Where in the World Are All the Earthquakes?

Drawing a histogram using Excel

Package hive. July 3, 2015

Numeracy Targets. I can count at least 20 objects

R Graphics Cookbook. Chang O'REILLY. Winston. Tokyo. Beijing Cambridge. Farnham Koln Sebastopol

Package GEOquery. August 18, 2015

Package bizdays. March 13, 2015

Everyday Mathematics CCSS EDITION CCSS EDITION. Content Strand: Number and Numeration

PLOTTING SURVEYING DATA IN GOOGLE EARTH

Everyday Mathematics GOALS

Completing Baseline s Site Survey Request Form

Prentice Hall Mathematics: Course Correlated to: Arizona Academic Standards for Mathematics (Grades 6)

Cabri Geometry Application User Guide

Finding location and velocity data for PBO GPS stations

Vector analysis - introduction Spatial data management operations - Assembling datasets for analysis. Data management operations

Package plan. R topics documented: February 20, 2015

Using Google Earth to Explore Plate Tectonics

Tutorial 6 GPS/Point Shapefile Creation

Everyday Mathematics. Grade 4 Grade-Level Goals CCSS EDITION. Content Strand: Number and Numeration. Program Goal Content Thread Grade-Level Goal

Three daily lessons. Year 5

Package R4CDISC. September 5, 2015

Package pxr. February 20, 2015

Everyday Mathematics. Grade 4 Grade-Level Goals. 3rd Edition. Content Strand: Number and Numeration. Program Goal Content Thread Grade-Level Goals

Package tikzdevice. February 20, 2015

Package hive. January 10, 2011

Package WikipediR. January 13, 2016

Package hoarder. June 30, 2015

EVERY DAY COUNTS CALENDAR MATH 2005 correlated to

Lab 3. GIS Data Entry and Editing.

Package wordnet. January 6, 2016

OurPCB Gerber Generation - Altium

Chapter 4: The Concept of Area

EARTHQUAKES. Compressional Tensional Slip-strike

The Keep It Simple, Steel (KISS) Standard

Package tvm. R topics documented: August 21, Type Package Title Time Value of Money Functions Version Author Juan Manuel Truppia

11 Printing Designs. When you have completed this chapter, you will be able to:

Key Stage 2 Mathematics Programme of Study

MATHS LEVEL DESCRIPTORS

Package whoapi. R topics documented: June 26, Type Package Title A 'Whoapi' API Client Version Date Author Oliver Keyes

Reading & Writing Spatial Data in R John Lewis. Some material used in these slides are taken from presentations by Roger Bivand and David Rossiter

Using GPS Data to Learn about Tectonic Plate Movement, Earthquakes, Volcanoes, and Other Applications: Ideas for Teaching

Tutorial Creating a regular grid for point sampling

Chapter 111. Texas Essential Knowledge and Skills for Mathematics. Subchapter A. Elementary

Step 3: Go to Column C. Use the function AVERAGE to calculate the mean values of n = 5. Column C is the column of the means.

1. Download Track using BaseMap if using Oregon (MapSource does not work with Oregon)

Random Map Generator v1.0 User s Guide

CAB TRAVEL TIME PREDICTI - BASED ON HISTORICAL TRIP OBSERVATION

Tallahassee Community College PERIMETER

Object systems available in R. Why use classes? Information hiding. Statistics 771. R Object Systems Managing R Projects Creating R Packages

Package fimport. February 19, 2015

Transcription:

Type Package Title Discrete Global Grids for R Version 0.1.10 Date 2016-08-16 Package dggridr August 29, 2016 Author Richard Barnes [aut, cre], Kevin Sahr [ctb], Gerald Evenden [ctb], Angus Johnson [ctb], Frank Warmerdam [ctb] Maintainer Richard Barnes <rbarnes@umn.edu> NeedsCompilation yes Depends R (>= 3.0.0), rgdal (>= 1.1), ggplot2 (>= 2.1), dplyr (>= 0.4) Suggests knitr, rmarkdown, maps, mapproj, R.rsp, testthat License MIT + file LICENCE Spatial analyses involving binning require that every bin have the same area, but this is impossible using a rectangular grid laid over the Earth or over any projection of the Earth. Discrete global grids use hexagons, triangles, and diamonds to overcome this issue, overlaying the Earth with equally-sized bins. This package provides utilities for working with discrete global grids, along with utilities to aid in plotting such data. URL https://github.com/r-barnes/dggridr/ BugReports https://github.com/r-barnes/dggridr/ RoxygenNote 5.0.1 VignetteBuilder knitr, R.rsp SystemRequirements C++11 Repository CRAN Date/Publication 2016-08-16 19:50:26 R topics documented: dgcellstogrid........................................ 2 dgconstruct......................................... 3 1

2 dgcellstogrid dgearthgrid......................................... 4 dggetres........................................... 5 dginfo............................................ 5 dgmaxcell.......................................... 6 dgquakes.......................................... 7 dgrectgrid.......................................... 7 dgrun............................................ 8 dgsetres........................................... 9 dgshptogrid......................................... 10 dgtransform......................................... 11 dgverify........................................... 11 dg_closest_res........................................ 12 dg_closest_res_to_area................................... 13 dg_closest_res_to_cls.................................... 14 dg_closest_res_to_spacing................................. 14 dg_exe_path......................................... 15 dg_process_kml....................................... 16 dg_shpfname_south_africa................................. 16 Index 17 dgcellstogrid Return boundary coordinates for specified cells Returns the coordinates constituting the boundary of a specified set of cells. Duplicates are eliminated to reduce processing and storage requirements. dgcellstogrid(, cells, frame = TRUE, wrapcells = TRUE, savegrid = FALSE) cells frame wrapcells savegrid A object from dgconstruct() The cells to get the boundaries of If TRUE, return a data frame suitable for ggplot plotting. If FALSE, return an OGR poly object Cells which cross -180/180 degrees can present difficulties for plotting. Setting this TRUE will result in cells with components in both hemispheres to be mapped entirely to positive degrees (the Eastern hemisphere). As a result, such cells will have components in the range [180,360). Only used when frame=true. If savegrid is true then a KML representation of the grid is produced and the filename returned. No other manipulations are done. Setting this true overrides all other commands.

dgconstruct 3 Returns a data frame or OGR poly object, as specified by frame. If savegrid=true, returns a filename. data(dgquakes) #Construct a grid with cells about ~1000 miles wide <- dgconstruct(spacing=1000,metric=false) dgquakes$cell <- dgtransform(,dgquakes$lat,dgquakes$lon) #Get grid cells for the earthquakes identified grid <- dgcellstogrid(, dgquakes$cell, frame=true) dgconstruct Construct a discrete global grid system () object Construct a discrete global grid system () object dgconstruct(type = "ISEA3H", res = NA, precision = 7, area = NA, spacing = NA, cls = NA, resround = "nearest", metric = TRUE, show_info = TRUE) type res Type of grid to use. Options are: ISEA3H, ISEA4H, ISEA43H, ISEA4T, ISEA4D, FULLER3H, FULLER4H, FULLER43H, FULLER4T, and FULLER4D. Default: ISEA3H Resolution. Must be in the range [0,30]. Larger values represent finer resolutions. Appropriate resolutions can be found with dg_closest_res_to_area(), dg_closest_res_to_spacing(), and dg_closest_res_to_cls(). Default is 9, which corresponds to a cell area of ~2600 sq km and a cell spacing of ~50 km. Only one of res, area, length, or cls should be used. precision Round output to this number of decimal places. Must be in the range [0,30]. Default: 7. area spacing The desired area of the grid s cells. Only one of res, area, length, or cls should be used. The desired spacing between the center of adjacent cells. Only one of res, area, length, or cls should be used.

4 dgearthgrid cls resround metric show_info The desired CLS of the cells. Only one of res, area, length, or cls should be used. What direction to search in. Must be nearest, up, or down. Whether input and output should be in metric (TRUE) or imperial (FALSE) Print the area, spacing, and CLS of the chosen resolution. Returns a object which can be passed to other dggridr functions <- dgconstruct(res=20) <- dgconstruct(area=5,metric=false) dgearthgrid Return the coordinates constituting the boundary of cells for the entire Earth Note: If you have a high-resolution grid this may take a loooooong time to execute. dgearthgrid(, frame = TRUE, wrapcells = TRUE, savegrid = FALSE) frame wrapcells savegrid A object from dgconstruct() If TRUE, return a data frame suitable for ggplot plotting. If FALSE, return an OGR poly object Cells which cross -180/180 degrees can present difficulties for plotting. Setting this TRUE will result in cells with components in both hemispheres to be mapped entirely to positive degrees (the Eastern hemisphere). As a result, such cells will have components in the range [180,360). Only used when frame=true. If savegrid is true then a KML representation of the grid is produced and the filename returned. No other manipulations are done. Setting this true overrides all other arguments. Returns a data frame or OGR poly object, as specified by frame. If savegrid=true, returns a filename.

dggetres 5 <- dgconstruct(res=20) res <- dg_closest_res_to_spacing(,spacing=1000,round='down',metric=false) <- dgsetres(,res) gridfilename <- dgearthgrid(,savegrid=true) #Save directly to a file dggetres Get table of grid resolution information Gets a grid s resolution and cell property info as a data frame. dggetres() A object from dgconstruct() A data frame containing the resolution levels, number of cells, area of those cells, intercell spacing, and characteristic length scale of the cells. All values are in kilometres. <- dgconstruct(res=20) dggetres() dginfo Print a buncha info about a object to the screen objects have many settings. This returns all of them, along with info about the grid being specified. dginfo()

6 dgmaxcell A object from dgconstruct() No return. All info is printed to the screen. <- dgconstruct(res=20) dginfo() dgmaxcell Get largest cell id for a Cells are labeled 1-N. This function returns N. This is useful if you want to choose cells from the randomly. dgmaxcell(, res = NA) res A object from dgconstruct() If NA, use the resolution specified by the. Otherwise, override the resolution. The maximum cell id. #Choose a set of cells randomly distributed over the Earth <- dgconstruct(spacing=1000, metric=false, resround='down') N <- 100 #Number of cells maxcell <- dgmaxcell() #Get maximum cell id cells <- sample(1:maxcell, N, replace=false) #Choose random cells grid <- dgcellstogrid(,cells,frame=true,wrapcells=true) #Get grid

dgquakes 7 dgquakes All earthquakes with magnitude >=3.0 earthquakes for 2015 A data frame with 19914 observations on the following 4 variables. time Time of the quake. Example: 2015-12-31T23:39:28.940Z lat Latitude of the epicenter. Example: -7.0711 lon Longitude of the epicenter. Example: -173.5178 mag Magnitude of the quake. Example: 3.2 data(dgquakes) Format data frame Source The USGS Earthquake Hazards Program (http://earthquake.usgs.gov/earthquakes/). dgrectgrid Return the coordinates constituting the boundary of cells within a specified region Note: This may generate odd results for very large rectangles, because putting rectangles on spheres is weird... as you should know, if you re using this package. dgrectgrid(, minlat = -1, minlon = -1, maxlat = -1, maxlon = -1, frame = TRUE, wrapcells = TRUE, savegrid = FALSE)

8 dgrun minlat minlon maxlat maxlon frame wrapcells savegrid A object from dgconstruct() Minimum latitude of region of interest Minimum longitude of region of interest Maximum latitude of region of interest Maximum longitude of region of interest If TRUE, return a data frame suitable for ggplot plotting. If FALSE, return an OGR poly object Cells which cross -180/180 degrees can present difficulties for plotting. Setting this TRUE will result in cells with components in both hemispheres to be mapped entirely to positive degrees (the Eastern hemisphere). As a result, such cells will have components in the range [180,360). Only used when frame=true. If savegrid is true then a KML representation of the grid is produced and the filename returned. No other manipulations are done. Setting this true overrides all other arguments. Returns a data frame or OGR poly object, as specified by frame. If savegrid=true, returns a filename. <- dgconstruct(spacing=1000,metric=false,resround='down') #Get grid cells for the conterminous United States grid <- dgrectgrid(, minlat=24.7433195, minlon=-124.7844079, maxlat=49.3457868, maxlon=-66.9513812, frame=true) dgrun A generic function for running dggrid and returning values from it A discrete global grid maps lat-long points to particular cells. These cells are uniquely numbered, for a given resolution, from 1 to some maximum number. Cell numbers may be reused from one resolution to the next. dgrun(, clean = TRUE, check = TRUE, has_output_file = TRUE)

dgsetres 9 clean check A object from dgconstruct() If TRUE, delete the temporary files used/produced by dggrid. TODO If TRUE, raise a stop signal if dggrid doesn t run successfully. has_output_file If TRUE, look for output file. If FALSE, capture and return stdout and stderr. If has_output_file is TRUE, a data frame is returned. The calling function is responsible for understanding this frame. If has_output_file is FALSE, the stdout and stderr of dggrid are captured and returned as a character vector. dgsetres Set the resolution of a object Set the resolution of a object dgsetres(, res) res A object from dgconstruct(). Resolution. Must be in the range [0,30]. Larger values represent finer resolutions. Appropriate resolutions can be found with dg_closest_res_to_area(), dg_closest_res_to_spacing(), and dg_closest_res_to_cls(). Default is 9, which corresponds to a cell area of ~2600 sq km and a cell spacing of ~50 km. Default: 9. Returns a object which can be passed to other dggridr functions <- dgconstruct(res=20) <- dgsetres(,10)

10 dgshptogrid dgshptogrid Return boundary coordinates for cells intersecting a shapefile Returns the coordinates constituting the boundary of a set of cells which intersect or are contained by a polygon (or polygons) specified in a shapefile. Note that grid cells are also generated for holes in the shapefile s polygon(s). Note that coordinates in the shapefile must be rounded to check polygon intersections. Currently this round preserves eight decimal digits of precision. The eighth decimal place is worth up to 1.1 mm of precision: this is good for charting the motions of tectonic plates and the movements of volcanoes. Permanent, corrected, constantly-running GPS base stations might be able to achieve this level of accuracy. In other words: you should be just fine with this level of precision. dgshptogrid(, shpfname, frame = TRUE, wrapcells = TRUE, savegrid = FALSE) shpfname frame wrapcells savegrid A object from dgconstruct() File name of the shapefile. Filename should end with.shp If TRUE, return a data frame suitable for ggplot plotting. If FALSE, return an OGR poly object Cells which cross -180/180 degrees can present difficulties for plotting. Setting this TRUE will result in cells with components in both hemispheres to be mapped entirely to positive degrees (the Eastern hemisphere). As a result, such cells will have components in the range [180,360). Only used when frame=true. If savegrid is true then a KML representation of the grid is produced and the filename returned. No other manipulations are done. Setting this true overrides all other commands. Returns a data frame or OGR poly object, as specified by frame. If savegrid=true, returns a filename. <- dgconstruct(spacing=25, metric=false, resround='nearest') south_africa_grid <- dgshptogrid(,dg_shpfname_south_africa)

dgtransform 11 dgtransform Converts lat-long pairs into discrete global grid cell numbers A discrete global grid maps lat-long points to particular cells. These cells are uniquely numbered, for a given resolution, from 1 to some maximum number. Cell numbers may be reused from one resolution to the next. dgtransform(, lat, lon) lat lon A object from dgconstruct(). A vector of latitudes. Same length at the longtiudes A vector of longitudes. Same length as the latitudes. A vector of the same length as latitudes and longitudes containing the cell id numbers of the points cells in the discrete grid. data(dgquakes) #Construct a grid with cells about ~1000 miles wide <- dgconstruct(spacing=1000,metric=false) dgquakes$cell <- dgtransform(,dgquakes$lat,dgquakes$lon) dgverify Verify that a object has appropriate values Verify that a object has appropriate values dgverify()

12 dg_closest_res The object to be verified The function has no return value. A stop signal is raised if the object is misspecified <- dgconstruct(res=20) dgverify() dg_closest_res Determine an appropriate grid resolution based on input data. This is a generic function that is used to determine an appropriate resolution given an area, cell spacing, or correlated length scale. It does so by extracting the appropriate length/area column and searching it for a value close to the input. dg_closest_res(, col, val, round = "nearest", show_info = TRUE, metric = TRUE) col val round show_info metric A object from dgconstruct() Column in which to search for a close value. Should be: AreaKm, SpacingKm, or CLSKm. The value to search for What direction to search in. Must be nearest, up, or down. Print the area, spacing, and CLS of the chosen resolution. Whether input and output should be in metric (TRUE) or imperial (FALSE) A number representing the grid resolution

dg_closest_res_to_area 13 ## Not run: <- dgconstruct(res=20) res <- dg_closest_res(,'areakm',1) <- dgsetres(,res) ## End(Not run) dg_closest_res_to_area Determine resolution based on desired area Determine an appropriate grid resolution based on a desired cell area. dg_closest_res_to_area(, area, round = "nearest", show_info = TRUE, metric = TRUE) area round show_info metric A object from dgconstruct() The desired area of the grid s cells What direction to search in. Must be nearest, up, or down. Print the area, spacing, and CLS of the chosen resolution. Whether input and output should be in metric (TRUE) or imperial (FALSE) A number representing the grid resolution <- dgconstruct(res=20) res <- dg_closest_res_to_area(,1) <- dgsetres(,res)

14 dg_closest_res_to_spacing dg_closest_res_to_cls Determine an appropriate grid resolution based on a desired characteristic length scale of the cells. The characteristic length scale (CLS) is the diameter of a spherical cap of the same area as a cell of the specified resolution. dg_closest_res_to_cls(, cls, round = "nearest", show_info = TRUE, metric = TRUE) cls round show_info metric A object from dgconstruct() The desired CLS of the cells. What direction to search in. Must be nearest, up, or down. Print the area, spacing, and CLS of the chosen resolution. Whether input and output should be in metric (TRUE) or imperial (FALSE) A number representing the grid resolution <- dgconstruct(res=20) res <- dg_closest_res_to_cls(,1) <- dgsetres(,res) dg_closest_res_to_spacing Determine grid resolution from desired spacing. Determine an appropriate grid resolution based on a desired spacing between the center of adjacent cells.

dg_exe_path 15 dg_closest_res_to_spacing(, spacing, round = "nearest", show_info = TRUE, metric = TRUE) spacing round show_info metric A object from dgconstruct() The desired spacing between the center of adjacent cells What direction to search in. Must be nearest, up, or down. Print the area, spacing, and CLS of the chosen resolution. Whether input and output should be in metric (TRUE) or imperial (FALSE) A number representing the grid resolution <- dgconstruct(res=20) res <- dg_closest_res_to_spacing(,1) <- dgsetres(,res) dg_exe_path Get path to dggrid executable Returns a path to the dggrid executable. Used for running stuff. dg_exe_path() A string representing the path to the dggrid executable.

16 dg_shpfname_south_africa dg_process_kml Load a KML file Clean up and/or convert a KML grid cell boundary file dg_process_kml(kmlfile, frame, wrapcells) kmlfile frame wrapcells A KML file generated by dgrectgrid() or dgearthgrid() If TRUE, return a data frame suitable for ggplot plotting. If FALSE, return an OGR poly object Cells which cross -180/180 degrees can present difficulties for plotting. Setting this TRUE will result in cells with components in both hemispheres to be mapped entirely to positive degrees (the Eastern hemisphere). As a result, such cells will have components in the range [180,360). Only used when frame=true. Returns a data frame or OGR poly object, as specified by frame dg_shpfname_south_africa National border of South Africa This variable points to a shapefile containing the national border of South Africa dg_shpfname_south_africa Format An object of class character of length 1. A filename of a shapefile containing the national border of South Africa

Index Topic datasets dg_shpfname_south_africa, 16 dgquakes, 7 dg_closest_res, 12 dg_closest_res_to_area, 13 dg_closest_res_to_cls, 14 dg_closest_res_to_spacing, 14 dg_exe_path, 15 dg_process_kml, 16 dg_shpfname_south_africa, 16 dgcellstogrid, 2 dgconstruct, 3 dgearthgrid, 4 dggetres, 5 dginfo, 5 dgmaxcell, 6 dgquakes, 7 dgrectgrid, 7 dgrun, 8 dgsetres, 9 dgshptogrid, 10 dgtransform, 11 dgverify, 11 17