This release drops support for Python < 3.11. xESMF aims to preserve support for older python and ESMF version as long as possible with its reduced maintaining team. The most recent windows release of ESMF is currently 8.4.2 and new versions of xESMF will support it as long as it is not updated. All fixes in :pull:`463`, by Pascal Bourgault.
- Rewrote
xe.smm.gen_mask_from_weightsto remove scipy-dependent code. - Fix the CI reenable testing with previous python versions.
- Avoid a
SpatialAveragerbug that happens when polygon segments have a length of exactly 1 on ESMF 8.4.2. The bug is not actually fixed in xESMF, but "segmentizing" the polygons with 0.99 seems to fix the issue.
- Rewrote
xe.smm.add_nans_to_weight(called whenunmapped_to_nanis True)to remove scipy-dependent code, which also resulted in a significant (>=4x) speedup of that step (:pull:`461`). By Pascal Bourgault. - Fix some name collision issues in the parallel regridder initialisation (:pull:`461`). By Pascal Bourgault.
- Added
Regridderoptionpost_mask_sourceto mask contributions of specified source grid cells, with a special setting for masking domain edge cells to avoid extrapolation withnearest_s2dwhen remapping to a larger domain (post_mask_source = 'domain_edge', :pull:`444`). By Martin Schupfner. - Added support for target masks when regridding
LocStreamtoGridwithnearest_s2d(:pull:`445`). By Martin Schupfner. xesmf.util.cf_grid_2dreturns bounds as coordinates, asgrid_2ddoes and as usually expected. (:pull:`453`). By Pascal Bourgault.- Accept masks in "X, Y" order (:issue:`447`, :pull:`456`). By Pascal Bourgault.
- Correctly use arguments
input_dimsandoutput_dimsinRegridderwhen grids are defined as dictionaries of numpy arrays (:issue:`362`, :pull:`455`). By Aaron G Meyer.
- Fix issue introduced by :pull:`418` for passing grids as dictionaries. (:issue:`428`, :pull:`429`). By Pascal Bourgault.
- Destroy grids explicitly once weights are computed. Do not store them in grid_in and grid_out attributes. This fixes segmentation faults introduced by the memory fix of last version. By Pascal Bourgault.
- Do not add scalar coordinates of the target grid to the regridded output (:issue:`417`, :pull:`418`). xe.Regridder.out_coords is now a dataset instead of a dictionary. By Pascal Bourgault.
- Fix ESMpy memory issues by explictly freeing the Grid memory upon garbage collection of
Regridderobjects. By Pascal Bourgault. - Address deprecation for xarray 2024.10 in the parallel weight generation. By Pascal Bourgault.
- Address an upcoming change in sparse 0.16 where COO fill values will distinguish between 0.0 and -0.0. This issue would affect spatial averaging over polygons with holes. By Pascal Bourgault.
- Cast grid sizes to python's int (another Numpy 2.0 fix). (:pull:`377`) By Pascal Bourgault.
- New
xe.util.cell_areautility to compute the cell area using ESMF's internal mechanism. (:pull:`372`, :issue:`369`) By Jiawei Zhuang and Pascal Bourgault. - Compatibility with Numpy 2.0 (NaN vs nan) (:pull:`373`) By Pascal Bourgault.
- Reverted to the chunking behaviour of xESMF 0.7 for cases where the spatial dimensions are not chunked on the source data. (:pull:`348`) By Pascal Bourgault.
- Fix regression from :pull:`332` that made
Regridderfail with rectilinear datasets andparallel=True. (:issue:`343`, :pull:`344`). - Allow Python 3.12 (and higher) again. (:pull:`345`).
- Remove usage of private method of xarray that was removed in its 2024.02.0 version (:issue:`338`, :issue:`340`) By Pascal Bourgault.
- Test against ESMF 8.6
- Raise a meaningful error messages when the output grid has no chunks with parallel=True (:issue:`299`, :pull:`304`). By Pascal Bourgault.
- Correct guess of output chunks for
SpatialAverager.
- Change import to support shapely 1 and 2.
This release of xESMF improves support for parallelization with dask: weights can now be computed in parallel, and those weights can be applied over chunks spanning the horizontal grid dimensions. Previously, computing weights in parallel was only possible using MPI, and datasets could only be chunked over non-spatial dimensions.
These new features are the outcome of Charles Gauthier's internship at Ouranos during the summer of 2023. Thanks to Charles for his hard work and sharp analysis, which led to a permanent position at Ouranos!
- Added a check in SpatialAverager that warns user if they are using polygons with long segments that could cause errors (:pull:`293`). By Charles Gauthier
- Add an option (
parallel) to generate regridding weights in parallel using dask (:pull:`290`). By Charles Gauthier - Add the ability to apply weights using dask on chunked horizontal/core dimensions. The
output_chunksargument to the Regridder class allows setting the chunk sizes of the output data (:pull:`280`). By Charles Gauthier - Added a w property to the Regridder and SpatialAverager classes, returning the weights reshaped according to the input and output grid dimensions. This is mostly intended for debugging and visualisation purposes (:pull:`276`). By David Huard
- Move URLs from earthsystemcog.org to earthsystemmodeling.org (:pull:`292`).
- Remove Python 3.7 from the project classifiers
- Build docs using Python 3.9
- Fix
Mesh.from_polygonsand unpin Shapely to add support for Shapely 2.0 (:pull:`219`). By Pascal Bourgault - Implement workaround for setup conda problem (:pull:`229`). By Raphael Dussin
- Update CI and doc - fix for DataArrays (:pull:`230`). By Pascal Bourgault
- Fix ci/cd badge for build status (:pull:`231`). By Pierre Manchon
- Update CI for Micromamba environments (:pull:`233`). By Trevor James Smith
- Fix error in test with Shapely 2.0 (:pull:`251`). By David Huard
- Add util to build tripolar grid (:pull:`228`). By Raphael Dussin
- Document installation options for ESMpy (:pull:`241`). By Matthew Plough
- Modernize the package configuration / publish to PyPI (:pull:`248`). By Filipe Fernandes
- Fix bug in util.grid_global where grid centers could go beyond 180 degrees (:issue:`181`). By David Huard
- Support both [-180, 180] and [0, 360] conventions in grid_global (:issue:`149`). By David Huard
- Fix API doc build (:pull:`194`). By David Huard
- Include conservative_normed into the notebook comparing regridding algorithms. By David Huard
- Fix typos (:pull:`191`). By Jemma Stachelek
- Copy-editing (:pull:`178`, :pull:`179`). By RichardScottOZ
- Constrain numba>=0.55.2. See (:issue:`185`).
- Constrain shapely<2.0. See (:issue:`216`).
- Add support for esmpy name change in import. See (:pull:`214`,:issue:212)
- Spatial coordinates of ds_out are kept within the regridder and transferred to the regridded DataArray or Dataset (:pull:`175`). By Pascal Bourgault
- Added numba as an explicit dependency to fix installation with conda (:pull:`168`). By Pascal Bourgault
- Use cf-xarray to guess missing CF coordinates before extracting bounds (:pull:`147`). By Pascal Bourgault
- The introduction of sparse, with numba under the hood, restricted input data to little-endian dtypes. For big-endian dtypes, xESMF will convert to little-endian, regrid and convert back (:pull:`135`). By Pascal Bourgault
SpatialAveragerdid not compute the same weights asRegridderwhen source cell areas were not uniform (:pull:`128`). By David Huard- Refactor of how the regridding is called internally, to fix a bug with dask and sparse (:pull:`135`). By Pascal Bourgault
- Deprecation of
regrid_numpyandregrid_daskis scheduled for 0.7.0. All checks on shape, array layout and numba support are now done at call time, rather then at computation time (:pull:`135`).
Note that this version creates very large dask task graphs that can affect performance for large grids.
- Weights are now stored in a
xr.DataArraybacked bysparse.COO, which allows to pass them as an argument to thexr.apply_ufuncand decrease memory usage when using dask. By Pascal Bourgault - New dependency sparse replacing
scipy.
- Add the
skipnaandna_thresholdoptions to deal with masks over non-spatial dimensions (:pull:`29`). This is useful when, for example, masks vary over time. By Stéphane Raynaud - Add
unmapped_to_nanargument to regridder frontend. When True, this sets target cells outside the source domain to NaN instead of zero for all regridding methods except nearest neighbour (:pull:`94`). By Martin Schupfner
- Drop the PyPi badge and replace by a Conda badge (:pull:`97`). By Ray Bell
- Fix regression regarding support for non-CF-compliant coordinate names (:pull:`73`). By Sam Levang
- Infer bounds dimension name using cf-xarray (:pull:`78`). By Pascal Bourgault
- Do not regrid variables that are not defined over horizontal dimensions (:pull:`79`). By Pascal Bourgault
- Ensure locstream dimension name is consistent with ds_out (:pull:`81`). By Mattia Almansi
- Add release instructions (:pull:`75`). By David Huard
- Update Zenodo DOI badge
- Restore original behavior for lon/lat discovery, uses cf-xarray if lon/lat not found in dataset (:pull:`64`)
- Solve issue of dimension order in dataset (#53) with (:pull:`66`)
- Update installation instructions to mention that PyPi only holds xesmf up to version 0.3.0.
- Regridded xarray.Dataset now preserves the name and attributes of target coordinates (:pull:`60`)
- Fix doc build for API/Regridder (:pull:`61`)
- Deprecate esmf_grid in favor of Grid.from_xarray
- Deprecate esmf_locstream in favor of LocStream.from_xarray
- Installation requires numpy>=1.16 and cf-xarray>=0.3.1
- Create ESMF.Mesh objects from shapely.polygons (:pull:`24`). By Pascal Bourgault
- New class SpatialAverager offers user-friendly mechanism to average a 2-D field over a polygon. Includes support to handle interior holes and multi-part geometries. (:pull:`24`) By Pascal Bourgault
- Automatic detection of coordinates and computation of vertices based on cf-xarray. (:pull:`49`) By Pascal Bourgault
- Fix serialization bug when using dask's distributed scheduler (:pull:`39`). By Pascal Bourgault.
- Subclass ESMF.Mesh and create from_polygon method
- Subclass ESMF.Grid and ESMF.LocStream and create from_xarray methods.
- New BaseRegridder class, with support for Grid, LocStream and Mesh objects. Not all regridding methods are supported for Mesh objects.
- Refactor Regridder to subclass BaseRegridder.
The git repo is now hosted by pangeo-data (https://github.com/pangeo-data/xESMF)
- By default, weights are not written to disk, but instead kept in memory.
- Installation requires ESMPy 8.0.0 and up.
- The Regridder object now takes a weights argument accepting a scipy.sparse COO matrix, a dictionary, an xarray.Dataset, or a path to a netCDF file created by ESMF. If None, weights are computed and can be written to disk using the to_netcdf method. This weights parameter replaces the filename and reuse_weights arguments, which are preserved for backward compatibility (:pull:`3`). By David Huard and Raphael Dussin
- Added documentation discussion how to compute weights from a shell using MPI, and reuse from xESMF (:pull:`12`). By Raphael Dussin
- Add support for masks in :py:func`esmf_grid`. This avoid NaNs to bleed into the interpolated values. When using a mask and the conservative regridding method, use a new method called conservative_normed to properly handle normalization (:pull:`1`). By Raphael Dussin
- Add support for ESMF.LocStream (#81) By Raphael Dussin
- Add option to allow degenerated grid cells (#61) By Jiawei Zhuang
All user-facing APIs in v0.1.x should still work exactly the same. That said, because some internal codes have changed a lot, there might be unexpected edge cases that break current user code. If that happens, you can revert to the previous version by pip install xesmf==0.1.2 and follow old docs.
- Lazy evaluation on dask arrays (uses :py:func:`xarray.apply_ufunc` and :py:func:`dask.array.map_blocks`)
- Automatic looping over variables in an xarray Dataset
- Add tutorial notebooks on those new features
This release mostly contains internal clean-ups to facilitate future development.
- Deprecates regridder.A in favor of regridder.weights
- Speed-up test suites by using coarser grids
- Use parameterized tests when appropriate
- Fix small memory leaks from ESMF.Grid
- Properly assert ESMF enums
Initial release. By Jiawei Zhuang