# That's (top left x, w-e pixel resolution, rotation (0 if North is up), I think the resolution doesn't show up again until writing the raster (something like this?) - outTiff = 'somefilename.tif' Grid = gp.predict(rr_cc_as_cols).reshape((ncol,nrow)) Gp = GaussianProcess(regr='quadratic',corr='cubic',theta0=np.min(z),thetaL=min(z),thetaU=max(z),nugget=0.05) Grid = griddata(pts,z,(gridx,gridy), method='linear',fill_value=-3e30)į = interpolate.Rbf(ptx, pty, z, function='linear')įrom sklearn.gaussian_process import GaussianProcess interptype = 'gauss': #or rbf or griddata and used it to evaluate different methods of interpolation - where 'pts' is a list of x,y pairs and z is a list of z values - ptx and pty are lists of x and y values respectively. Of course, you could also use linspace, or mesh grid, or probably any number of functions to generate the x and y points. 5j), then the integer part of its magnitude is interpreted as specifying the number of points to create between the start and stop values, where the stop value is inclusive.' Note the step argument is a complex number in the example above - from the docs 'However, if the step length is a complex number (e.g. To generate a 2D array of points for interpolation, i sometimes use numpy mgrid as import numpy as np Xres = (xmax - xmin) / float(ncol) #which should get back to original cell size Nrow = int(math.ceil(ymax-ymin)) / cellsize Ncol = int(math.ceil(xmax-xmin)) / cellsize If your coordinates were in meters - you might want to end with 10 meter cell size, so you might use cellsize = 10 The resolution might be somewhat specific to what you want - and as you mention, dependent on the cell size. 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. I've got some scattered data in the form of (latitude, longitude, someParameterValue).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |