scipy - Python: Interpolation from an irregular 2d grid to a regular one -


I want to map a distribution of values ​​of random grid to a regular one. I am trying with different interpreters but it seems I am not able to do this.

Here I have written code:

  Import from NPP import as numpy SPP import matplotlib.pyplot plt N = 100 M = 10 lat = ((np) .random.rand (M, N)) * 2) +0.2 loan = ((np.random.rand (M, N))) * 3) +0.2 theta = ((np.random.rand (M, N) ) * 180) lat_min = np.min (lat) lat_max = np.max (lat) lon_min = np.min (lon) lon_max = np.max (lon) dlat = 0.1 # late [red] for dlon = 0.1 regular Step # LAN [Red] Regular Steps for # Grid Dimensions Nlat = np.int (np.abs (lat_max-lat_min) / dlat) +1 NLON = NPNT (NP.ABS (LOnmx-Elon_mination) / DLLN) +1 #Lat -Lon Vector reg_lat = np.linspace (lat_min, lat_max, NLAT) # Regular location latitude vector reg_lon = np.linspace (Lon_min, lon_max, Nlon) # Regular distance vector #Lat-Lawn Regular Grid Reg_lon_mesh, reg_lat_mesh = np.meshgrid (reg_lon, reg_lat)  

I used:

  Theta2 = scipy.interpolate.grid data ((lon.ravel (), lat.ravel (), theta (travel), (reg_lon_mesh, reg_lat_mesh), method = 'cube')  
< P> But the interpolation seems incorrect

and

  f = interpolate.interp2d (lo N.ravel), lat.ravel (), theta, type = 'cube')  

And this alert increases: a theoretically impossible result when fp = s with a Perhaps the reason for finding the smoothin strip is: S Very little or badly selected EPS. (F (FP-S) / S> 0.001) KX, KE = 3,3 NX, NY = 36,34 M = 1000 FP = 14832451.907306 S = 0.000000


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -