hi im phd student in climatologyi have a question in r can u help me?i work with netcdf data in r,i have to calculate IVT(attached file)my data is from 1988- 2015in each year i have 1 month1-31(days) years<-c(1988:2015)for(i in 1:28) #iteration on yearsivt<-nc_open(paste("c:/users/ahoora/desktop/ivt/",years[i],".nc",sep=""),write=FALSE,readunlim = FALSE,verbose=FALSE) longitude <- ncvar_get(ivt,varid="longitude")latitude <- ncvar_get(ivt,varid="latitude")level <- ncvar_get(ivt,varid="level")time <- ncvar_get(ivt,varid="time") LonIdx <- which(ivt$dim$longitude$vals==45)LatIdx <- which(ivt$dim$latitude$vals>20 & ivt$dim$latitude$vals<35) q1<-ncvar_get(ivt,varid="q",start=c(1,1,1,1),count=c(-1,-1,1,1))q1<-q1[LonIdx,LatIdx]u1<-ncvar_get(ivt,varid="u",start=c(1,1,1,1),count=c(-1,-1,1,1))u1<-u1[LonIdx,LatIdx]v1<-ncvar_get(ivt,varid="v",start=c(1,1,1,1),count=c(-1,-1,1,1))v1<-v1[LonIdx,LatIdx]g<-9.81ivt1<- sqrt(1/g*(q1*u1*100)^2+(q1*v1*100)^2) i have 8 level from 1000 to 300for (k in 1:8){ + for (j in [1:31]){ + for (i in 1:28){
Attachment:
Doc1.docx
Description: application/vnd.openxmlformats-officedocument.wordprocessingml.document
netcdfgroup
archives: