It is not possible to open the file directly from within R using ssh, but there are a few options available to you.
1. Mount the remote server as a local filesystem over ssh.
There are packages which will let you mount remote machines as local filesystems over ssh; on Linux, for example, you might use sshfs
whereas on Windows you might use win-sshfs
. Once you've mounted the remote file system, you would be able to access the netcdf files from R just as you would any other file, although I'm not sure what the performance implications may be.
2. Break the larger files down into smaller files.
Use the command-line ncdump
utility, on the server, to create smaller files from the large files which are able to fit on your local file system.
$ ncdump -v [var1],[var2] big.nc > smaller.cdl
smaller.cdl will be a text file; you can generate a binary netcdf .nc
file by using ncgen
:
$ ncgen -b -o smaller.nc smaller.cdl
3. Use an OpenDAP service on the remote server.
Unless your remote server is already set up to provide OpenDAP service, this is probably overkill. But if it is, you may use a combination of R's OPeNDAP access and netCDF's OPenDAP subset service to retrieve data subsets on the fly. You can also use ncdump
on your local machine to request a subset of data from the server.