python - numpy fromfile using remote paramiko SFTPFile connection -
I have a binary data file on that server, which I want to read with numpy. Instead of entering the server and run my Python code, I think I can make a remote SFTP connection file using Now, I use the data standard dragon File can use reading functions, but I can not use Numpy to read the data. For example, I (known length) you want to read the 3 arrays of such data: But oval does not like the fact that What do I have to do - or do I just complete the file in a local directory? If you reverse-engineer Then you can make a simple paramiko SSH2 module:
import sftp_client = ssh_client.open_sftp () remote to # get connections: paramiko # (els039) ssh_client = paramiko.SSHClient () to remote servers SSH connection ssh_client.load_system_host_keys () ssh_client.connect ( "els039") # now SFTP The client gets the connection to the file rfile = sftp_client.open ('2013041506.dat')
zdat = np.fromfile (rfile, dtype = "& gt; F8", count = zdat_len) udat = np.fromfile (rfile, dtype = "& gt; F8", count = udat_len) vdat = np.fromfile (rfile, dtype = "& gt; F8", = vdat_len count)
rfile is the type paramiko.SFTPFile .
If you want to get whatever you want
numpy.fromfile () to
& lt; FileObject & gt; The methods to reach should structure / data-cells to read and create
paramiko.SFTPFile objects / instance-methods.
of its own sub-group on an ad-hoc Add-ons, if you want faster results of work
Download (Instantiate) .dat on your
& lt -file example; Local Host & gt; file system, that can be processed by
numpy.fromfile () and / or
numpy.loadtxt () standard methods & amp; Worked in this way.
Comments
Post a Comment