I have passed some days looking for an efficient way to backup gmail.
Tried through cygwin, but then decided to go through GYB, after reading this forum.
Sweet R @ ocean
Tuesday, 15 July 2014
Thursday, 24 April 2014
learning time-series
Some learning resources for time-series analysis:
- Applied time series analysis. Pennsylvania State University.
- Introduction to quantitative methods. Colorado
- James E. Monogan III
Monday, 17 March 2014
More on coastlines
Following the great example from this example, I decided to compare the resolution for a thinner scale (Algarve area, South Portugal) of different coastlines available in R.
Created by Pretty R at inside-R.org

GADM coastal limits in orange are really nice to use in small areas. In this case, we can see the details in Ria Formosa coastal lagoon.
For altitude data we have a really nice solution, also within raster package:
Created by Pretty R at inside-R.org

Created by Pretty R at inside-R.org
Now would be cool to select the best options and do it using ggplot2.
### import data # from https://www.bodc.ac.uk/data/online_delivery/gebco/gebco_08_grid/ (requires login) # load the GEBCO bathymetry+altitude. Don't forget to change your working directory. pt.bathy = raster("gebco_08_-10_36_-6_42.nc") # plot to check it is ok: plot(pt.bathy) ### make the colour palette (copied from menugget blogg) ocean.pal <- colorRampPalette( c("#000000", "#000413", "#000728", "#002650", "#005E8C", "#0096C8", "#45BCBB", "#8AE2AE", "#BCF8B9", "#DBFBDC")) land.pal <- colorRampPalette( c("#467832", "#887438", "#B19D48", "#DBC758", "#FAE769", "#FAEB7E", "#FCED93", "#FCF1A7", "#FCF6C1", "#FDFAE0")) ## adapt the scale (copied from menugget blogg), more on our regional limits zbreaks <- seq(-800, 500, by=20) cols <-c(ocean.pal(sum(zbreaks <= 0)-1), land.pal(sum(zbreaks>0))) # Algarve detail limits: xlim=c(-8.2,-7.4), ylim=c(36.9, 37.2) # base map, with GEBCO bathymetry (small area) plot(pt.bathy, xlim=c(-8.2,-7.4), ylim=c(36.9, 37.2), asp=1, col=cols, breaks=zbreaks, legend=FALSE) # lines(coast, col=1, lwd=LWD) # Add a layer with coastline from 'word' in red (package 'mapdata') require(mapdata) map("world", col="red", xlim=c(-8.2,-7.4), ylim=c(36.9, 37.2), add=TRUE) # Add a layer with coastline from 'wordHires' in violet (package 'mapdata') map("worldHires", col="violet", xlim=c(-8.2,-7.4), ylim=c(36.9, 37.2), add=TRUE) # Add a layer with coastline from rworld in yellow (package rworld & rworldxtra library(rworldmap) require(rworldxtra) plot(getMap(resolution='high'), border="yellow", add=TRUE) # To add GADM borders package 'raster' in orange # getData('ISO3') #use this to see your country iso name
require(raster)
pt.border = getData('GADM', country=c('PT'), level=0) plot(pt.border, border="orange", add=T)
GADM coastal limits in orange are really nice to use in small areas. In this case, we can see the details in Ria Formosa coastal lagoon.
For altitude data we have a really nice solution, also within raster package:
# To add raster altitude data (for land area only, unfortunately): pt.alt = getData('alt', country=c('PT'), mask=TRUE) plot(pt.alt) #does not work because in the particular case o PT it is a list, so we need to extract only the first component. plot(pt.alt[[1]]) plot(pt.border, border="grey80", add=T)
# If we want to see a small area (Algarve): plot(pt.alt[[1]], xlim=c(-8.2,-7.4), ylim=c(36.9, 37.2), asp=1) plot(pt.border, border="grey60", add=T) # For a highler resolution of Altitude: alg.alt = getData('SRTM', lon=-8, lat=37) plot(alg.alt, xlim=c(-8.2,-7.4), ylim=c(36.9, 37.2), asp=1, ylab=c("Latitude (N)"), xlab=c("Longitude (W)")) plot(pt.border, border="grey60", add=T)
Now would be cool to select the best options and do it using ggplot2.
Subscribe to:
Comments (Atom)