0

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')

...
  • What did you try so far? Please show us. – Wolf Jul 14 '21 at 08:44
  • At the moment I didn't try anything because I am a bit unsure on how to do it. – Federica Tonti Jul 14 '21 at 08:47
  • What did you read so far? Did you search for it? – Wolf Jul 14 '21 at 08:53
  • Does this answer your question? [How to update portion of the netCDF file?](https://stackoverflow.com/questions/45450696/how-to-update-portion-of-the-netcdf-file) – Wolf Jul 14 '21 at 08:53
  • I am trying now with interpolation of a solution, but it makes anyway strange things. Essentially I want to interpolate only a portion of a solution with the data I need, but it doesn't interpolate at the points I want. – Federica Tonti Jul 15 '21 at 08:23

0 Answers0