Hi Kelly,

I like your site, looks really good.

We've also been working on facilitating visualisation & analysis of global
climate and related data as a part of the NERC Quest project in the UK, and
the rworldmap package that I've just updated is one of the outputs from
that.

I've put some code below that uses sp & rworldmap to plot your data file -
the default map it produces is pretty ugly, but it's a start.

I read in the points first using the coordinates specified in the file
rather than following your approach of creating a grid and slotting the
vector of data into it. The latter approach is vulnerable to the cells being
in different orders in the input file and for example can lead you to plot
the data upside down (I speak from experience!).

Anyway, have a look and let me know if it's useful to you.

Andy

library(rworldmap)
## Read source data file
link <- 'M:\\R\\rWorldMapNotes\\griddedData\\global_lota_map_07_36.txt'
rdf <- read.table(link, skip = 1, header=T)

# convert all 9999.0000 to NA
rdf$array.i.j.[rdf$array.i.j.==9999.0000] <- NA

## promote to SpatialPointsDataFrame
pointsDF <- rdf
coordinates(pointsDF) = c("lon", "lat")

## promote to SpatialPixelsDataFrame
pixelDF <- pointsDF
gridded(pixelDF) <- TRUE

## promote to SpatialGridDataFrame
a_rdf_sp = as(pixelDF, "SpatialGridDataFrame")

## plot the map using rworldmap
mapDevice() # to create nice map shaped window
mapGriddedData(a_rdf_sp,
nameColumnToPlot='array.i.j.',colourPalette='diverging')

	[[alternative HTML version deleted]]

