Skip to content
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

Handling xesmf dependency #133

Open
NoraLoose opened this issue Sep 18, 2024 · 4 comments
Open

Handling xesmf dependency #133

NoraLoose opened this issue Sep 18, 2024 · 4 comments

Comments

@NoraLoose
Copy link
Collaborator

I'm currently working on refactoring the ROMS-Tools-internal regridding scheme, switching from xarray.interp to xesmf. The motivation for this is:

  • predicted performance boost: xarray.interp does not re-use pre-computed weights, while xesmf does
  • interpolation methods: xarray.interp only supports linear interpolation, while xesmf supports more sophisticated ones like bilinear and conservative

However, I'm wondering how we will handle the xesmf dependency. It looks like you can only install xesmf cleanly through conda but not through PyPi, see https://xesmf.readthedocs.io/en/stable/installation.html. The reason is that xesmf depends on ESMpy , which in turn is not available through PyPI.

Thoughts? cc @TomNicholas

@NoraLoose
Copy link
Collaborator Author

NoraLoose commented Sep 18, 2024

There is also still the outstanding question whether xesmf will break things if used together with dask.

@TomNicholas
Copy link
Member

My understanding is that ESMF is a Fortran dependency, so by definition cannot be installed purely via pip (a python package manager). So if xesmf is a required dependency (not sure it needs to be) we may just have to only make CStar available via conda (which I think would be fine).

The dask vs ESMF problem is separable.

@NoraLoose
Copy link
Collaborator Author

Thanks!

So if xesmf is a required dependency (not sure it needs to be) we may just have to only make CStar available via conda (which I think would be fine).

It would have to be a required dependency if I refactor the regridding scheme to use xesmf. And just to clarify, we are talking about ROMS-Tools here, not C-Star. ;)

The dask vs ESMF problem is separable.

It is, but maybe not easily since weight generation and application of the weights need to happen upon the initialization of a class (e.g., SurfaceForcing).

@TomNicholas
Copy link
Member

It would have to be a required dependency if I refactor the regridding scheme to use xesmf

But we could imagine xesmf being one amongst multiple options. Not sure if that's worth doing right now, but designing with that possibility in mind might be useful in the future.

It is, but maybe not easily since weight generation and application of the weights need to happen upon the initialization of a class (e.g., SurfaceForcing).

Can we change the API to separate out those two steps? e.g. generate weights upon class initialization and then .apply or something? It would be very useful to be able to do one then the other separately.

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

No branches or pull requests

2 participants