-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added resampling method for 3 layers and updated tests #101
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,6 +325,18 @@ def get_stats_funcs(stats_func): | |
return [stats_func] | ||
|
||
|
||
def set_resampling_method(image: ee.Image, resampling_method: str): | ||
valid_raster_resampling_methods = ['bilinear', 'bicubic'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you restrict the resampling methods on the dataset level instead of in this function? I think some datasets wouldn't want these resampling method (e.g. if they're not continuous). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wherever possible, I am striving to implement as much code as possible in layer functions so that the logic does not need to be separately implemented in multiple sub-classes. As you mentioned, this function can only be used for continuous raster. I am renaming the function and adding documentation to further clarify the point. |
||
|
||
if resampling_method not in valid_raster_resampling_methods: | ||
raise ValueError(f"Invalid resampling method ('{resampling_method}'). " | ||
f"Valid methods: {valid_raster_resampling_methods}") | ||
|
||
data = image.resample(resampling_method) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how this would play into, but in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resampling needs to be specified on the images before calling XEE as far as I've found with my investigations. |
||
|
||
return data | ||
|
||
|
||
def get_image_collection( | ||
image_collection: ImageCollection, | ||
bbox: Tuple[float], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nitpick to reduce code repetition, but I think because of how GEE works, you could just do this more like
Maybe that's not any better though... your choice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, based on comment below, maybe you could just define the resampling in the Xee call and just pass it along to
get_image_collection
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I have determined, XEE does not yet directly support resampling. Resampling must instead be specified on the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a way to fully implement in the called function.