我试图将3个数据集(1981-1990、1991-2000、2001-2010)合并为一个变量。 以Jupyter(Python)为例,1981-1990年期间的特征如下:
每个数据集包含一个10年的周期,其大小约为4GB
在看了一些帖子后,我尝试了4种解决方案,都是在Windows 10中:
Jupyter(Python)
1。第一个建议
import xarray as xr
t2m_81_90 = xr.open_dataset('era5land_2m_temperature_hourly_ene-dic_1981-1990.nc')
t2m_91_00 = xr.open_dataset('era5land_2m_temperature_hourly_ene-dic_1991-2000.nc')
t2m_81_00 = xr.merge([t2m_1981_1990,t2m_1991_2000])
结果表明:
C:\Users\eleph\anaconda3\lib\site-packages\xarray\core\alignment.py:307: FutureWarning: Index.__or__
operating as a set operation is deprecated, in the future this will be a logical operation matching
Series.__or__. Use index.union(other) instead index = joiner(matching_indexes)
MemoryError: Unable to allocate 15.5 GiB for an array with shape (175319, 184, 129) and data type float32
2。第二个建议
ncrcat era5land_2m_temperature_hourly_ene-dic_1981-1990.nc era5land_2m_temperature_hourly_ene-dic_1991-2000.nc temper_all.nc
结果:
SyntaxError: invalid syntax
3。第三个建议
import netCDF4
from netCDF4 import Dataset
dataset = netCDF4.MFDataset(['era5land_2m_temperature_hourly_ene-dic_1981-1990.nc','era5land_2m_temperature_hourly_ene-dic_1991-2000.nc'])
结果:
ModuleNotFoundError: No module named 'netCDF4'
我认为错误是因为未安装“netCDF4”,但在尝试安装后,显示:
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort. failed
CDO(Cygwin)
4。第四条建议
$ cdo mergetime era5land_2m_temperature_hourly_ene-dic_1981-1990.nc era5land_2m_temperature_hourly_ene-dic_1991-2000.nc 2m_tempmerature_1981-2000.nc
结果:
cdf_put_vara_double: name=t2m type=NC_SHORT minval=-32767.000000 maxval=33531.000000
Error (cdf_put_vara_double): NetCDF: Numeric conversion not representable
我知道这篇文章很长,但我想展示我所做的尝试。也许有些问题可以解决。 合并这些数据集的任何帮助都将被告知
使用
并定义参数
concat_dim
。我想这应该是一个时间维度,你可以连接数据集提示:使用“打开多个文件”时打开并行模式
相关问题 更多 >
编程相关推荐