JiaweiZhuang / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
269 stars 49 forks source link

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

Closed huard closed 3 years ago

huard commented 4 years ago

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 commented 4 years ago

@raphaeldussin Would you be comfortable reviewing this PR ?

raphaeldussin commented 4 years ago

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

raphaeldussin commented 4 years ago

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

codecov-commenter commented 4 years ago

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%) :arrow_up:
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 commented 4 years ago

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

rabernat commented 3 years ago

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 commented 3 years ago

Merged in https://github.com/pangeo-data/xESMF/pull/3