###################################################
# Example l #
###################################################
## Not run:
# geoplot(deg, cont = TRUE) # Plot initialized.
# geocontour(grd$lat,grd$lon,z,nlevels = 10,
# neg = FALSE,reg = reg,colors = TRUE) # Contour plot.
# geoplot(deg,pch = " ",cont = TRUE,new = TRUE) # Plot over contourplot.
# ## End(Not run)
###################################################
# Example 2 Sea Tempeture. #
###################################################
# The following data names used are in Icelandic, stodvar means
# stations and botnhiti means temperature.
geoplot()
gbplot(500)
grd <- list(lat = seq(63,67,length = 30),
lon = seq(-28,-10,length = 50))
labloc <- list(lat = c(63.95,65.4),lon = c(-19.8,-17.3))
grd1 <- geoexpand(grd) # Make grid.
grd2 <- geoinside(grd1,gbdypif.500)
grd2 <- geoinside(grd2,island,robust = FALSE,option = 2)
# Use only the points where depth < 500 and outside Iceland.
## Not run:
# #xx <- loess(botnhiti~ lat*lon,degree = 2,spaALSEn = 0.25,
# # data = stodvar, na.action = na.omit)
# # Use loess for interpolating.
#
# #grd2$temp <- predict(xx,grd2)
# #geocontour(grd2,z = grd2$temp,levels = c(0,1,2,3,4,5,6,7),
# # label.location = labloc)
#
# ######################################################
# # Example 3 example of gam() and indexes. #
# ######################################################
#
# stations<-data.frame(lat = stodvar$lat,lon = stodvar$lon,
# temp = stodvar$botnhiti)
# # Making a partial data.frame from a big one called stodvar,
# # which means stations in Icelandic.
#
# stations[1:5,] # Show first 5 lines all columns
# # in stations.
# dim(stations) # Length of (lines,colums).
# dim(stations[!is.na(stations$temp),]) # Without NAs.
# my.data <- stations[!is.na(stations$temp),]
# my.data <- my.data[!is.na(my.data$lat),]
# my.data <- my.data[!is.na(my.data$lon),]
# # my.data is now same as stations but witout NAs in lat,
# # lon and temp.
#
# pred.grid <- list(lat = seq(63.25,67.25,length = round((67.25-63.25+1)*8)),
# lon = seq(-27,-11.5,length = round((27-11.5+1)*4)))
# pred.grid <- geoexpand(pred.grid)
# # Making a grid to fit our area of interest.
# pred.grid <- geoinside(pred.grid,gbdypif.500)
# # Points within 500m.
# pred.grid <- geoinside(pred.grid,island,robust = FALSE,option = 2)
# # Points outside of Iceland.
#
# geoplot(grid = FALSE)
# my.data <- geoinside(my.data,island,robust = FALSE,option = 2)
# geopoints(my.data,pch = ".")
#
# fit <- gam(temp~lo(lat,lon,span = 0.1),data = my.data)
# # see help(gam)
# # can also do:
# # fit <- loess(temp~lon*lat,data = my.data,span = 0.1)
# # fit <- gam(temp~ns(lon,df = 7)*ns(lat,df = 5),data = my.data)
#
# pred.grid$pred.temp <- predict(fit,newdata = pred.grid)
# geocontour(pred.grid,z = pred.grid$pred.temp,levels = 0:7,
# label.location = labloc)
# ## End(Not run)
Run the code above in your browser using DataLab