Skip to content
Prev 24234 / 29559 Next

proj4string error on data.frame generated from NCEP data

However, I don't understand why raster does not complain about a raster 
having an extent beyond the boundaries of its CRS.
If I do:

library(RNCEP)
library(raster)

air.sig995.extent <- NCEP.gather(variable='air.sig995', level='surface', 
months.minmax=c(7),
                                  years.minmax=c(2011), 
lat.southnorth=c(60,89.9), lon.westeast=c(-179,180),
                                  reanalysis2=FALSE, return.units=TRUE)
air.sig995.ag <- NCEP.aggregate(wx.data=air.sig995.extent, YEARS=TRUE, 
MONTHS=TRUE,
                                 DAYS=FALSE, HOURS=FALSE, fxn='mean')
air.sig995.ag.df <- NCEP.array2df(air.sig995.ag[,,1], var.names = 
'Temperature')
# Reorder columns
df <- air.sig995.ag.df[,c(2,1,3)]
r <- rasterFromXYZ(df, crs = CRS('+proj=longlat +datum=WGS84'))
r
plot(r)
writeRaster(r, '~/sandbox/arctic.tif')

everything works... (but is probably wrong)

Cheers,
Lo?c