Changeset 26853
- Timestamp:
- 02/07/22 04:40:54 (3 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py
r26553 r26853 2 2 functions of the same, respective name. 3 3 4 Where possible, users are encouraged to use native and/or the most efficient 5 methods in Python, but we provide these functions as a way to make translations 4 Where possible, users are encouraged to use native and/or the most efficient 5 methods in Python, but we provide these functions as a way to make translations 6 6 from the MATLAB to the Python ISSM API more seamless. 7 7 """ … … 82 82 83 83 def cosdsingle(x): # {{{ 84 """function cosdsingle - Helper function for cosd to reduce repetition of 84 """function cosdsingle - Helper function for cosd to reduce repetition of 85 85 logic 86 86 … … 162 162 NOTE: 163 163 - Only the following functionality is currently implemented: 164 - C = intersect(A,B) returns the data common to both A and B, with no 164 - C = intersect(A,B) returns the data common to both A and B, with no 165 165 repetitions. C is in sorted order. 166 166 … … 175 175 176 176 NOTE: 177 - Takes a type as its second argument (in contrast to the MATLAB function 177 - Takes a type as its second argument (in contrast to the MATLAB function 178 178 that it replicates, which takes a string representing the name of a type) 179 179 """ … … 204 204 def ismember(a, s): # {{{ 205 205 import numpy as np 206 207 206 if not isinstance(s, (tuple, list, dict, np.ndarray)): 208 207 s = [s] … … 215 214 else: 216 215 if not isinstance(s, np.ndarray): 217 b = np.empty_like(a) 216 b = np.empty_like(a).flat 218 217 for i, item in enumerate(a.flat): 219 b .flat[i] = item in s218 b[i] = item in s 220 219 else: 221 220 b = np.in1d(a.flat, s.flat).reshape(a.shape) 222 223 221 return b 224 222 # }}} … … 272 270 def oshostname(): # {{{ 273 271 import socket 274 275 return socket.gethostname() 272 hostname = socket.gethostname() 273 274 return hostname.lower() 276 275 # }}} 277 276 … … 298 297 299 298 def sindsingle(x): # {{{ 300 """function sindsingle - Helper function for sind to reduce repetition of 299 """function sindsingle - Helper function for sind to reduce repetition of 301 300 logic 302 301 -
issm/trunk-jpl/src/m/os/issmscpin.py
r26332 r26853 22 22 pass 23 23 #if hostname and host are the same, do a simple copy 24 if hostname == host:24 if strcmpi(hostname, host): #hostname == host: 25 25 for package in packages: 26 26 try: -
issm/trunk-jpl/src/m/os/issmscpout.py
r26332 r26853 1 1 import os 2 from socket import gethostname3 2 import subprocess 4 3 from MatlabFuncs import * … … 17 16 #if hostname and host are the same, do a simple copy 18 17 19 if host == hostname:18 if strcmpi(host, hostname): #host == hostname: 20 19 for package in packages: 21 20 here = os.getcwd() -
issm/trunk-jpl/src/m/os/issmssh.py
r26332 r26853 37 37 subprocess.call('ssh -l %s -p %d localhost "%s"' % (login, port, command), shell=True) 38 38 else: 39 subprocess.call('ssh -l %s %s "%s"' %(login, host, command), shell=True)39 subprocess.call('ssh -l {} {} "{}"'.format(login, host, command), shell=True) 40 40 41 41 # The following code was added to fix:
Note:
See TracChangeset
for help on using the changeset viewer.