How can I extract variable from Netcdf 4 files for a large region?

The Data is a NetCDF file with only one variable and 3 dimensions (lon, lat, time) of size 5 GB. I was able to extract the variables for a point coordinates, However, I will like to extract for all the lon, lat, and time.
Below is the code, I have tried:

dname <- "tmp"
ncin <- nc_open(ncfname) # open a netCDF file
lon <- ncvar_get(ncin,"longitude") #get lon and lat array
lat <- ncvar_get(ncin,"latitude")
time <- ncvar_get(ncin,"time")
lon <- ncvar_get(ncin,"longitude")

tmp_array <- ncvar_get(ncin,dname)
Error: cannot allocate vector of size 31.0 Gb

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.