This is a short report that shows how to display gravitational anomaly of an area. The data was downloaded of International Gravimetric Bureau. See: http://bgi.omp.obs-mip.fr/data-products/Grids-and-models/wgm2012.
Mainly the raster library was used. Some functions are very interesting.
Loading important libraries.
library(raster)
## Warning: package 'raster' was built under R version 3.2.3
## Loading required package: sp
library(sp)
library(rasterVis)
## Warning: package 'rasterVis' was built under R version 3.2.3
## Loading required package: latticeExtra
## Loading required package: RColorBrewer
Reading the data in XYZ format (csv) by rasterFromXYZ function. Also defining a system coordinates. In this case, longitud and latitude.
BouguerA<- read.table(file = "C:\\xavier\\Guayaquil\\plot_bouguer_20160131020204.csv", sep = ",", header = T)
BouguerAr<-rasterFromXYZ(BouguerA, crs= NA, digits=5)
projection(BouguerAr)<-"+proj=longlat"
Plotting the data imported. Notice the use of level function of rasterVis library. The boundary country is getting of http://biogeo.ucdavis.edu/data/gadm2.8/rds/ECU_adm1.rds by getData function. Be patient ! Notice the clear trend of gravitational anomaly.
out <- getData('GADM', country='Ecuador', level=1)
levelplot(BouguerAr) + layer(sp.polygons(out))
Defining a projection and assigning it to the raster data.
UTM <- CRS("+proj=utm +zone=17 +south +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0")
BouguerAr_UTM <- projectRaster(BouguerAr, crs = UTM)
Doing an extraction of a specific study area by crop function. First, it is necessary to define the minimun and maximun East and North coordinates of the desired area.
e<-extent(559000, 619000, 9697000, 9784000)
BouguerAr_UTM_e<-crop(BouguerAr_UTM,e)
Plotting the clipped area.