Changeset 25196 for issm/trunk-jpl/src/m/coordsystems/gmtmask.py
- Timestamp:
- 07/02/20 10:53:58 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/coordsystems/gmtmask.py
r25161 r25196 1 from os import getenv, putenv 1 import os 2 2 import subprocess 3 3 4 4 import numpy as np 5 5 6 from issmdir import * 6 7 from MatlabFuncs import * 7 8 from model import * … … 44 45 45 46 #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 50 49 try: 51 50 ismac … … 53 52 ismac = False 54 53 54 # TODO: Do we really need this (we can/already set it in etc/environment.sh)? 55 55 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.') 58 76 59 77 #figure out which vertices are on the ocean, which one on the continent: 60 subprocess.call( issmdir + '/externalpackages/gmt/install/bin/gmtgmtselect ./ 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) 61 79 62 80 #reset DYLD_LIBRARY_PATH to what it was: 63 81 if ismac: 64 putenv('DYLD_LIBRARY_PATH', dyld_library_path_old)82 os.putenv('DYLD_LIBRARY_PATH', dyld_library_path_old) 65 83 66 84 #read the con_vertices.txt file and flag our mesh vertices on the continent
Note:
See TracChangeset
for help on using the changeset viewer.