Spatial Analysis and Visualization of Climate Data Using R David - - PowerPoint PPT Presentation

spatial analysis and visualization of climate data using r
SMART_READER_LITE
LIVE PREVIEW

Spatial Analysis and Visualization of Climate Data Using R David - - PowerPoint PPT Presentation

Spatial Analysis and Visualization of Climate Data Using R David Sathiaraj NOAA Southern Regional Climate Center Louisiana State University ACIS ACIS - Applied Climate Information System (www.rcc-acis.org) Provides Storage, Access and


slide-1
SLIDE 1

Spatial Analysis and Visualization of Climate Data Using R

David Sathiaraj NOAA Southern Regional Climate Center Louisiana State University

slide-2
SLIDE 2
slide-3
SLIDE 3

ACIS

  • ACIS - Applied Climate Information System

(www.rcc-acis.org)

  • Provides Storage, Access and Analysis of

Climate Data

  • 3 layer abstracted architecture - comprises
  • f station meta data, climate data and

derived product layers

  • Data Source for generating maps
slide-4
SLIDE 4

Disk Disk Disk Data Sets Metadata

QC

Products

Real Time Feed Data Synchronization

slide-5
SLIDE 5

Why R?

  • Simple data structures
  • Robust matrix computations
  • Spatial libraries
  • Visualization tools
slide-6
SLIDE 6

Map Generation Tools

  • Color Selection - RColorBrewer
  • Masking - sp
  • Map Projection - mapproj
  • Fitting and Modeling - fields, sp
slide-7
SLIDE 7

Mapping Climate Divisions

  • Climate divisions shape file

usdiv = readShapePoly(“divisions.shp”) plot(usdiv,col=brewer.pal(11, `Spectral’)

  • Get a subset of climate divisions
  • Choose Color (based on climate

data)

  • Plot and Draw legend

!!"# !!!# !!## !$# !%# !&# "# '# (# )#

slide-8
SLIDE 8

Mapping Climate Divisions

  • Get a subset of climate divisions
  • Using subset command in R
  • Choose Color (based on climate

data)

  • Plot and Draw legend

!!"# !!"" !$# !$" !%# &# '" '# ("

slide-9
SLIDE 9

Mapping Climate Divisions

  • Choose Color (based on

climate data)

  • colours <-

brewer.pal(nclr,"RdYlGn")

  • ratio<-(max(prcp)-min(prcp))/nclr
  • brks<-

round(seq(min(prcp),max(prcp), by=ratio),digits=0)

  • colorIndx <- findInterval(prcp,

brks, all.inside=T)

  • Plot and Draw legend

!!"# !!"" !$# !$" !%# &# '" '# (" )*+,-./01 )2.-./01

2005 Prcp Total: SRCC Divisions

slide-10
SLIDE 10

Mapping Climate Divisions

  • Plot and Draw legend
  • plot(srccdiv_shp,

col=colours[colorIndx], xlab="Longitude", ylab="Latitude")

  • title("2005 Prcp Total: SRCC

Divisions")

  • legend(-87.5, 30,

legend=leglabs(brks), fill=colours, cex=1, bty="o")

!!"# !!"" !$# !$" !%# &# '" '# (" )*+,-./01 )2.-./01

2005 Prcp Total: SRCC Divisions

/+0134!% !%4!4&' &'4!4&$ &$4!4'( '(4!4(" ("4!4(# (#4!4#" #"4!4#5 *6134#5

slide-11
SLIDE 11

!!"# !!"" !$# !$" !%# &# '" '# (" )*+,-./01 )2.-./01

2005 Prcp Total: SRCC Divisions

/+0134!% !%4!4&' &'4!4&$ &$4!4'( '(4!4(" ("4!4(# (#4!4#" #"4!4#5 *6134#5

slide-12
SLIDE 12

Surface Fitting

  • Fields package in R
  • krig.image (from fields)
  • tim.colors (from fields)
  • Masking Routine
  • Map projection
slide-13
SLIDE 13

Kriging using fields

fit=krig.image(xy,z,cov.function=Exp.image.cov,m=mx,n=nx,lambda=0.01, kmax=1000,expand=1.2) res<- predict( fit, fit$xM) - fit$yM img=list(fit$surface$x,fit$surface$y,fit$surface$z) proj_pts = mapproject(list(x=img$x,y=img$y),projection="mercator") proj_img = list(x=proj_pts$x,y=proj_pts$y,z=img$z) proj_img = mask(proj_img) image.plot(proj_img,col=rev(tim.colors(64)),xlab='Longitude',ylab='La titude',add=1,projection="",horizontal=1)

slide-14
SLIDE 14

Masking

  • Pass the array of fitted points to the masking routine
  • Find which points lie ‘inside’ the polygon(I) and which lie

‘outside’ (O) - ‘inout’ method in the ‘sp’ package

  • Nullify the ‘outside’ points, O
  • one possibility is assign their ‘z’ values to NA
  • Return the array comprising of nullified outside points, O and

‘inside’ points, I

slide-15
SLIDE 15
  • −95

−94 −93 −92 −91 −90 −89 32 33 34 35 36 37 Longitude Latitude

slide-16
SLIDE 16
slide-17
SLIDE 17
slide-18
SLIDE 18
slide-19
SLIDE 19
slide-20
SLIDE 20

Baton Rouge Ryan Airport

Temperature [F]

01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15

Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

30 40 50 60 70 80 90 100 Precipitation [in]

01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15 01 15

Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

2007

10 20 30 40 50 60

Charts using R