python truediv_如何导出导致truediv错误的xarray数据集?

我有一个从一堆文件连接起来的xarray数据集。

Dimensions: (hru: 17, time: 233)

Coordinates:

* hru (hru) int64 9 17 11 8 3 2 6 4 7 12 1 13 10 16 15 5 14

* time (time) datetime64[ns] 2010-01-01 ... 2010-01-30

Data variables:

pptrate (time, hru) float64 9.241e-05 9.241e-05 ... 2.717e-09

hruId (hru) int64 dask.array

averageInstantRunoff (time, hru) float64 9.241e-05 9.241e-05 ... 2.717e-09

nSnow (time, hru) int32 dask.array

nSoil (time, hru) int32 dask.array

nLayers (time, hru) int32 dask.array

当我试图导出这个

ds.to_netcdf('test.nc')

我收到此错误消息:

TypeError: cannot perform __truediv__ with this index type:

不知道是什么问题。

这是生成

ds

import xarray as xr

import glob, os

NCDIR = './output/out/'

finalfile = 'summaout.nc'

outfilelist = glob.glob((NCDIR+'/*{}*.nc').format('basin_*timestep'))

ds=xr.open_mfdataset(outfilelist, concat_dim='hru')

replace = ds['pptrate']

runoff = ds['averageInstantRunoff'].values

runoff = np.squeeze(runoffdata, axis=2)

runoff = runoff.transpose()

replace.values = runoff

ncconvert = ds.drop('averageInstantRunoff')

runoffarray = xr.DataArray(runoff, dims=['time','hru'])

ds['averageInstantRunoff'] = runoffarray

ds.to_netcdf('test.nc')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值