Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ray Garcia
himawari
Commits
2b2abcd5
Commit
2b2abcd5
authored
Mar 02, 2017
by
R.K.Garcia
Browse files
py3 integer division
parent
2f86d946
Changes
2
Hide whitespace changes
Inline
Side-by-side
himawari/HimawariInterface.py
View file @
2b2abcd5
HIMAWARI_INTERFACE
=
"""# 1 "../include/HimawariTypes.h"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 3
25
"<built-in>" 3
# 3
30
"<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "../include/HimawariTypes.h" 2
...
...
@@ -144,7 +144,7 @@ extern const struct HimawariSentinels DEFAULT_HCAST_SENTINELS;
# 1 "../include/HimawariConstants.h"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 3
25
"<built-in>" 3
# 3
30
"<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "../include/HimawariConstants.h" 2
...
...
@@ -170,7 +170,7 @@ const int NAVOPT_DEFAULT = NAVOPT_CORRECT_DATA;
# 1 "../include/HimawariErrors.h"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 3
25
"<built-in>" 3
# 3
30
"<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "../include/HimawariErrors.h" 2
...
...
@@ -203,7 +203,7 @@ const int WARNING_SOME_DATA_MISSING = 1;
# 1 "../include/HimawariFunctions.h"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 3
25
"<built-in>" 3
# 3
30
"<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "../include/HimawariFunctions.h" 2
...
...
himawari/HimawariScene.py
View file @
2b2abcd5
...
...
@@ -79,7 +79,7 @@ class HimawariScene(object):
@
property
def
satellite_name
(
self
):
meta
=
self
.
metadata
name
=
ffi
.
string
(
meta
.
satellite_name
).
strip
(
'
\0
'
)
name
=
str
(
meta
.
satellite_name
).
strip
(
'
\0
'
)
return
name
def
__init__
(
self
,
path
,
sentinel_invalid
=
None
,
sentinel_outside_scan
=
None
,
...
...
@@ -89,7 +89,7 @@ class HimawariScene(object):
sentinels
.
count_outside_scan
=
0
# use value specified in file
sentinels
.
derived_invalid
=
sentinel_invalid
if
(
sentinel_invalid
is
not
None
)
else
np
.
NAN
sentinels
.
derived_outside_scan
=
sentinel_outside_scan
if
(
sentinel_outside_scan
is
not
None
)
else
np
.
NAN
self
.
_handle
=
_hsd
.
openHimawariScene
(
path
,
ffi
.
NULL
,
sentinels
)
self
.
_handle
=
_hsd
.
openHimawariScene
(
path
.
encode
(
'UTF-8'
)
,
ffi
.
NULL
,
sentinels
)
self
.
_path
=
path
self
.
_match_band_sampling
=
downsample_to_band
self
.
_nav_options
=
nav_options
...
...
@@ -212,9 +212,9 @@ class HimawariScene(object):
def
_copyData
(
self
,
routine
,
line_stride
=
1
,
column_stride
=
1
,
line_offset
=
0
,
column_offset
=
0
,
lines
=
0
,
columns
=
0
,
downsample_to_band
=
0
):
if
lines
<=
0
:
lines
=
(
self
.
shape
[
0
]
-
line_offset
)
/
line_stride
lines
=
int
(
(
self
.
shape
[
0
]
-
line_offset
)
/
line_stride
)
if
columns
<=
0
:
columns
=
(
self
.
shape
[
1
]
-
column_offset
)
/
column_stride
columns
=
int
(
(
self
.
shape
[
1
]
-
column_offset
)
/
column_stride
)
# DEBUG
LOG
.
debug
(
'fetching %dx%d LxC data using %r'
%
(
lines
,
columns
,
routine
))
# data = np.empty(shape=(lines+100, columns), dtype=np.float32)
...
...
@@ -247,9 +247,9 @@ class HimawariScene(object):
"""
LOG
.
debug
(
'fetching %dx%d LxC coords'
%
(
lines
,
columns
))
if
lines
==
0
:
lines
=
(
self
.
shape
[
0
]
-
line_offset
)
/
line_stride
lines
=
int
(
(
self
.
shape
[
0
]
-
line_offset
)
/
line_stride
)
if
columns
==
0
:
columns
=
(
self
.
shape
[
1
]
-
column_offset
)
/
column_stride
columns
=
int
(
(
self
.
shape
[
1
]
-
column_offset
)
/
column_stride
)
ydata
=
np
.
empty
(
shape
=
(
lines
,
columns
),
dtype
=
np
.
float32
)
xdata
=
np
.
empty
(
shape
=
(
lines
,
columns
),
dtype
=
np
.
float32
)
...
...
@@ -439,10 +439,10 @@ def test_stride_scene(stem, stride=2):
# pprint(radA[1500:1504,1500:1504])
# pprint(radB[1500:1504,1500:1504])
assert
(
radB
.
shape
[
0
]
==
hime
.
shape
[
0
]
/
stride
)
assert
(
radB
.
shape
[
1
]
==
hime
.
shape
[
1
]
/
stride
)
assert
(
radA
.
shape
[
0
]
==
hime
.
shape
[
0
]
/
stride
)
assert
(
radA
.
shape
[
1
]
==
hime
.
shape
[
1
]
/
stride
)
assert
(
radB
.
shape
[
0
]
==
int
(
hime
.
shape
[
0
]
/
stride
)
)
assert
(
radB
.
shape
[
1
]
==
int
(
hime
.
shape
[
1
]
/
stride
)
)
assert
(
radA
.
shape
[
0
]
==
int
(
hime
.
shape
[
0
]
/
stride
)
)
assert
(
radA
.
shape
[
1
]
==
int
(
hime
.
shape
[
1
]
/
stride
)
)
return
np
.
all
(
np
.
equal
(
radA
,
radB
).
ravel
())
...
...
@@ -641,13 +641,13 @@ def test_jma_nav(stem):
pc
,
pl
=
(
c
-
1
),(
l
-
1
)
# convert to offsets properly
# pc,pl = (c-0),(l-1) # FIXME convert to offsets with extra WTF
print
(
"hPix=%10.5f hLin=%10.5f pl=%d pc=%d"
%
(
sx
[
pl
,
pc
],
sy
[
pl
,
pc
],
pl
,
pc
))
print
(
"(Lon,Lat)(%9.3f,%9.3f) --> count value = %
d
"
%
(
print
(
"(Lon,Lat)(%9.3f,%9.3f) --> count value = %
s
"
%
(
geo
.
longitude
[
pl
,
pc
],
geo
.
latitude
[
pl
,
pc
],
counts
[
pl
,
pc
]))
for
c
,
l
in
coords
:
pc
,
pl
=
(
c
-
1
),(
l
-
1
)
# convert to offsets properly
# pc,pl = (c-0),(l-1) # FIXME convert to offsets with extra WTF
print
(
"(Lon,Lat)(%9.3f,%9.3f) --> radiance = %
7.4f
"
%
(
geo
.
longitude
[
pl
,
pc
],
geo
.
latitude
[
pl
,
pc
],
rad
[
pl
,
pc
]))
"(Lon,Lat)(%9.3f,%9.3f) --> radiance = %
s
"
%
(
geo
.
longitude
[
pl
,
pc
],
geo
.
latitude
[
pl
,
pc
],
rad
[
pl
,
pc
]))
return
True
...
...
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