Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply #275

Closed
mmann1123 opened this issue Jun 9, 2023 · 2 comments
Closed

Apply #275

mmann1123 opened this issue Jun 9, 2023 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@mmann1123
Copy link
Collaborator

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'
    )
@mmann1123 mmann1123 added the question Further information is requested label Jun 9, 2023
@jgrss
Copy link
Owner

jgrss commented Jul 1, 2023

Hi @mmann1123, the apply() method was written for to_raster(), so it won't be supported with save().

@mmann1123
Copy link
Collaborator Author

Ok thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants