interpolation

Interpolating a numpy array to fit another array

梦想与她 提交于 2020-05-26 04:00:26
问题 Say I have some_data of shape (1, n) . I have new incoming_data of shape (1, n±x) , where x is some positive integer much smaller than n . I would like to squeeze or stretch incoming_data such that it is of the same length as n . How might this be done, using the SciPy stack? Here's an example of what I'm trying to accomplish. # Stretch arr2 to arr1's shape while "filling in" interpolated value arr1 = np.array([1, 5, 2, 3, 7, 2, 1]) arr2 = np.array([1, 5, 2, 3, 7, 1]) result > np.array([1, 5,

Interpolating a numpy array to fit another array

拥有回忆 提交于 2020-05-26 04:00:13
问题 Say I have some_data of shape (1, n) . I have new incoming_data of shape (1, n±x) , where x is some positive integer much smaller than n . I would like to squeeze or stretch incoming_data such that it is of the same length as n . How might this be done, using the SciPy stack? Here's an example of what I'm trying to accomplish. # Stretch arr2 to arr1's shape while "filling in" interpolated value arr1 = np.array([1, 5, 2, 3, 7, 2, 1]) arr2 = np.array([1, 5, 2, 3, 7, 1]) result > np.array([1, 5,

How to smooth by interpolation when using pcolormesh?

筅森魡賤 提交于 2020-05-24 20:36:07
问题 I have a basemap of the world, and it's filled with data (lintrends_mean) using pcolormesh. Because the data has relatively large grid boxes, I'd like to smooth the plot. However, I can't figure out how to do this. Setting shading='gouraud' in the plotting function blurs the edges of the grid boxes, but I'd like something nicer-looking than that since the data still appears blotchy. There was a similar question asked here with an answer given, but I don't understand the answer, particularly

How to smooth by interpolation when using pcolormesh?

半腔热情 提交于 2020-05-24 20:34:50
问题 I have a basemap of the world, and it's filled with data (lintrends_mean) using pcolormesh. Because the data has relatively large grid boxes, I'd like to smooth the plot. However, I can't figure out how to do this. Setting shading='gouraud' in the plotting function blurs the edges of the grid boxes, but I'd like something nicer-looking than that since the data still appears blotchy. There was a similar question asked here with an answer given, but I don't understand the answer, particularly

How to smooth by interpolation when using pcolormesh?

爱⌒轻易说出口 提交于 2020-05-24 20:34:48
问题 I have a basemap of the world, and it's filled with data (lintrends_mean) using pcolormesh. Because the data has relatively large grid boxes, I'd like to smooth the plot. However, I can't figure out how to do this. Setting shading='gouraud' in the plotting function blurs the edges of the grid boxes, but I'd like something nicer-looking than that since the data still appears blotchy. There was a similar question asked here with an answer given, but I don't understand the answer, particularly

How to make new grid from two diiferent data lat lon coordinates

有些话、适合烂在心里 提交于 2020-05-24 05:45:52
问题 I have two data sets A and B. Each data set have lat,lon and temperature but different lengths A=[200,3] B=[250,3]. I would like perform interpolate A and B and display the temperature(average temperature which are close lat lon from 2 sets). It would be great help someone know how to handle it. I tried from here https://stackoverflow.com/a/56628900/13258046 mesh1=df_A[['latitude(deg)','longititude(deg)']] mesh2=df_D[['latitude(deg)','longititude(deg)']] the shape of the data is mesh1.shape:

Scipy interp2d interpolate masked fill values

半腔热情 提交于 2020-05-15 05:53:13
问题 I want to interpolate data (120*120) in order to get output data (1200*1200). In this way I'm using scipy.interpolate.interp2d. Below is my input data, where 255 corresponds to fill values, I mask these values before the interpolation. I'm using the code below: tck = interp2d(np.linspace(0, 1200, data.shape[1]), np.linspace(0, 1200, data.shape[0]), data, fill_value=255) data = tck(range(1200), range(1200)) data = np.ma.MaskedArray(data, data == 255) I get the following result: Fill values

Cubic hermit spline interpolation python

坚强是说给别人听的谎言 提交于 2020-05-11 02:59:57
问题 I would like to calculate a third-degree polynomial that is defined by its function values and derivatives at specified points. https://en.wikipedia.org/wiki/Cubic_Hermite_spline I know of scipy's interpolation methods. Specifically splprep to interpolate a N-dimensional spline and splev to eveluate its derivatives. Is there a python routine that takes function values f(x) and derivatives f'(x) corresponding to values x and calculates a spline representation that fits the given data. To give

Cubic hermit spline interpolation python

荒凉一梦 提交于 2020-05-11 02:57:52
问题 I would like to calculate a third-degree polynomial that is defined by its function values and derivatives at specified points. https://en.wikipedia.org/wiki/Cubic_Hermite_spline I know of scipy's interpolation methods. Specifically splprep to interpolate a N-dimensional spline and splev to eveluate its derivatives. Is there a python routine that takes function values f(x) and derivatives f'(x) corresponding to values x and calculates a spline representation that fits the given data. To give

Cubic hermit spline interpolation python

≡放荡痞女 提交于 2020-05-11 02:57:50
问题 I would like to calculate a third-degree polynomial that is defined by its function values and derivatives at specified points. https://en.wikipedia.org/wiki/Cubic_Hermite_spline I know of scipy's interpolation methods. Specifically splprep to interpolate a N-dimensional spline and splev to eveluate its derivatives. Is there a python routine that takes function values f(x) and derivatives f'(x) corresponding to values x and calculates a spline representation that fits the given data. To give