[R-sig-Geo] working with ncdf files
Steve_Friedman at nps.gov
Steve_Friedman at nps.gov
Thu Sep 18 22:48:46 CEST 2008
Forgive the earlier post to r-help.
I'm working with a large hydrological data set stored in a netCDF format.
The file stores x and y coordinates in the UTM projected coordinate system,
yet when I use image to graphically display the z variable, the image is
distorted in the sense that it does not plot the map in the correct spatial
organization.
I'm wondering if I need to define the projection of the netCDF file with
rgdal or proj4 routines first before I send it to the graphics device.
My code is as follows:
q1_2001 <- open.ncdf("H:\\SKF_DESKTOP FILES\\My
Documents\\EDEN\\EDEN\\Surfaces\\2000_q1.nc", readunlimi=FALSE)
#opens ncdf file for reading
# gets the realinformation
wat.data2000q1 <- get.var.ncdf(q1_2001, verbose=FALSE )
# GENERAL EXAMINATION OF HEADER DATA in the wat.data file
day <- get.var.ncdf(q1_2001, "time") # length(day) 91 days in quarter
UTMx <- get.var.ncdf(q1_2001, "x") # columns (eastings) # should
return 287
UTMy <- get.var.ncdf(q1_2001, "y") # rows (northings) # should
return 405
# plot first 91 days (3 months of the year)
for(i in 1:91) {
!is.na( image(UTMx, UTMy, z = wat.data2001q1[,,i], col=brewer.pal(8,
"YlGnBu"), axes=T, pty="s", ylab="UTM Northing", xlab="UTM Easting",
main = "First Quater 2001") )
}
As I indicated above the map is displayed on the graphics device. However
the orientation is distorted pulling the x axis to wide and the y axis too
tall. How can I set the graphics device to know the orientation and
scaling (if these are the correct terms) in order to display this map
correctly?
All insights will be greatly appreciated.
Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034
Office (305) 224 - 4282
Steve_Friedman at nps.gov
More information about the R-sig-Geo
mailing list