Dear R users,
I need to produce rainfall maps using R.
I know that this is possible, I looked though the web, I found the example 
below reported (the author is Andrew Tredennick).
I would ask you if this is the most performing way to make rainfall maps; if 
yes would someone be able to give me an example of how file.asc and 
pointfile.csv should be? If no would somebody please show me another way 
providing a small example?

Thank you for your help
Stefano


library(raster)
library(ggplot2)

#open ASCII file using �raster� command, which converts the ASCII to a raster 
object
map <- raster(�/your/path/to/file.asc�)

#convert the raster to points for plotting
map.p <- rasterToPoints(map)

#Make the points a dataframe for ggplot
df <- data.frame(map.p)
#Make appropriate column headings
colnames(df) <- c(�Longitude�, �Latitude�, �MAP�)

#Call in point data, in this case a fake transect (csv file with lat and lon 
coordinates)
sites <- data.frame(read.csv(�/your/path/to/pointfile.csv�))

#Now make the map
ggplot(data=df, aes(y=Latitude, x=Longitude)) +
geom_raster(aes(fill=MAP)) +
geom_point(data=sites, aes(x=x, y=y), color=�white�, size=3, shape=4) +
theme_bw() +
coord_equal() +
scale_fill_gradient(�MAP (mm/yr)�, limits=c(0,2500)) +
theme(axis.title.x = element_text(size=16),
axis.title.y = element_text(size=16, angle=90),
axis.text.x = element_text(size=14),
axis.text.y = element_text(size=14),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = �right�,
legend.key = element_blank()
)



         (oo)
--oOO--( )--OOo----------------
Stefano Sofia PhD
Area Meteorologica e  Area nivologica - Centro Funzionale
Servizio Protezione Civile - Regione Marche
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: stefano.so...@regione.marche.it
---Oo---------oO----------------

________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica pu� contenere 
informazioni confidenziali, pertanto � destinato solo a persone autorizzate 
alla ricezione. I messaggi di posta elettronica per i client di Regione Marche 
possono contenere informazioni confidenziali e con privilegi legali. Se non si 
� il destinatario specificato, non leggere, copiare, inoltrare o archiviare 
questo messaggio. Se si � ricevuto questo messaggio per errore, inoltrarlo al 
mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi 
dell�art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessit� ed 
urgenza, la risposta al presente messaggio di posta elettronica pu� essere 
visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by 
persons entitled to receive the confidential information it may contain. E-mail 
messages to clients of Regione Marche may contain information that is 
confidential and legally privileged. Please do not read, copy, forward, or 
store this message unless you are an intended recipient of it. If you have 
received this message in error, please forward it to the sender and delete it 
completely from your computer system.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to