dataset.createVariable
时间: 2023-09-11 21:09:02 浏览: 92
`createVariable` is a method in the netCDF4 library in Python that is used to create a new variable in a netCDF file. The syntax for this method is as follows:
```
dataset.createVariable(name, datatype, dimensions, zlib=False, complevel=4, shuffle=True, fletcher32=False, contiguous=False, chunksizes=None, endian='native', fill_value=None)
```
where,
- `name`: The name of the new variable (string).
- `datatype`: The datatype of the new variable (string or numpy.dtype object). Examples include "i4" for 32-bit integer, "f8" for 64-bit floating point, etc.
- `dimensions`: A tuple of dimension names that define the shape of the new variable.
- `zlib`: Optional argument that specifies whether or not to compress the data with zlib compression.
- `complevel`: Optional argument that specifies the compression level to use if `zlib` is True.
- `shuffle`: Optional argument that specifies whether or not to shuffle the data before compressing it.
- `fletcher32`: Optional argument that specifies whether or not to use the fletcher32 checksum algorithm on the data.
- `contiguous`: Optional argument that specifies whether or not to store the data in contiguous blocks in memory.
- `chunksizes`: Optional argument that specifies the size of the chunks to use when storing the data.
- `endian`: Optional argument that specifies the byte order of the data.
- `fill_value`: Optional argument that specifies the fill value to use for the data.
This method returns a netCDF4 Variable object that can be used to read and write data to the new variable.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)