Hello

I am trying to extract area-averaged mean from a netcdf file using a vector. Please see my code below. I cannot figure out the commands to extract the time series of the 'precip variable' using the shapefile 'tamorbas'.

Thanks,
Prajjwal
-------------------------------------------------------------------------
require(ncdf)
library(ncdf)
require(rgdal)
library(rgdal)
library(raster)

# Read netCDF file
ncfile <- "APHRO_MA_025deg_V1003R1.2002.nc"

#Open netCDF file
nc <- open.ncdf(ncfile, missing="TRUE")

print(nc)
# Read in variables of netCDF file.
time <- get.var.ncdf(nc,varid='time')
longitude <- get.var.ncdf(nc,varid='longitude')
latitude <- get.var.ncdf(nc,varid='latitude')
precip <- get.var.ncdf(nc, varid='precip')

# Read in shapfile
Tamor <- readOGR(dsn="F:/Documents/Dropbox/Public/R/APHRO", layer= "tamorbas")


	[[alternative HTML version deleted]]

