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

Weights are kept in memory instead of being written to disk. #91

Closed
wants to merge 8 commits into from

Conversation

huard
Copy link

@huard huard commented Apr 16, 2020

This sets factor=True and filename=None in the call to ESMF.Regrid, and then calls get_weight_dict to obtain a dictionary of weights in memory instead of writing the weights to disk.

The Regridder interface is changed to pass weights explicitly (weights replacing filename and reuse_weights=True).

Computed weights are saved to disk using the to_netcdf method.

Fixes #75

I haven't modified the docs or notebooks.
Feel free to dismiss if this is not the API you were looking for.

@huard
Copy link
Author

huard commented May 25, 2020

@raphaeldussin Would you be comfortable reviewing this PR ?

@raphaeldussin
Copy link
Contributor

@huard no problem! will review it by the end of the week

xesmf/frontend.py Outdated Show resolved Hide resolved
xesmf/backend.py Outdated Show resolved Hide resolved
@raphaeldussin
Copy link
Contributor

@huard see my minor comments. Once this is resolved, I'm happy with it. Tests are passing locally.

@codecov-commenter
Copy link

codecov-commenter commented May 27, 2020

Codecov Report

Merging #91 into master will increase coverage by 0.77%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
+ Coverage   96.55%   97.32%   +0.77%     
==========================================
  Files           6        6              
  Lines         319      337      +18     
==========================================
+ Hits          308      328      +20     
+ Misses         11        9       -2     
Impacted Files Coverage Δ
xesmf/backend.py 96.51% <ø> (ø)
xesmf/frontend.py 96.73% <100.00%> (+1.15%) ⬆️
xesmf/smm.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d2e365...b5f3d07. Read the comment docs.

@huard
Copy link
Author

huard commented May 27, 2020

I've updated the notebooks (mostly removing the clean_weight_file calls). I think this would be ready for a second review.

@rabernat
Copy link

If this PR is ready to merge, perhaps it can be moved to https://github.com/pangeo-data/xESMF? Unfortunately this has to be done manually.

@huard
Copy link
Author

huard commented Sep 2, 2020

Merged in pangeo-data/xESMF#3

@huard huard closed this Sep 2, 2020
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.

Proposed new regridder save-load API in 0.3.0 (not backward compatible)
5 participants