ahmet varlı
2020-Jul-26 17:38 UTC
[R] getting raster layer between December and march in 1-year raster
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
Ben Tupper
2020-Jul-28 13:02 UTC
[R] getting raster layer between December and march in 1-year raster
Hi, I encourage you to subscribe the r-sig-geo mailing list for questions regarding geospatial data handling. Subscribe here... https://stat.ethz.ch/mailman/listinfo/r-sig-geo While you have shown your code, you have been very specific about what the issue is and how you know it is not working. Without more information, it really isn't possible for anyone not sitting at your computer to diagnose the issue you are having. Can you make a reproducible example that shows the problem? Best wishes, Ben On Tue, Jul 28, 2020 at 3:25 AM ahmet varl? <varli61 at windowslive.com> wrote:> > 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 > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Ben Tupper Bigelow Laboratory for Ocean Science East Boothbay, Maine http://www.bigelow.org/ https://eco.bigelow.org [[alternative HTML version deleted]]