-
Notifications
You must be signed in to change notification settings - Fork 17
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
Unexpected masked data is introduced in bilinear mesh to grid #391
Comments
It looks like this is due to these points lying somewhere in the cracks between bilinear cells. Since these points are considered out of bounds by ESMF, it should be possible to fill these in by passing ESMF a suitable extrapolation method. After a bit of experimentation, I think this would be the NEAREST_IDAVG method with the ESMF This was generated by hacking iris-esmf-regrid to allow extra arguments to be passed to ESMF with the below code: esmf_args_1 = {"extrap_method": esmpy.ExtrapMethod.NEAREST_IDAVG,
"extrap_num_src_pnts": 2,
"extrap_dist_exponent": 1}
esmf_args_2 = {"extrap_method": esmpy.ExtrapMethod.NEAREST_IDAVG}
esmf_args_3 = {"extrap_method": esmpy.ExtrapMethod.CREEP_FILL,
"extrap_num_levels": 1}
bilinear_regridder_0 = esmf_regrid.schemes.ESMFBilinearRegridder(source, target)
result_0 = bilinear_regridder_0(source)
bilinear_regridder_1 = esmf_regrid.schemes.ESMFBilinearRegridder(source, target, esmf_args=esmf_args_1)
result_1 = bilinear_regridder_1(source)
bilinear_regridder_2 = esmf_regrid.schemes.ESMFBilinearRegridder(source, target, esmf_args=esmf_args_2)
result_2 = bilinear_regridder_2(source)
bilinear_regridder_3 = esmf_regrid.schemes.ESMFBilinearRegridder(source, target, esmf_args=esmf_args_3)
result_3 = bilinear_regridder_3(source)
plt.subplot(221)
qplt.pcolor(result_0[30:40, 35:45])
plt.title("default")
plt.subplot(222)
qplt.pcolor(result_1[30:40, 35:45])
plt.title("NEAREST_IDAVG (+ args)")
plt.subplot(223)
qplt.pcolor(result_2[30:40, 35:45])
plt.title("NEAREST_IDAVG (no args)")
plt.subplot(224)
qplt.pcolor(result_3[30:40, 35:45])
plt.title("CREEP_FILL")
plt.show() There are two potential options to solve this:
Changing the default behaviour may have the unintended consequence that out of bounds behaviour changes when dealing with local grids, and there is a more general application for passing ESMF arguments so #375 may be the way to go for solving this. |
🐛 Bug Report
When regridding from low resolution UGRID data (C4 cubed sphere) to a higher resolution grid (e.g. n216e), masked data points are introduced in the result, despite there being no masked data in the source.
How To Reproduce
Steps to reproduce the behaviour:
Example script:
Expected behaviour
Expect there to be no masked points in the regridded result. See actual results in screenshots section.
Screenshots
Click to expand this section...
Source data: C4 cubed sphere
Regridded data: n96e
Environment
esmf_regrid
version: 0.9.0iris
version: 3.9.0Additional context
We have a use case in UG-ANTS for regridding from a low resolution mesh to a high resolution grid. We would expect there to be no masked data introduced by regridding, or at least for a warning/error to be raised if this does occur.
The text was updated successfully, but these errors were encountered: