Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shoreline profile - bad spatial axis unit #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion mikecore/DfsFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,11 @@ def GetItemSpatialAxis(itemPointer):
ctypes.byref(y0),
ctypes.byref(dx),
ctypes.byref(dy))
axis = DfsAxisEqD2(eumUnit(eumUnitInt.value), xCount.value, x0.value, dx.value, yCount.value, y0.value, dy.value)
try:
spatial_axis_unit = eumUnit(eumUnitInt.value)
except:
spatial_axis_unit = eumUnit.eumUmeter
axis = DfsAxisEqD2(spatial_axis_unit, xCount.value, x0.value, dx.value, yCount.value, y0.value, dy.value)
return (axis)

if axisType == SpaceAxisType.NeqD2:
Expand Down
Binary file added testdata/shoreline_profile.dfs2
Binary file not shown.
13 changes: 13 additions & 0 deletions tests/test_shoreline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from mikecore.DfsFileFactory import DfsFileFactory


def test_read_shoreline_profile_dfs2():


# this file has a problematic spatial axis unit
filename = "testdata/shoreline_profile.dfs2"

dfs2File = DfsFileFactory.Dfs2FileOpen(filename)

assert dfs2File.SpatialAxis.XCount == 300
assert dfs2File.SpatialAxis.YCount == 120