Apply
mmann1123 opened this issue · 2 comments
mmann1123 commented
How would we pass arguments to the apply function? For instance if we want to change the
count to 1?
import geowombat as gw
# Function with one argument
def user_func(block, n):
return block * n
with gw.open('input.tif') as ds:
# Functions are given as 'apply'
ds.attrs['apply'] = user_func
# Function arguments (n) are given as 'apply_args'
ds.attrs['apply_args'] = [10.0]
ds.gw.save(
'output.tif',
num_workers=2,
overwrite=True,
compress='lzw'
)
jgrss commented
Hi @mmann1123, the apply()
method was written for to_raster()
, so it won't be supported with save()
.
mmann1123 commented
Ok thanks!