[R] getting raster layer between December and march in 1-year raster

ahmet varlı v@r||61 @end|ng |rom w|ndow@||ve@com
Sun Jul 26 19:38:26 CEST 2020


I am using these codes but it is not work between december and march. I want to use dates for select layers  but ı dont know how ı can do

Could u help me?


dir.create(dir.out1, showWarnings = F)
dir.create(dir.out2, showWarnings = F)
dir.create(dir.out3, showWarnings = F)


for (year in 1949:2019) {
  fi <- paste0(dir.in,"soilw2_",year,".nc")
  r <- brick(fi)
  d<-rotate(r)

  ec<-extent(-179.0625, 180.9375, 0, 89.49406  )
  ed<-extent(-179.0625, 180.9375, -89.49406, 0)
  c5<-crop(d,ec)
  c5.1<-crop(d,ed)
  c6<-calc(c5[[152:243]],fun = mean)
  c7<-calc(c5.1[[152:243]],fun = mean)



  fo1 <- paste0(dir.out1,"mean.JUN-AUG.North.2_",year,".tif")
  fo2 <- paste0(dir.out2,"mean.JUN-AUG.South.2_",year,".tif")


  writeRaster(c6,file=fo1,overwrite=T)
  writeRaster(c7,file=fo2,overwrite=T)   }


Windows 10 için Posta<https://go.microsoft.com/fwlink/?LinkId=550986> ile gönderildi



More information about the R-help mailing list