Ignore:
Timestamp:
07/02/20 10:53:58 (5 years ago)
Author:
jdquinn
Message:

CHG: Fixes for Linux solid earth binaries; applied similar changes to other packaging/testing scripts; clean up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/coordsystems/gmtmask.py

    r25161 r25196  
    1 from os import getenv, putenv
     1import os
    22import subprocess
    33
    44import numpy as np
    55
     6from issmdir import *
    67from MatlabFuncs import *
    78from model import *
     
    4445
    4546    #Avoid bypassing of the ld library path by Matlab (:()
    46     try:
    47         issmdir
    48     except NameError:
    49         issmdir = getenv('ISSM_DIR')
     47    issm_dir = issmdir()
     48
    5049    try:
    5150        ismac
     
    5352        ismac = False
    5453
     54    # TODO: Do we really need this (we can/already set it in etc/environment.sh)?
    5555    if ismac:
    56         dyld_library_path_old = getenv('DYLD_LIBRARY_PATH')
    57         putenv('DYLD_LIBRARY_PATH', issmdir + '/externalpackages/curl/install/lib:' + issmdir + '/externalpackages/hdf5/install/lib:' + issmdir + '/externalpackages/netcdf/install/lib')
     56        dyld_library_path_old = os.getenv('DYLD_LIBRARY_PATH')
     57        os.putenv('DYLD_LIBRARY_PATH', issm_dir + '/externalpackages/curl/install/lib:' + issm_dir + '/externalpackages/hdf5/install/lib:' + issm_dir + '/externalpackages/netcdf/install/lib')
     58
     59    #Find path to gmt (you may need to add yours to the list).
     60    #
     61    # NOTE: Assumes gmtselect is also in this directory.
     62    #
     63    gmtpaths = [
     64        issm_dir + '/bin/gmt',
     65        issm_dir + '/externalpackages/gmt/install/bin/gmt',
     66        '/Applications/GMT-5.4.3.app/Contents/Resources/bin/gmt'
     67    ]
     68    gmtpath = ''
     69    for i in range(len(gmtpaths)):
     70        if os.path.isfile(gmtpaths[i]):
     71            gmtpath = gmtpaths[i]
     72            break
     73
     74    if gmtpath == '':
     75        raise Exception('gmt not found! Make sure it is properly installed, or add its path to this file.')
    5876
    5977    #figure out which vertices are on the ocean, which one on the continent:
    60     subprocess.call(issmdir + '/externalpackages/gmt/install/bin/gmt gmtselect ./ all_vertices.txt -h0 -Df -R0/360/-90/90 -A0 -JQ180/200 -Nk/s/s/k/s > ./oce_vertices.txt', shell=True)
     78    subprocess.call(gmtpath + ' gmtselect ./ all_vertices.txt -h0 -Df -R0/360/-90/90 -A0 -JQ180/200 -Nk/s/s/k/s > ./oce_vertices.txt', shell=True)
    6179
    6280    #reset DYLD_LIBRARY_PATH to what it was:
    6381    if ismac:
    64         putenv('DYLD_LIBRARY_PATH', dyld_library_path_old)
     82        os.putenv('DYLD_LIBRARY_PATH', dyld_library_path_old)
    6583
    6684    #read the con_vertices.txt file and flag our mesh vertices on the continent
Note: See TracChangeset for help on using the changeset viewer.