Skip to content

Count of Non-NA pixels in stars object

3 messages · Vijay Lulla, Micha Silver

#
Micha,
I am not sure why the function works individually but not on the stars
object. IMO, a much simpler function, at least for st_apply, of what you
are trying to do might be:

cnt_pixels1 <- function(s) { sum(!is.na(s)) }
st_apply(m_stars, MARGIN="DOY", FUN=cnt_pixels1)$cnt_pixels1

And if you wish to call this individually you will have to do
cnt_pixels1(as.array(m_stars[,,,1]$Value)) .

HTH,
Vijay.
On Sat, Oct 3, 2020 at 6:29 AM Micha Silver <tsvibar at gmail.com> wrote:

            

  
    
#
On 03/10/2020 16:32, Vijay Lulla wrote:
Excellent, thanks!