Reputation: 221
.nc
file, which is a netcdf4 file, I think and I need to load it in R.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
)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?
ncdf4
package in R.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).Upvotes: 1
Views: 839
Reputation: 9603
With xarray you can control the version of files saved by specifying format='NETCDF3_CLASSIC'
when calling to_netcdf
. So a simple solution might be to use xarray, e.g.,
ds = xarray.open_dataset(path)
ds.to_netcdf(dest, format='NETCDF3_CLASSIC')
Upvotes: 4