Open amarbler opened 3 years ago
I've updated this to throw an error if the weighted operations are used. Can you share what you're trying to accomplish with them?
I am trying to resample precipitation data into a coarser grid and wanted to use the "weighted_mean" function instead of the "mean" to take into account that the areas of pixels within the coarser cells have different areas b/c it is a lon/lat grid.
That makes sense. I think for now you'd need to multiply the precipitation flux (fine grid) by area to convert to a precipitation amount, resample to the coarse grid using sum
, and then divide by area again to get back to a precipitation flux.
This doesn't solve the general case of weighting, but the coverage_area
argument added to exact_resample
should cover the precipitation averaging scenario you describe.
Thank you!
Hello,
I think I found a bug in the exact_resample() function. While exact_resample() accepts "weighted_mean" and "weighted_sum" as functions, it does not accept the weights argument: