![]() I may try to attempt the answers in reverse: Hence the above question could be asked as: how to generate 2D arrays of (x,y) points (query points?) that correspond to pixels in the rendered image? I can see that the above question is related to the pixel resolution that we want in the final interpolated image.how to set the resolution of the points on x and y axes whose interpolated values that we are going to calculate? What would be the proper way to generate query points for an interpolation grid i.e.Would like to get suggestions on the following: A sample image, that I assume to be inappropriate, is shown here After calculating the grid of interpolated values, I'm using gdal to turn it into a raster image with the interpolated values scaled to 0-255 for the pixels. Here I feel that populating the query points at intervals of 1 in each of x and y axes is not the right way to go. Where xmin, ymin, xmax, ymax are the minimum and maximum values of x and y coordinates respectively. #the 2D array of query points is populated here Please note that I've converted the (latitude, longitude) coordinates to cartesian (x, y) coordinates : xr = int(math.ceil(xmax-xmin)) Presently I'm generating the query points for that grid, in python, as given below. I'm using inverse distance weighting interpolation method to interpolate them in a rectangular grid of pixels. My_data = np.I've got some scattered data in the form of (latitude, longitude, someParameterValue). ![]() Here's an improved loading, just in case # tell numpy the first 2 columns are int and the last 2 are floats The first 2 columns are supposed to be int and the last 2 ones are float. ![]() It's simple and regular, I would suggest testing on a more general one, if possible. Here's an example file, it's the same used for the scatter plot. How can get a decent 3D graph with minimal interpolation? Is there something like just linking the closest 3D points together?īy the way, my data is fairly regular, like they are organized as a set of 2D planes, or "slices", but I'd like to know if this is possible without making that assumption. And this is probably also true (for large values of "interpolation"). I was also told by some other people that interpolation is bad, because it forces a shape. I was told by some people that I absolutely need to interpolate to find a surface. I've read the doc about griddata, it says it returns aĢd float array - Array of values interpolated at (xi, yi) points. However, it "smooths" the curve, and interpolates to a regular set of points. I'm aware of this question explaining how to get a 3D surface out of irregular 3D data. I need to have a similar representation while elaborating my data as little as possible (to prevent distortions). There is a nice example in the gallery that draws a surface and the projection of contours (image below). ![]() My_data = np.genfromtxt(input_file, delimiter='\t', skiprows=0)Įrrors = my_data # 4th column (errors) Input_file = os.path.normpath('C:/Users/sturaroa/Documents/my_file.tsv') Let's keep the errors aside for the moment. Each line of this file has 3 coordinates and a standard deviation. I'm plotting a 3D scatter plot reading my values from a file.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |