Open brogalla opened 6 days ago
Thanks Birgit, firstly sorry it seems David and myself missed your comment on the issue you link - we get a lot of traffic on GitHub so sometimes comments can get lost in the noise.
As far as I can tell from the code and according to our test suite, conservative
is supported already as a regridding method with the 3D, vertical coordinate inclusive, case, for both of the spherical (regrids
) or Cartesian (regridc
) cases. So, unless I am missing something, you should be able to just specify it as the method
, like so (and equivalently with regrids
):
regridded_f = src_f.regridc(dst_f, axes='Z', method='conservative', z='Z', <plus any other keyword arguments you want>)
where you have to identify the specific z coordinate with e.g. here 'Z' as the identifier, and often you will want to include ln_z=True
to the other argument inputs for 3D regridding.
For conservative regridding to work you will need bounds defined for all of the coordinates involved including the 'z'/vertical ones, though, and note 3D regridding won't work for certain cases such as DSG fields.
I am wondering about the background here - did you run into a specific error or issue when you tried to do conservative 3D regridding with cf? If so please let us know and we can guide. (There may be some other limitations I am not aware of.)
Hi Sadie, no problem at all -- and sorry for my delayed response.
I see! I tested the 'linear' 3D regridding and it worked fine, but I ran into errors when I tried conservative 3D regridding (2D conservative regridding worked fine). Then, while reading the documentation, I misinterpreted the comment that the vertical regridding can be done with linear weights to mean that the 3D regridding was only set up for the "linear" method, so I figured that was the cause of my issues. But, I think I just setup the conservative regridding incorrectly (probably something about the vertical coordinate bounds). I will try a simplified test case and let you know if I still run into issues. Again thanks for the help!
Follow up from issue #715 : maybe this is already planned, but it would be very nice if there was an option for 3-d conservative regridding in addition to the recently added 3-d bilinear spherical regridding (ESMPy seems to have this as an option).