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

[Deprecation] A list of deprecations for v0.7.0 #626

Closed
tomvothecoder opened this issue Mar 20, 2024 · 1 comment · Fixed by #628
Closed

[Deprecation] A list of deprecations for v0.7.0 #626

tomvothecoder opened this issue Mar 20, 2024 · 1 comment · Fixed by #628
Assignees

Comments

@tomvothecoder
Copy link
Collaborator

  • horizontal_xesmf() and horizontal_regrid2():
    # TODO Either provide generic `horizontal` and `vertical` methods or tool specific
    def horizontal_xesmf(
    self,
    data_var: str,
    output_grid: xr.Dataset,
    **options: Any,
    ) -> xr.Dataset:
    """
    Deprecated, will be removed with 0.7.0 release.
    Extends the xESMF library for horizontal regridding between structured
    rectilinear and curvilinear grids.
    This method extends ``xESMF`` by automatically constructing the
    ``xe.XESMFRegridder`` object, preserving source bounds, and generating
    missing bounds. It regrids ``data_var`` in the dataset to
    ``output_grid``.
    Option documentation :py:func:`xcdat.regridder.xesmf.XESMFRegridder`
    Parameters
    ----------
    data_var: str
    Name of the variable in the `xr.Dataset` to regrid.
    output_grid : xr.Dataset
    Dataset containing output grid.
    options : Dict[str, Any]
    Dictionary with extra parameters for the regridder.
    Returns
    -------
    xr.Dataset
    With the ``data_var`` variable on the grid defined in ``output_grid``.
    Raises
    ------
    ValueError
    If tool is not supported.
    Examples
    --------
    Generate output grid:
    >>> output_grid = xcdat.create_gaussian_grid(32)
    Regrid data to output grid using xesmf:
    >>> ds.regridder.horizontal_xesmf("ts", output_grid)
    """
    warnings.warn(
    "`horizontal_xesmf` will be deprecated in 0.7.x, please migrate to using "
    "`horizontal(..., tool='xesmf')` method.",
    DeprecationWarning,
    stacklevel=2,
    )
    regridder = HORIZONTAL_REGRID_TOOLS["xesmf"](self._ds, output_grid, **options)
    return regridder.horizontal(data_var, self._ds)
    # TODO Either provide generic `horizontal` and `vertical` methods or tool specific
    def horizontal_regrid2(
    self,
    data_var: str,
    output_grid: xr.Dataset,
    **options: Any,
    ) -> xr.Dataset:
    """
    Deprecated, will be removed with 0.7.0 release.
    Pure python implementation of CDAT's regrid2 horizontal regridder.
    Regrids ``data_var`` in dataset to ``output_grid`` using regrid2's
    algorithm.
    Options documentation :py:func:`xcdat.regridder.regrid2.Regrid2Regridder`
    Parameters
    ----------
    data_var: str
    Name of the variable in the `xr.Dataset` to regrid.
    output_grid : xr.Dataset
    Dataset containing output grid.
    options : Dict[str, Any]
    Dictionary with extra parameters for the regridder.
    Returns
    -------
    xr.Dataset
    With the ``data_var`` variable on the grid defined in ``output_grid``.
    Raises
    ------
    ValueError
    If tool is not supported.
    Examples
    --------
    Generate output grid:
    >>> output_grid = xcdat.create_gaussian_grid(32)
    Regrid data to output grid using regrid2:
    >>> ds.regridder.horizontal_regrid2("ts", output_grid)
    """
    warnings.warn(
    "`horizontal_regrid2` will be deprecated in 0.7.x, please migrate to using "
    "`horizontal(..., tool='regrid2')` method.",
    DeprecationWarning,
    stacklevel=2,
    )
    regridder = HORIZONTAL_REGRID_TOOLS["regrid2"](self._ds, output_grid, **options)
    return regridder.horizontal(data_var, self._ds)
  • **kwargs in create_grid():
    def create_grid(
    x: Optional[
    Union[
    xr.DataArray,
    Tuple[xr.DataArray, Optional[xr.DataArray]],
    ]
    ] = None,
    y: Optional[
    Union[
    xr.DataArray,
    Tuple[xr.DataArray, Optional[xr.DataArray]],
    ]
    ] = None,
    z: Optional[
    Union[
    xr.DataArray,
    Tuple[xr.DataArray, Optional[xr.DataArray]],
    ]
    ] = None,
    attrs: Optional[Dict[str, str]] = None,
    **kwargs: CoordOptionalBnds,
    ) -> xr.Dataset:
    """Creates a grid dataset using the specified axes.
    .. deprecated:: v0.6.0
    ``**kwargs`` argument is being deprecated, please migrate to
    ``x``, ``y``, or ``z`` arguments to create future grids.
  • [Deprecation]: Deprecate CDML support in open_dataset() and open_mfdataset() #604
  • add_bounds accepting boolean args in _postprocess_dataset():

    xcdat/xcdat/dataset.py

    Lines 551 to 562 in d0e33aa

    def _postprocess_dataset(
    dataset: xr.Dataset,
    data_var: Optional[str] = None,
    center_times: bool = False,
    add_bounds: List[CFAxisKey] | None | bool = ["X", "Y"],
    lon_orient: Optional[Tuple[float, float]] = None,
    ) -> xr.Dataset:
    """Post-processes a Dataset object.
    .. deprecated:: v0.6.0
    ``add_bounds`` boolean arguments (True/False) are being deprecated.
    Please use either a list (e.g., ["X", "Y"]) to specify axes or ``None``.
@tomvothecoder
Copy link
Collaborator Author

FYI @xCDAT/core-developers, there are some planned deprecations we've had for awhile now that will be addressed before releasing v0.7.0. We can also plan to deprecate #604 since @lee1043 isn't using it anymore.

@tomvothecoder tomvothecoder moved this from Todo to In Review in xCDAT Development Mar 20, 2024
@tomvothecoder tomvothecoder moved this from In Review to In Progress in xCDAT Development Mar 20, 2024
@tomvothecoder tomvothecoder self-assigned this Mar 20, 2024
@tomvothecoder tomvothecoder added minor A minor release, includes backwards compatible changes. and removed minor A minor release, includes backwards compatible changes. labels Mar 20, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in xCDAT Development Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant