How can I handle netCDF data in R in order to find average annual temperature from monthly data?

Viewed 69

I am trying to handle some climate data. I have a .nc file of data concerning latitude,longitude, time and surface temperature for each month from 01-850 to 12-1049. I need to convert these monthly data to annual and find annual average temperature for each lat,lon.

ncin <- nc_open("tas_Amon_MIROC-ES2L_past1000_r1i1p1f2_gn_085001-104912.nc")

lon <- ncvar_get(ncin,"lon")
lon <- ifelse(lon > 180, -(360 - lon), lon)

lat <- ncvar_get(ncin, "lat")

time <- format(as.Date(time, origin = ("850-1-1"), tz = "UTC"),"%Y-%m" )

tas.array <- ncvar_get(ncin,"tas")
tas.array <- tas.array - 273.15
0 Answers
Related