1
    1. My school cluster admin said: if we load netcdf4 module, then we cannot load netcdf3 module. So he refused to update netcdf4
    1. I have a .nc file, which is a netcdf4 file, I think and I need to load it in R.
    1. In R on our cluster, only RNetCDF package is installed. And it cannot read the above .nc file. The ncdf4 package is not there. (I try to install it, it says it requires netcdf library of version 4. And of course I do not have sudo)
    1. In python, (I don't know why) I can load netcdf4 file. I don't know if I can use this to (save it in netcdf 3 format?) help me load that data in R.

So, how should I do?

  • The admin don't want to switch to netcdf4 module, and so it seems I(or he) cannot install ncdf4 package in R.
  • Some of the nc data are directly downloaded from some website, and some of the nc files are from the output of the xarray package in python (and the netcdf output of xarray is in version 4).
4

1 回答 1

2

使用 xarray,您可以通过format='NETCDF3_CLASSIC'在调用时指定来控制保存的文件版本to_netcdf。所以一个简单的解决方案可能是使用 xarray,例如,

ds = xarray.open_dataset(path)
ds.to_netcdf(dest, format='NETCDF3_CLASSIC')
于 2016-11-17T02:19:56.403 回答