[R-sig-Geo] What is the Coordinate Reference System?
Sergio Ibarra
zergioib@rr@ @ending from gm@il@com
Thu Jun 14 06:03:13 CEST 2018
Greetings,
I'm want to read NetCDF spatial data from a meteorological model (WRF
model). The NetCDF can have one of these three projections:
Polar stereographic
Lambert conformal
Mercator projection
(See figure
https://user-images.githubusercontent.com/27447280/41389756-ed23f91a-6f68-11e8-961e-6ba901913c54.png
)
What is the Coordinate Reference System for each case?
Thanks!
Here an example with ncdf4 and raster:
library(ncdf4)
library(raster)
a <- tempfile()
download.file(url = "
http://www.unidata.ucar.edu/software/netcdf/examples/wrfout_v2_Lambert.nc",
destfile = a) #78 Mb
wrf <- nc_open(a)
paste("The file has",wrf$nvars,"variables")
paste("The file has",names(wrf$var))
lat <- ncvar_get( wrf, "XLAT" )
lon <- ncvar_get( wrf, "XLONG" )
t2 <- ncvar_get( wrf, "T2" ) - 273.15
dim(t2) #73 60 13
#image
image(t2[, , 12])
# raster
rt2 <- raster(t(t2[1:dim(t2)[1],
dim(t2)[2]:1,
12]),
xmn = min(lon),
xmx = max(lon),
ymn = min(lat),
ymx = max(lat),
* crs="+init=epsg:4326") # ???*
spplot(rt2)
--
Sergio Ibarra Espinosa
Post Doc
PhD in Atmospheric Sciences
Instituto de Astronomia, Geofísica e Ciências Atmosféricas
Universidade de São Paulo
Rua do Matão, 1226
São Paulo-SP - Brasil -
05508-090
+55-11-97425-3791
Skype: sergio_ibarra1
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list