vancesteven / PlanetProfile

Construct 1D interior structure models based on planetary properties. Self-consistent thermodynamics are used for fluid, rock, and mineral phases. Sound speeds, attenuation, and electrical conductivities are computed as outputs.
https://vancesteven.github.io/PlanetProfile/
Other
18 stars 13 forks source link

Perple_X EOS handling in Python version uses 'nearest' interpolation method #47

Open itsmoosh opened 2 years ago

itsmoosh commented 2 years ago

On the pythonport branch, I'm finishing up coding the reading-in of Perple_X output tables. The Perple_X outputs contain numerous NaN values. I can successfully interpolate over the important gaps that exist in the Perple_X output file using scipy.interpolate.griddata, but with the desired 'cubic' or 'linear' interpolation methods, some edges of the data yield NaNs from the interpolation, so this doesn't fully solve the problem.

To feed this data into scipy.interpolate.RectBivariateSpline, I have set the interpolation method to be 'nearest' in config.py, but this solution is not ideal because the filled values will not be as accurately representative. Another option is to use scipy.interpolate.SmoothBivariateSpline in place of both griddata and RectBivariateSpline, but it is much, much slower for these large tables.

A better solution should be found that either interpolates over the missing values in the Perple_X tables without introducing new NaNs, or regenerates Perple_X outputs sans NaNs.