Skip to content
Prev 29095 / 29559 Next

getting data from an nc file

Hi,

Or you can try witty terra library :

library(terra)

r <- terra::rast("chess-met_precip_gb_1km_daily_20150101-20150131.nc")
if the nc file has more than one parameters like precipitation,
temperature, humidity etc, try this:
r.sub <- terra::rast("chess-met_precip_gb_1km_daily_20150101-20150131.nc",
subds = "yourvarname")

or with raster library:
r1 <- raster::brick("chess-met_precip_gb_1km_daily_20150101-20150131.nc")
same,
r1.sub <- raster::brick("chess-met_precip_gb_1km_daily_20150101-20150131.nc",
varname  = "yourvarname")

I hope this helps.
Best,
Vlad Amihaesei
On Wed, Nov 9, 2022 at 6:49 PM ani jaya <gaaauul at gmail.com> wrote: