gsodReformat: Reformat list of available GSOD stations

Description Usage Arguments Value Author(s) See Also Examples

View source: R/gsodReformat.R

Description

This function is intended to reformat selected columns, i.e. elevation and coordinates, from the initial list of available GSOD stations (see ftp://ftp.ncdc.noaa.gov/pub/data/gsod/ish-history.csv). Optionally, the corresponding data.frame can then be converted to an object of class SpatialPointsDataFrame for further processing.

Usage

1
2
gsodReformat(data, elevation = TRUE, coords = TRUE,
  rm_invalid_coords = TRUE, df2sp = FALSE, ...)

Arguments

data

data.frame. Usually data("gsodstations").

elevation

Logical, default is TRUE. Determines whether elevation is converted from decimeters to meters.

coords

Logical, default is TRUE. Determines whether coordinates are converted from thousandth of a degree longitude/latitude to whole degrees.

rm_invalid_coords

Logical, default is TRUE. Determines whether records with invalid coordinates, i.e. latitudes > 90 / < -90 degree and longitude > 180 / < -180 degree, are removed from the data set. Note: if coords = FALSE, this argument will automatically be set to FALSE.

df2sp

Logical, default is FALSE. If TRUE, the list of available GSOD stations is converted from data.frame to SpatialPointsDataFrame object.

...

Additional arguments. Currently not in use.

Value

An object of class data.frame, or an object of class SpatialPointsDataFrame if df2sp = TRUE.

Author(s)

Florian Detsch

See Also

gsodDf2Sp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Load data
data(gsodstations)

# Reformat elevation and coordinates, and convert to spatial object.
gsod_shp <- gsodReformat(data = gsodstations,
                         elevation = TRUE,
                         coords = TRUE,
                         rm_invalid_coords = TRUE,
                         df2sp = TRUE)

plot(gsod_shp)

environmentalinformatics-marburg/GSODTools documentation built on May 13, 2017, 6:09 p.m.