[英]How to set chunk size of netCDF4 in python?
I can see the default chunking setting in netCDF4 library, but I have no idea how to change the chunk size.我可以在 netCDF4 库中看到默认的分块设置,但我不知道如何更改分块大小。
from netCDF4 import Dataset
volcgrp = Dataset('datasets/volcano.nc', 'r')
data = volcgrp.variables['abso4']
print data.shape
print data.chunking()
>(8, 96, 192)
>[1, 96, 192]
Is there anyone who can help with the setting?有人可以帮忙设置吗?
It is a little unclear what you are trying to do.有点不清楚你要做什么。
data.chunking()
tells you the chunksize of the variable as stored in the file. data.chunking()
告诉您存储在文件中的变量的块大小。 If you would like to change this, you need to re-write the file on disk, setting the chunksize for each variable.如果你想改变这个,你需要在磁盘上重新写入文件,为每个变量设置块大小。 With the
netCDF4
library, you can do this with the chunksizes
keword argument to netCDF4.CreateVariable()
.使用
netCDF4
库,您可以使用netCDF4.CreateVariable()
的chunksizes
关键字参数来执行此操作。 Documentation found here:文档在这里找到:
http://unidata.github.io/netcdf4-python/#netCDF4.Dataset.createVariable http://unidata.github.io/netcdf4-python/#netCDF4.Dataset.createVariable
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.