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
a79f7394
Commit
a79f7394
authored
Oct 11, 2017
by
R.K.Garcia
Browse files
implement band_id dimension when as_cmi is requested
parent
0c8fbff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
himawari/ahi2cmi.py
View file @
a79f7394
...
...
@@ -525,12 +525,16 @@ class HimawariAHIasCMIP(object):
else
:
# return floating point values
return
line
,
column
def
walk
(
self
,
extra_data_attrs
=
{}):
def
walk
(
self
,
extra_data_attrs
=
{}
,
as_cmi
=
False
):
"""
iterate PVDA frames equivalent to a PUG nc_walk
"""
BAND_ID_DIM
=
'band_id'
# root
yield
self
.
p
(),
None
,
self
.
_pug_global_dims
,
self
.
_pug_global_attrs
gdims
=
OrderedDict
(
self
.
_pug_global_dims
)
if
as_cmi
:
gdims
[
BAND_ID_DIM
]
=
1
yield
self
.
p
(),
None
,
gdims
,
self
.
_pug_global_attrs
# nav structure
yield
self
.
p
(
self
.
_projection_name
),
np
.
int32
(
0
),
{},
self
.
nav
...
...
@@ -538,6 +542,10 @@ class HimawariAHIasCMIP(object):
# band_wavelength in µm
yield
self
.
p
(
'band_wavelength'
),
np
.
float64
(
self
.
central_wavelength
),
{},
{}
# band number, primarily for CMI
if
as_cmi
:
yield
self
.
p
(
'band_id'
),
np
.
array
([
self
.
band
],
dtype
=
np
.
int8
),
OrderedDict
({
BAND_ID_DIM
:
gdims
[
BAND_ID_DIM
]}),
{}
# y and x variables and friends
for
each
in
self
.
pvda_yx
():
yield
each
...
...
@@ -550,8 +558,13 @@ class HimawariAHIasCMIP(object):
yield
each
# we almost forgot! the data itself
v
=
self
.
data
d
=
self
.
data_dims
if
not
as_cmi
:
# SCMI has no band_id dimension
v
=
self
.
data
d
=
self
.
data_dims
else
:
v
=
self
.
data
.
reshape
((
1
,)
+
tuple
(
self
.
data
.
shape
))
d
=
OrderedDict
({
BAND_ID_DIM
:
gdims
[
BAND_ID_DIM
]})
d
.
update
(
self
.
data_dims
)
a
=
dict
(
self
.
data_attrs
)
a
.
update
(
extra_data_attrs
)
yield
self
.
p
(
self
.
_data_name
),
v
,
d
,
a
...
...
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