getting raster layer between December and march in 1-year raster

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

getting raster layer between December and march in 1-year raster

ahmet varlı

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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: getting raster layer between December and march in 1-year raster

Ben Tupper-2
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ı <[hidden email]> 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
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.