untested code for lonlat2phys regrid#33
untested code for lonlat2phys regrid#33TomMelt merged 2 commits intoDataWaveProject:nonlocal-gws-globalfrom
Conversation
src/utils/esmf_phys2lonlat_mod.F90
Outdated
| call ESMF_FieldRegridStore(srcField=physfld_3d, dstField=lonlatfld_3d, & | ||
| regridMethod=ESMF_REGRIDMETHOD_BILINEAR, & | ||
| polemethod=ESMF_POLEMETHOD_NONE, & | ||
| polemethod=ESMF_POLEMETHOD_NONE, & |
There was a problem hiding this comment.
@fvitt btw, when I was trying to debug my errors I changed polemethod from ESMF_POLEMETHOD_ALLAVG to ESMF_POLEMETHOD_NONE. It didn't seem to affect anything but I thought it would be best to change it back. Do you have any idea if it affects our setup?
(Your original code had polemethod=ESMF_POLEMETHOD_ALLAVG)
There was a problem hiding this comment.
I am not sure. Under some circumstances it might make a difference. Test it to see what works best for you.
There was a problem hiding this comment.
I tried both and it looks like it has no effect for our particular setup.
|
Hi @fvitt , just to say thanks again for providing the regridding code. I have tested it and it looks sensible. Here is a plot of me regridding the zonal wind (u , m/s) to a lonlat grid and then back to a cubed sphere grid (plots show the mean over levels): FWIW, the error is quite high at the poles between the original grid and the one that has been interpolated back onto the cubed-sphere grid. Do you think this is to be expected? or do you think something could be wrong? |
|
I am not surprised you are seeing the largest errors near the poles. I think this is expected. You are linear interpolating a couple times which will introduce some error. Your step 1 and step 3 plots look the same by eye, which is encouraging. |
Thanks that's reassuring. Do you know if it possible to try different forms of interpolation. I was initially thinking of trying the "patch" method but it looks like that doesn't support 3D regridding (see manual chapter 24.2.2 Interpolation methods: higher-order patch). I think any other method will likely be worse than the bilinear method we have now. |


These changes have NOT been tested. Hopefully this help with your reverse mapping (lonlat grid to the physics grid).
Module esmf_lonlat2phys_mod has been added to provide a method to regrid 3d flux fields from the uniform lon-lat grid to the physics grid.
Also removed the lonlatfld_2d_copy and lonlatfld_3d_copy fields from the existing code. I don't believe those are needed.