从哥白尼读取NetCDF4 LST文件的问题

时间:2019-05-30 03:31:20

标签: netcdf4

我有来自Copernicus的一系列每小时LST数据。可以在Panopoly(Windows版本4.10.6)中很好地阅读和显示这些内容,但是:

  • 使用“ NetCDF4浏览器”插件(V0.3)打开时,崩溃QGIS 2.18.13
  • 使用R ncdf4代码错误地读取LST变量:

*

file1 <- nc_open('g2_BIOPAR_LST_201901140400_E114.60S35.43E119.09S30.22_GEO_V1.2.nc')
file2 <- nc_open('g2_BIOPAR_LST_201901140500_E114.60S35.43E119.09S30.22_GEO_V1.2.nc')
# attributes(file1)$names
# Just for one variable for now
dat_new <- cbind(
  ncvar_get(file1, 'LST'),
  ncvar_get(file2, 'LST'))
dim(dat_new)
print(dim(dat_new))
var <- file1$var['LST']$LST
# Create a new file
file_new <- nc_create(
  filename = 'Copernicus_LST.nc', 
  # We need to define the variables here
  vars = ncvar_def(
    name = 'LST',
    units = var$units,
    dim = dim(dat_new)))

# And write to it
ncvar_put(
  nc = file_new,
  varid = 'LST',
  vals = dat_new)
# Finally, close the file
nc_close(file_new)

返回:

[1] "Error, passed variable has a dim that is NOT of class ncdim4!"
[1] "Error occurred when processing dim number 1 of variable LST"
Error in ncvar_def(name = "LST", units = var$units, dim = dim(dat_new)) : 
  This dim has class: integer

类似地,使用python netCDF4方法

compiled = netCDF4.MFDataset(['g2_BIOPAR_LST_201901140400_E114.60S35.43E119.09S30.22_GEO_V1.2.nc','g2_BIOPAR_LST_201901140500_E114.60S35.43E119.09S30.22_GEO_V1.2.nc'])) 

返回

ValueError: MFNetCDF4 only works with NETCDF3_* and NETCDF4_CLASSIC formatted files, not NETCDF4

我想这是哥白尼文件格式的问题...其他人遇到过吗?已经放好这些two example files here

谢谢!

0 个答案:

没有答案