Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
cerinterp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cerbere
cerinterp
Commits
55d2305d
Commit
55d2305d
authored
Aug 09, 2017
by
Jeff Piollé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed calculation of resolution to get rid of warning
parent
4b521c6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
resampler.py
cerinterp/resampler.py
+16
-4
No files found.
cerinterp/resampler.py
View file @
55d2305d
...
...
@@ -337,9 +337,20 @@ class Resampler(object):
# resolution = numpy.amin(abs(numpy.diff(srclat)))
resolution
=
1
else
:
# estimate resolution from latitude
y
,
x
=
srclat
.
shape
resolution
=
abs
(
srclat
[
y
/
2
,
x
/
2
]
-
srclat
[
y
/
2
+
1
,
x
/
2
])
#contiguous_lat = numpy.ma.flatnotmasked_contiguous(srclat[:, x / 2])
#if contiguous_lat is list:
# sublats =
resolution
=
numpy
.
ma
.
abs
(
srclat
[
0
:
-
1
,
x
/
2
]
-
srclat
[
1
:,
x
/
2
]
)
.
mean
()
if
resolution
is
numpy
.
ma
.
masked
:
logging
.
warning
(
"Data spatial resolution could not be estimated"
)
radius
=
resolution
*
100000.
/
2.
*
1.6
logging
.
debug
(
"Radius for resampling :
%
s"
,
radius
)
return
source_def
,
target_def
,
radius
...
...
@@ -347,7 +358,7 @@ class Resampler(object):
def
__get_closest_neighbour_info
(
cls
,
source_def
,
target_def
,
radius
=
None
,
radius
,
):
"""Returns the indexes for a closest neighbour resampling.
...
...
@@ -463,7 +474,8 @@ class Resampler(object):
target_lats
=
target
.
get_lat
()
.
astype
(
'float32'
)
if
isinstance
(
target
,
Grid
)
and
len
(
target_lons
.
shape
)
==
1
:
target_lons
,
target_lats
=
numpy
.
meshgrid
(
target_lons
,
target_lats
)
source_def
,
target_def
,
radius
=
Resampler
.
__get_pyresample_def
(
source_def
,
target_def
,
calc_radius
=
Resampler
.
__get_pyresample_def
(
source_lats
,
source_lons
,
source
.
__class__
.
__name__
,
...
...
@@ -488,7 +500,7 @@ class Resampler(object):
index_array
,
distance_array
\
=
Resampler
.
__get_closest_neighbour_info
(
source_def
,
target_def
,
radius
)
calc_
radius
)
first
=
False
if
not
valid_input_index
.
any
():
# return None if no source data can be resampled on the
...
...
Write
Preview
Markdown
is supported
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