Search code examples
pythonvisualizationinterpolationnetcdflinear-interpolation

How to interpolate 3d variable like RAINC from netcdf file using wrf-python


Currently ,I am working on netcdf file ,from which i need to extract data using wrf-python and plot in the graph, while plotting , i got an issue ( i have attached the image, you can refer it).

Before explaining issue, i would like to explain the variable,RAINC which depends on timeindex,longitude and latitude, like RAINC[0,25,90]

but while plotting these,it values differ largely in small longitude and latitude change,which is giving a odd looking image like: plot of precipitation

what i need is ,i want to interpolate this rainc varaible like

time longitude latitude
1 1 1 rainc->5

time longitude latitude 1 1 3 rainc->10

irrespective of value at 2 latitude,it should be done by interpolating 5 and 10

ps: i am not mathematician. i may be wrong about explaining interpolation,but hope you get it


Solution

  • You can use smooth2d()function for interpolation if your data is 2d. But your netcdf file must be supported by wrf-python( which is output of WRF model)