Skip to content

Conversation

@fvitt
Copy link

@fvitt fvitt commented Sep 3, 2025

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.

Copy link

@TomMelt TomMelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fvitt , this exactly what I need

call ESMF_FieldRegridStore(srcField=physfld_3d, dstField=lonlatfld_3d, &
regridMethod=ESMF_REGRIDMETHOD_BILINEAR, &
polemethod=ESMF_POLEMETHOD_NONE, &
polemethod=ESMF_POLEMETHOD_NONE, &
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure. Under some circumstances it might make a difference. Test it to see what works best for you.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried both and it looks like it has no effect for our particular setup.

@TomMelt TomMelt merged commit 29e4950 into DataWaveProject:nonlocal-gws-global Sep 10, 2025
@TomMelt
Copy link

TomMelt commented Sep 11, 2025

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):
image

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.
image

Do you think this is to be expected? or do you think something could be wrong?

@fvitt
Copy link
Author

fvitt commented Sep 11, 2025

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.

@TomMelt
Copy link

TomMelt commented Sep 12, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants