Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
u4py
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rudolf, Michael
u4py
Commits
dcd091b3
Commit
dcd091b3
authored
7 months ago
by
Rudolf, Michael
Browse files
Options
Downloads
Patches
Plain Diff
Fixed calculation of terrain statistics
parent
27aac689
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
u4py/io/tiff.py
+15
-4
15 additions, 4 deletions
u4py/io/tiff.py
with
15 additions
and
4 deletions
u4py/io/tiff.py
+
15
−
4
View file @
dcd091b3
...
@@ -10,6 +10,7 @@ import geopandas as gp
...
@@ -10,6 +10,7 @@ import geopandas as gp
import
numpy
as
np
import
numpy
as
np
import
rasterio
as
rio
import
rasterio
as
rio
import
rasterio.mask
as
riomask
import
rasterio.mask
as
riomask
import
scipy.stats
as
spstats
import
shapely
import
shapely
from
osgeo
import
gdal
from
osgeo
import
gdal
from
tqdm
import
tqdm
from
tqdm
import
tqdm
...
@@ -545,9 +546,19 @@ def calculate_terrain_in_shapes(
...
@@ -545,9 +546,19 @@ def calculate_terrain_in_shapes(
terrain
=
u4spatial
.
compute_for_raster_in_geom
(
terrain
=
u4spatial
.
compute_for_raster_in_geom
(
fp_terrain
,
shape
,
u4spatial
.
get_values
,
shapes
.
crs
fp_terrain
,
shape
,
u4spatial
.
get_values
,
shapes
.
crs
)
)
if
not
terrain
is
None
:
if
terrain
is
not
None
:
data
.
extend
(
terrain
)
data
.
extend
(
terrain
)
if
len
(
data
)
>
0
:
if
len
(
data
)
>
0
:
data
=
np
.
array
(
data
)
if
terrain_feature
==
"
aspect
"
:
terrain_data
[
"
mean
"
].
append
(
np
.
rad2deg
(
spstats
.
circmean
(
np
.
deg2rad
(
data
)))
)
terrain_data
[
"
std
"
].
append
(
np
.
rad2deg
(
spstats
.
circstd
(
np
.
deg2rad
(
data
)))
)
else
:
terrain_data
[
"
mean
"
].
append
(
np
.
mean
(
data
))
terrain_data
[
"
mean
"
].
append
(
np
.
mean
(
data
))
terrain_data
[
"
median
"
].
append
(
np
.
median
(
data
))
terrain_data
[
"
median
"
].
append
(
np
.
median
(
data
))
terrain_data
[
"
std
"
].
append
(
np
.
std
(
data
))
terrain_data
[
"
std
"
].
append
(
np
.
std
(
data
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment