[R-sig-Geo] getting data from an nc file
Nick Wray
n|ckmwr@y @end|ng |rom gm@||@com
Wed Nov 9 11:53:45 CET 2022
Hello
I am trying to get rainfall data from the UK chess-met site
https://catalogue.ceh.ac.uk/datastore/eidchub/2ab15bf0-ad08-415c-ba64-831168be7293/precip/
and here there are a large number of nc files eg
"chess-met_precip_gb_1km_daily_20150101-20150131.nc"
I’ve found various sources on the net for opening nc files, and getting the
data but when I try instructions like
nc_data<-nc_open("chess-met_precip_gb_1km_daily_20150101-20150131.nc")
lon <- ncvar_get(nc_data, "lon")
lon
the code works but all I get is a series of element numbers and no data:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[,10] [,11] [,12]
[,13] [,14] [,15] [,16] [,17] [,18] [,19]
[,20] [,21] [,22] [,23] [,24]
And similarly for latitude
But if I open the nc file as a raster I get a raster precipitation plot of
Great Britain, which rather suggests that the lat and long values are in
there somewhere
Can anyone help with getting the actual data sets out of an nc file?
Thanks Nick Wray
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list