Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ESPACE-DEV
pyrasta
Commits
c72d7560
Commit
c72d7560
authored
Jul 08, 2021
by
benjaminpillot
Browse files
Discriminate input and output data type in raster calculation method
parent
549c2252
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyrasta/tools/calculator.py
View file @
c72d7560
...
...
@@ -59,8 +59,8 @@ def _op(raster1, out_file, raster2, op_type):
@
_return_raster
def
_raster_calculation
(
raster_class
,
out_file
,
gdal_driver
,
sources
,
fhandle
,
window_size
,
data
_type
,
no_data
,
nb_processes
,
chunksize
,
description
):
fhandle
,
window_size
,
input
_type
,
output_type
,
no_data
,
nb_processes
,
chunksize
,
description
):
""" Calculate raster expression
"""
...
...
@@ -68,7 +68,7 @@ def _raster_calculation(raster_class, out_file, gdal_driver, sources,
window_size
=
(
window_size
,
window_size
)
master_raster
=
sources
[
0
]
window_gen
=
([
src
.
_gdal_dataset
.
ReadAsArray
(
*
w
).
astype
(
GDAL_TO_NUMPY
[
data
_type
])
for
src
in
window_gen
=
([
src
.
_gdal_dataset
.
ReadAsArray
(
*
w
).
astype
(
GDAL_TO_NUMPY
[
input
_type
])
for
src
in
sources
]
for
w
in
get_xy_block_windows
(
window_size
,
master_raster
.
x_size
,
master_raster
.
y_size
))
...
...
@@ -109,7 +109,7 @@ def _raster_calculation(raster_class, out_file, gdal_driver, sources,
master_raster
.
x_size
,
master_raster
.
y_size
,
nb_band
,
master_raster
.
geo_transform
,
data
_type
,
output
_type
,
no_data
)
is_first_run
=
False
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment