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 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')   

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:

  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)   

But oval does not like the fact that rfile is the type paramiko.SFTPFile .

What do I have to do - or do I just complete the file in a local directory?

If you want to get whatever you want

If you reverse-engineer 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

Then you can make a simple 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

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -