Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
py_tools_ds
Commits
e0605d4d
Commit
e0605d4d
authored
Feb 19, 2019
by
Daniel Scheffler
Browse files
Reverted pyresample imports. Fixed style issues.
parent
7c187233
Pipeline
#3726
passed with stages
in 1 minute and 31 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/geo/map_info.py
View file @
e0605d4d
...
...
@@ -236,7 +236,7 @@ def geotransform2mapinfo(gt, prj):
with
open
(
path_hdr
,
'r'
)
as
inF
:
content
=
inF
.
read
()
if
'map info'
in
content
:
res
=
re
.
search
(
"map info =
\
{(.*?)
\
}"
,
content
,
re
.
I
).
group
(
1
)
res
=
re
.
search
(
"map info = {(.*?)}"
,
content
,
re
.
I
).
group
(
1
)
map_info
=
[
i
.
strip
()
for
i
in
res
.
split
(
','
)]
for
i
,
ele
in
enumerate
(
map_info
):
...
...
py_tools_ds/geo/raster/reproject.py
View file @
e0605d4d
# -*- coding: utf-8 -*-
from
pyresample.geometry
import
AreaDefinition
,
SwathDefinition
from
pyresample.utils
import
get_area_def
from
pyresample.bilinear
import
resample_bilinear
from
pyresample.kd_tree
import
resample_nearest
,
resample_gauss
,
resample_custom
import
numpy
as
np
import
warnings
import
multiprocessing
import
os
from
tempfile
import
TemporaryDirectory
from
typing
import
Union
,
Tuple
,
List
,
Any
,
TYPE_CHECKING
# noqa: F401
from
typing
import
Union
,
Tuple
,
List
,
Any
# noqa: F401
# custom
try
:
...
...
@@ -23,6 +18,10 @@ import rasterio
from
rasterio.warp
import
reproject
as
rio_reproject
from
rasterio.warp
import
calculate_default_transform
as
rio_calc_transform
from
rasterio.warp
import
Resampling
from
pyresample.geometry
import
AreaDefinition
,
SwathDefinition
from
pyresample.utils
import
get_area_def
from
pyresample.bilinear
import
resample_bilinear
from
pyresample.kd_tree
import
resample_nearest
,
resample_gauss
,
resample_custom
from
...dtypes.conversion
import
dTypeDic_NumPy2GDAL
from
..projection
import
EPSG2WKT
,
WKT2EPSG
,
isProjectedOrGeographic
,
prj_equal
,
proj4_to_WKT
...
...
@@ -34,9 +33,6 @@ from ...processing.progress_mon import ProgressBar
from
...compatibility.gdal
import
get_gdal_func
from
...processing.shell
import
subcall_with_output
if
TYPE_CHECKING
:
from
pyresample.geometry
import
AreaDefinition
,
SwathDefinition
__author__
=
"Daniel Scheffler"
...
...
@@ -555,7 +551,6 @@ class SensorMapGeometryTransformer(object):
os
.
environ
[
'OMP_NUM_THREADS'
]
=
'%d'
%
opts
[
'nprocs'
]
del
self
.
opts
[
'nprocs'
]
# from pyresample.geometry import SwathDefinition
self
.
lats
=
lats
self
.
lons
=
lons
self
.
swath_definition
=
SwathDefinition
(
lons
=
lons
,
lats
=
lats
)
...
...
@@ -673,7 +668,6 @@ class SensorMapGeometryTransformer(object):
out_extent
=
xmin
,
ymin
,
xmax
,
ymax
# get area_definition
# from pyresample.utils import get_area_def
area_definition
=
get_area_def
(
area_id
=
''
,
area_name
=
''
,
proj_id
=
''
,
...
...
@@ -694,9 +688,6 @@ class SensorMapGeometryTransformer(object):
:param target_geo_def: target geo definition
:return:
"""
# from pyresample.bilinear import resample_bilinear
# from pyresample.kd_tree import resample_nearest, resample_gauss, resample_custom
if
self
.
resamp_alg
==
'nearest'
:
opts
=
{
k
:
v
for
k
,
v
in
self
.
opts
.
items
()
if
k
not
in
[
'sigmas'
]}
result
=
resample_nearest
(
source_geo_def
,
data
,
target_geo_def
,
**
opts
)
...
...
@@ -785,7 +776,6 @@ class SensorMapGeometryTransformer(object):
proj4_args
=
proj4_to_dict
(
get_proj4info
(
proj
=
src_prj
))
# get area_definition
# from pyresample.geometry import AreaDefinition
self
.
area_definition
=
AreaDefinition
(
''
,
''
,
''
,
proj4_args
,
data
.
shape
[
1
],
data
.
shape
[
0
],
src_extent
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment