Ignore:
Timestamp:
11/08/21 11:59:05 (3 years ago)
Author:
jdquinn
Message:

CHG: MATLAB -> Python translations; clean up

File:
1 edited

Legend:

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

    r26358 r26553  
    5050
    5151    return np.degrees(np.arctan2(Y, X))
     52# }}}
     53
     54def contains(str, pat):  #{{{
     55    """function contains - Determine if pattern is in strings
     56
     57    Usage:
     58        TF = contains(str, pat)
     59
     60    TODO:
     61    - Implement 'IgnoreCase' option
     62    """
     63
    5264# }}}
    5365
     
    142154# }}}
    143155
     156def intersect(A, B):  # {{{
     157    """function intersect - Set intersection of two arrays
     158
     159    Usage:
     160        C = intersect(A, B)
     161
     162    NOTE:
     163    - Only the following functionality is currently implemented:
     164        - C = intersect(A,B) returns the data common to both A and B, with no
     165        repetitions. C is in sorted order.
     166
     167    """
     168    import numpy as np
     169
     170    return np.intersect1d(A, B)
     171#}}}
     172
    144173def isa(A, dataType):  # {{{
    145     """FUNCTION ISA
     174    """function isa
    146175
    147176    NOTE:
     
    216245def mod(a, m):  # {{{
    217246    return a % m
     247# }}}
     248
     249def numel(A):  # {{{
     250    """function numel - Number of array elements
     251
     252    Usage:
     253        n = numel(A))
     254    """
     255    import numpy as np
     256
     257    return np.size(A)
    218258# }}}
    219259
Note: See TracChangeset for help on using the changeset viewer.