I have a very large NetCDF file and I would like to set density
, speed
of sound
and temperature
values on a certain part of the domain, let's say from x=-120 to x=0. I have no previous solution for interpolation. Can you help me? I am now trying with an interpolation of a solution where I want the data interpolated only for coordinates x<0, but it doesn't work properly. Here the code:
...
solutiongrid = Grid('data_for_interp/tau.grid')
solutionfield = Field('data_for_interp/restart.pval')
dummygrid = Grid('mesh/dome_lox.grid')
injector_sol = Field("out/dome_lox.pval.1")
interpolated_field = solutionfield.interpolate(solutiongrid,dummygrid, \
nneighbours=10, method='inverse_distance', \
exponent=3.00)
interpolated_field.reset_iteration_counter()
injector_ids = np.where(dummygrid.pnt[0,:] < 0.0)[0]
for var in interpolated_field.vars.keys():
interpolated_field.vars[var][injector_ids] = injector_sol.vars[var][injector_ids]
interpolated_field.write('restart_dome.pval')
...