average_rasters.py
def count_op(*value_nodata_list):
    """Calculate count of valid pixels over each pixel stack."""
    result = numpy.zeros(value_nodata_list[0].shape, dtype=numpy.int32)
    valid_mask = numpy.zeros(result.shape, dtype=numpy.bool)
    list_len = len(value_nodata_list)
    for array, nodata in zip(
            value_nodata_list[0:list_len//2],
            value_nodata_list[list_len//2::]):
        local_valid_mask = ~numpy.isclose(array, nodata)
        result[local_valid_mask] += 1
        valid_mask |= local_valid_mask
    result[~valid_mask] = COUNT_NODATA
    return result
Calculate count of valid pixels over each pixel stack.
Calculate count of valid pixels over each pixel stack.
Calculate count of valid pixels over each pixel stack .
def count_op(*value_nodata_list):
    result = numpy.zeros(value_nodata_list[0].shape, dtype=numpy.int32)
    valid_mask = numpy.zeros(result.shape, dtype=numpy.bool)
    list_len = len(value_nodata_list)
    for array, nodata in zip(
            value_nodata_list[0:list_len//2],
            value_nodata_list[list_len//2::]):
        local_valid_mask = ~numpy.isclose(array, nodata)
        result[local_valid_mask] += 1
        valid_mask |= local_valid_mask
    result[~valid_mask] = COUNT_NODATA
    return result
def count_op ( * value_nodata_list ) : result = numpy . zeros ( value_nodata_list [ 0 ] . shape , dtype = numpy . int32 ) valid_mask = numpy . zeros ( result . shape , dtype = numpy . bool ) list_len = len ( value_nodata_list ) for array , nodata in zip ( value_nodata_list [ 0 : list_len // 2 ] , value_nodata_list [ list_len // 2 : : ] ) : local_valid_mask = ~ numpy . isclose ( array , nodata ) result [ local_valid_mask ] += 1 valid_mask |= local_valid_mask result [ ~ valid_mask ] = COUNT_NODATA return result
Calculate count of valid pixels over each pixel stack.
Calculate count of valid pixels over each pixel stack .
"""Calculate count of valid pixels over each pixel stack."""