Skip to content

Commit

Permalink
Merge pull request #19 from yukio89/modify-unitcount-calculation
Browse files Browse the repository at this point in the history
get_base_cellcountのunitcountの算出方法を修正
  • Loading branch information
ciscorn authored Mar 21, 2024
2 parents 8397bf1 + 80acf9e commit 5faca4f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/japanmesh/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ def get_mesh_vertex(x: int, x_size: float, y: int, y_size: float) -> (float, flo

@lru_cache(maxsize=None)
def get_base_cellcount(meshnum: int) -> (int, int, int):
unitcount = math.prod([info["ratio"] for idx, info in enumerate(MESH_INFOS) if 0 < idx <= meshnum])
idxs = [meshnum]
while idxs[-1]!=1:
idxs.append(MESH_INFOS[idxs[-1]]["parent"])
unitcount = math.prod([MESH_INFOS[i]["ratio"] for i in idxs])

if not MINIMUM_LON.is_integer():
raise Exception(f'Unexpected MINIMUM_LON: {MINIMUM_LON}')
Expand Down

0 comments on commit 5faca4f

Please sign in to comment.