Skip to content

Commit

Permalink
fix the hole and neighbor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
changliao1025 committed Jul 7, 2023
1 parent 9689cc7 commit 39c14b3
Show file tree
Hide file tree
Showing 15 changed files with 761 additions and 430 deletions.
9 changes: 0 additions & 9 deletions data/susquehanna/input/mesh_boundary_buffer.geojson

This file was deleted.

288 changes: 0 additions & 288 deletions docs/source/conf_compare.py

This file was deleted.

3 changes: 2 additions & 1 deletion pyflowline/classes/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class celltype(enum.Enum):
square = 2
latlon = 3
mpas = 4
tin = 5
dggrid = 5
tin = 6

class pycell(metaclass=ABCMeta):

Expand Down
2 changes: 2 additions & 0 deletions pyflowline/classes/dggrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class pydggrid(pycell):
nNeighbor=-1
nNeighbor_land=-1
nNeighbor_ocean=-1
nNeighbor_land_virtual = -1
aNeighbor_land_virtual = None
aNeighbor=None #the global ID of all neighbors
aNeighbor_land=None #the global ID of all neighbors
aNeighbor_ocean=None #the global ID of all neighbors
Expand Down
2 changes: 2 additions & 0 deletions pyflowline/classes/hexagon.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class pyhexagon(pycell):
nNeighbor=-1
nNeighbor_land=-1
nNeighbor_ocean=-1
nNeighbor_land_virtual = -1
aNeighbor_land_virtual = None
aNeighbor=None #the global ID of all neighbors
aNeighbor_land=None #the global ID of all neighbors
aNeighbor_ocean=None #the global ID of all neighbors
Expand Down
2 changes: 2 additions & 0 deletions pyflowline/classes/latlon.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class pylatlon(pycell):
nNeighbor=-1
nNeighbor_land=-1
nNeighbor_ocean=-1
nNeighbor_land_virtual = -1
aNeighbor_land_virtual = None
aNeighbor=None #the global ID of all neighbors
aNeighbor_land=None #the global ID of all neighbors
aNeighbor_ocean=None #the global ID of all neighbors
Expand Down
9 changes: 7 additions & 2 deletions pyflowline/classes/mpas.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ class pympas(pycell):
aVertexID=None
pVertex_center = None
aFlowline=None
nNeighbor=-1
nNeighbor=-1
nNeighbor_land=-1
nNeighbor_land_virtual = -1
aNeighbor_land_virtual = None
nNeighbor_ocean=-1
aNeighbor=None #the global ID of all neighbors
aNeighbor=None #the global ID of all neighbors, execluding null
aNeighbor_land=None #the global ID of all neighbors

aNeighbor_ocean=None #the global ID of all neighbors
aNeighbor_distance = None

Expand All @@ -96,8 +99,10 @@ def __init__(self, dLon, dLat, aEdge, aVertex):
self.aVertex = aVertex #the first one and last one are the same
self.nEdge = len(aEdge)
self.nVertex = len(aVertex)
#initialize the neighbor but without the actual neighbor information
self.nNeighbor = -1
self.nNeighbor_land = -1
self.nNeighbor_land_virtual = -1
self.nNeighbor_ocean = -1
self.iFlag_coast = 0
self.dLongitude_center_degree = dLon
Expand Down
8 changes: 4 additions & 4 deletions pyflowline/classes/pycase.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import subprocess
from shutil import copy2
import numpy as np
from osgeo import ogr, osr
from osgeo import ogr, osr, gdal
from shapely.wkt import loads

from pyflowline.external.pyearth.system.define_global_variables import *
Expand All @@ -34,7 +34,7 @@
from pyflowline.mesh.mpas.create_mpas_mesh import create_mpas_mesh
from pyflowline.mesh.dggrid.create_dggrid_mesh import create_dggrid_mesh
from pyflowline.mesh.tin.create_tin_mesh import create_tin_mesh

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

Expand Down Expand Up @@ -624,10 +624,10 @@ def mesh_generation(self, iFlag_antarctic_in=None):
if iFlag_mesh_boundary ==1:
#create a polygon based on
#read boundary
pBoundary = read_mesh_boundary(self.sFilename_mesh_boundary)
pBoundary_wkt, pBoundary_shp = read_mesh_boundary(self.sFilename_mesh_boundary)

aMpas = create_mpas_mesh(iFlag_global, iFlag_use_mesh_dem, iFlag_save_mesh,
sFilename_mesh_netcdf, sFilename_mesh, iFlag_antarctic_in=iFlag_antarctic_in, pBoundary_in = pBoundary)
sFilename_mesh_netcdf, sFilename_mesh, iFlag_antarctic_in=iFlag_antarctic_in, pBoundary_in = pBoundary_wkt)
pass
else:
pRing = ogr.Geometry(ogr.wkbLinearRing)
Expand Down
2 changes: 2 additions & 0 deletions pyflowline/classes/square.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class pysquare(pycell):
nNeighbor=-1
nNeighbor_land=-1
nNeighbor_ocean=-1
nNeighbor_land_virtual = -1
aNeighbor_land_virtual = None
aNeighbor=None #the global ID of all neighbors
aNeighbor_land=None #the global ID of all neighbors
aNeighbor_ocean=None #the global ID of all neighbors
Expand Down
Loading

0 comments on commit 39c14b3

Please sign in to comment.