如何插值多维Xarray?
我使用 xarray
读取了 netCDF
文件。该数据集包含 1975 年、1990 年、2000 年和 2015 年人口
的lat
、lon
信息。
该数据集如下所示我也提供了它此处:
import xarray as xr
ds = xr.open_dataset('borneo_pop_t.nc')
ds
对于每个像素,我希望获得 1975 年至 2000 年之间每年的信息(考虑到趋势)我拥有的数据点。我特别想为缺失的年份生成更多信息和不同层次的人口。
我怎样才能做到这一点?
I read a netCDF
file using xarray
. The dataset contains lat
, lon
information of the population
for the years: 1975, 1990, 2000 and 2015.
The dataset looks like the following and I made it also available here:
import xarray as xr
ds = xr.open_dataset('borneo_pop_t.nc')
ds
For each pixel I would like to have the information of each year between 1975 and 2000 given the trend of the data points I have. In particular I would like to generate more information and different layers of the population for the missing years.
How can I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
xarray
的插值函数< /a>.使用变量名称,
请注意以下几点:
You can use
xarray
's interpolation function.Using your variable names,
Note a few things:
ds.interp()
supports everything thatscipy.interpolate.interp1d()
does - e.g., cubic, polynomial, etc. interpolation. Check the docks linked above for examples.