Skip to content

Commit

Permalink
np dtype fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sdunesme committed Jul 3, 2024
1 parent 19e593b commit 2f4ddf7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions fct/height/HeightAboveNearestDrainage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@
import fiona
import fiona.crs

from .. import terrain_analysis as ta
from .. import speedup
from ..config import (
config,
from fct import terrain_analysis as ta
from fct import speedup
from fct.config import (
LiteralParameter,
DatasetParameter
)
from ..config.descriptors import DatasetResolver
from ..rasterize import rasterize_linestringz
# from ..swath import nearest_value_and_distance
from ..measure.Measurement import nearest_value_and_distance
from ..cli import starcall
from fct.config.descriptors import DatasetResolver
from fct.rasterize import rasterize_linestringz
# from fct.swath import nearest_value_and_distance
from fct.measure.Measurement import nearest_value_and_distance
from fct.cli import starcall

class Parameters:
"""
Expand Down Expand Up @@ -209,7 +208,7 @@ def accept_pixel(i, j):
if refaxis_pixels:

nearest, reference, distance = nearest_value_and_distance(
np.array(refaxis_pixels),
np.array(refaxis_pixels, dtype='float32'),
mask,
ds.nodata)

Expand Down
2 changes: 1 addition & 1 deletion fct/profiles/SwathProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def SwathProfileUnit(
logger.error('Window error on swath (%d, %f)', axis, measure)
return None

mask = (nearest == float(axis)) & (swaths == float(swath)) & (values != nodata)
mask = (nearest.astype('float32') == float(axis)) & (swaths.astype('float32') == float(swath)) & (values != nodata)

if np.sum(mask) == 0:
return None
Expand Down

0 comments on commit 2f4ddf7

Please sign in to comment.