Skip to content

Commit

Permalink
Merge pull request #143 from changliao1025/development
Browse files Browse the repository at this point in the history
fix slash
  • Loading branch information
changliao1025 authored Jun 14, 2023
2 parents 7787839 + 17b182f commit e6b605a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ def intersect_flowline_with_flowline( sFilename_flowline_a_in, sFilename_flowlin
#pFeature_mesh= pLayer_mesh.GetFeature(i)
pGeometry_flowline_a = pFeature_flowline_a.GetGeometryRef()
npoint = pFeature_flowline_a.GetPointCount()
aCoords = list()
aCoords_gcs = list()
for i in range(0, npoint):
pt = pFeature_flowline_a.GetPoint(i)
aCoords.append( [ pt[0], pt[1]])
aCoords_gcs.append( [ pt[0], pt[1]])

aCoords_gcs= np.array(aCoords_gcs)

if (iFlag_transform ==1): #projections are different
Expand Down
61 changes: 61 additions & 0 deletions pyflowline/external/pyearth/system/define_global_variables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""
this module will be used to define all the global variables
"""

import platform
from pathlib import Path
import getpass
sPlatform_os = platform.system()

sUsername = getpass.getuser()

sWorkspace_home = str(Path.home())

if sPlatform_os == 'Windows': #windows
slash = '\\'
sMachine ='None'

sWorkspace_scratch = 'C:'
else: #linux or unix
slash = '/'

if (sPlatform_os == 'Linux'):
sWorkspace_scratch = sWorkspace_home + slash + 'scratch'

else:
if (sPlatform_os == 'Darwin'):
sMachine ='mac'
sWorkspace_scratch = sWorkspace_home + slash + 'scratch'
else:
pass

#data file type
sExtension_txt = '.txt'
sExtension_envi = '.dat'
sExtension_tiff = '.tif'
sExtension_header ='.hdr'
sExtension_netcdf = '.nc'
sExtension_shapefile = '.shp'
sExtension_json = '.json'

#graphics format

sExtension_png = '.png'
sExtension_jpg = '.jpg'
sExtension_ps = '.ps'
sExtension_vtk = '.vtk'


#constant values
missing_value = -9999.0

nmonth = 12 #be careful with this one

#unit conversion

iMonth_start = 1
iMonth_end = 12
mms2mmd = 24 * 3600.0
feet2meter = 0.3048
inch2mm = 25.4
cms2cmd = 24 * 3600
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def map_multiple_vector_data(aFiletype_in,
aValue_all = list()
for i in range(nFile):
aValue = list()
sFilename_in = aFilename_in[i]
sFilename = aFilename_in[i]

iFlag_thickness = aFlag_thickness[i]
if iFlag_thickness ==1 :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import subprocess
import datetime

from pyflowline.external.pyearth.system.define_global_variables import *

pDate = datetime.datetime.today()
sDate_default = "{:04d}".format(pDate.year) + "{:02d}".format(pDate.month) + "{:02d}".format(pDate.day)


def create_dggrid_case( iCase_index, \
iResolution_index ,\
sGrid_type,\
sDate_in = None, \
def create_dggrid_mesh( iCase_index,
iResolution_index ,
sGrid_type,
sDate_in = None,
sFilename_crop_shapefile_in =None ):

sCase = "{:03d}".format( iCase_index )
Expand Down

0 comments on commit e6b605a

Please sign in to comment.