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
549c2252
Commit
549c2252
authored
Jul 08, 2021
by
benjaminpillot
Browse files
Discriminate input and output data type in raster calculation method
parent
763b7be1
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyrasta/base.py
View file @
549c2252
...
...
@@ -319,7 +319,8 @@ class RasterBase:
@
classmethod
def
raster_calculation
(
cls
,
rasters
,
fhandle
,
window_size
=
100
,
gdal_driver
=
gdal
.
GetDriverByName
(
"Gtiff"
),
data_type
=
gdal
.
GetDataTypeByName
(
'Float32'
),
input_type
=
gdal
.
GetDataTypeByName
(
'Float32'
),
output_type
=
gdal
.
GetDataTypeByName
(
'Float32'
),
no_data
=-
999
,
nb_processes
=
mp
.
cpu_count
(),
chunksize
=
MP_CHUNK_SIZE
,
description
=
"Calculate raster expression"
):
...
...
@@ -343,7 +344,9 @@ class RasterBase:
* tuple of 2D coordinates (width, height)
gdal_driver: osgeo.gdal.Driver
GDAL driver (output format)
data_type: int
input_type: int
GDAL data type for input raster (if multiple types, let "float32")
output_type: int
GDAL data type for output raster
no_data: int or float
no data value in resulting raster
...
...
@@ -360,8 +363,8 @@ class RasterBase:
New temporary instance
"""
return
_raster_calculation
(
cls
,
rasters
,
fhandle
,
window_size
,
gdal_driver
,
data
_type
,
no_data
,
nb_processes
,
chunksize
,
description
)
gdal_driver
,
input
_type
,
output_type
,
no_data
,
nb_processes
,
chunksize
,
description
)
def
read_array
(
self
,
band
=
None
,
bounds
=
None
):
""" Write raster to numpy array
...
...
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