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

rf_resample parameters #608

Open
arind123 opened this issue May 15, 2023 · 3 comments
Open

rf_resample parameters #608

arind123 opened this issue May 15, 2023 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@arind123
Copy link

I have rasterframes version 0.11.1. When I try to use the rf_resample function:
df.select(rf_resample("proj_raster.tile", 0.25, "max")),
I get the following error:
rf_resample() takes 2 positional arguments but 3 were given
This function is supposed to take three inputs right? Or am I missing something?

@pomadchin
Copy link
Member

I guess it is a python question, then yes, it is two args function, see https://github.com/locationtech/rasterframes/blob/0.11.1/python/pyrasterframes/rasterfunctions.py#L1009-L1014:

def rf_resample(tile_col: Column_type, scale_factor: Union[int, float, Column_type]) -> Column:
    """Resample tile to different size based on scalar factor or tile whose dimension to match
    Scalar less than one will downsample tile; greater than one will upsample. Uses nearest-neighbor."""
    if isinstance(scale_factor, (int, float)):
        scale_factor = lit(scale_factor)
    return _apply_column_function("rf_resample", tile_col, scale_factor)

@pomadchin pomadchin added question Further information is requested bug When it really isn't a "feature". enhancement New feature or request and removed bug When it really isn't a "feature". labels May 15, 2023
@pomadchin
Copy link
Member

Definitely feels like it's never been exposed. You can try using Spark CQL though.

@arind123
Copy link
Author

arind123 commented May 15, 2023

So to upsampling or dowsampling is not possible using "average" in pyspark?
.. I was trying to convert a 10mt band of sentinel 2 to 20mt using this??

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

No branches or pull requests

2 participants