Skip to content

Liner and cubic interpolators (spicy.iterpolate.interp2d) no more available for interpolation in vertical cross-sections. #85

@adoerenbecher

Description

@adoerenbecher

When following the documentation : https://umr-cnrm.github.io/EPyGrAM-doc/gallery/A.2-other_plots/02.section.html

An error rose when asking for either the linear or the cubic interpolation.
The only option that work with extractsection() is nearest (no interpolation), which does not yield the most pretty plots...

Here follows the traceback with the option "linear".

Traceback (most recent call last):
File "/d0/Users/doerenbe/PYTHON/EPYGRAM/GRADPROC/plot_gradient_xsections.py", line 164, in
xsection = f.extractsection(point_start,point_stop, interpolation='linear')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/d0/Users/doerenbe/virtualenvs/met/lib/python3.12/site-packages/epygram/fields/D3Field.py", line 571, in extractsection
section = self.extract_subdomain(sectionG,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/d0/Users/doerenbe/virtualenvs/met/lib/python3.12/site-packages/epygram/fields/D3Field.py", line 750, in extract_subdomain
data[t, ...] = self.getvalue_ll(as_numpy_array(lons)[numpy.newaxis, :].repeat(len(k_index), axis=0).flatten(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/d0/Users/doerenbe/virtualenvs/met/lib/python3.12/site-packages/epygram/fields/D3Field.py", line 281, in getvalue_ll
f = interp2d(all_lons[n], all_lats[n], values_at_interp_points[n], kind=interpolation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/d0/Users/doerenbe/virtualenvs/met/lib/python3.12/site-packages/scipy/interpolate/_interpolate.py", line 129, in init
raise NotImplementedError(err_mesg)
NotImplementedError: interp2d has been removed in SciPy 1.14.0.

For legacy code, nearly bug-for-bug compatible replacements are
RectBivariateSpline on regular grids, and bisplrep/bisplev for
scattered 2D data.

In new code, for regular grids use RegularGridInterpolator instead.
For scattered data, prefer LinearNDInterpolator or
CloughTocher2DInterpolator.

For more details see
https://scipy.github.io/devdocs/tutorial/interpolate/interp_transition_guide.html

Here follows the traceback with the option "cubic".

Traceback (most recent call last):
File "/d0/Users/doerenbe/PYTHON/EPYGRAM/GRADPROC/plot_gradient_xsections.py", line 171, in
xsection = f.extractsection(point_start,point_stop, interpolation='cubic')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/d0/Users/doerenbe/virtualenvs/met/lib/python3.12/site-packages/epygram/fields/D3Field.py", line 571, in extractsection
section = self.extract_subdomain(sectionG,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/d0/Users/doerenbe/virtualenvs/met/lib/python3.12/site-packages/epygram/fields/D3Field.py", line 750, in extract_subdomain
data[t, ...] = self.getvalue_ll(as_numpy_array(lons)[numpy.newaxis, :].repeat(len(k_index), axis=0).flatten(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/d0/Users/doerenbe/virtualenvs/met/lib/python3.12/site-packages/epygram/fields/D3Field.py", line 281, in getvalue_ll
f = interp2d(all_lons[n], all_lats[n], values_at_interp_points[n], kind=interpolation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/d0/Users/doerenbe/virtualenvs/met/lib/python3.12/site-packages/scipy/interpolate/_interpolate.py", line 129, in init
raise NotImplementedError(err_mesg)
NotImplementedError: interp2d has been removed in SciPy 1.14.0.

For legacy code, nearly bug-for-bug compatible replacements are
RectBivariateSpline on regular grids, and bisplrep/bisplev for
scattered 2D data.

In new code, for regular grids use RegularGridInterpolator instead.
For scattered data, prefer LinearNDInterpolator or
CloughTocher2DInterpolator.

For more details see
https://scipy.github.io/devdocs/tutorial/interpolate/interp_transition_guide.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions