Changeset 26853


Ignore:
Timestamp:
02/07/22 04:40:54 (3 years ago)
Author:
bdef
Message:

CHG: CHanges to have conformity in hostnames with matlab

Location:
issm/trunk-jpl/src/m
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py

    r26553 r26853  
    22functions of the same, respective name.
    33
    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 
     4Where possible, users are encouraged to use native and/or the most efficient
     5methods in Python, but we provide these functions as a way to make translations
    66from the MATLAB to the Python ISSM API more seamless.
    77"""
     
    8282
    8383def cosdsingle(x):  # {{{
    84     """function cosdsingle - Helper function for cosd to reduce repetition of 
     84    """function cosdsingle - Helper function for cosd to reduce repetition of
    8585    logic
    8686
     
    162162    NOTE:
    163163    - 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
    165165        repetitions. C is in sorted order.
    166166
     
    175175
    176176    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
    178178    that it replicates, which takes a string representing the name of a type)
    179179    """
     
    204204def ismember(a, s):  # {{{
    205205    import numpy as np
    206 
    207206    if not isinstance(s, (tuple, list, dict, np.ndarray)):
    208207        s = [s]
     
    215214    else:
    216215        if not isinstance(s, np.ndarray):
    217             b = np.empty_like(a)
     216            b = np.empty_like(a).flat
    218217            for i, item in enumerate(a.flat):
    219                 b.flat[i] = item in s
     218                b[i] = item in s
    220219        else:
    221220            b = np.in1d(a.flat, s.flat).reshape(a.shape)
    222 
    223221    return b
    224222# }}}
     
    272270def oshostname():  # {{{
    273271    import socket
    274 
    275     return socket.gethostname()
     272    hostname = socket.gethostname()
     273
     274    return hostname.lower()
    276275# }}}
    277276
     
    298297
    299298def sindsingle(x):  # {{{
    300     """function sindsingle - Helper function for sind to reduce repetition of 
     299    """function sindsingle - Helper function for sind to reduce repetition of
    301300    logic
    302301
  • issm/trunk-jpl/src/m/os/issmscpin.py

    r26332 r26853  
    2222            pass
    2323    #if hostname and host are the same, do a simple copy
    24     if hostname == host:
     24    if strcmpi(hostname, host):  #hostname == host:
    2525        for package in packages:
    2626            try:
  • issm/trunk-jpl/src/m/os/issmscpout.py

    r26332 r26853  
    11import os
    2 from socket import gethostname
    32import subprocess
    43from MatlabFuncs import *
     
    1716    #if hostname and host are the same, do a simple copy
    1817
    19     if host == hostname:
     18    if strcmpi(host, hostname):  #host == hostname:
    2019        for package in packages:
    2120            here = os.getcwd()
  • issm/trunk-jpl/src/m/os/issmssh.py

    r26332 r26853  
    3737                subprocess.call('ssh -l %s -p %d localhost "%s"' % (login, port, command), shell=True)
    3838            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)
    4040
    4141    # The following code was added to fix:
Note: See TracChangeset for help on using the changeset viewer.