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
b44e94a5
Commit
b44e94a5
authored
Sep 28, 2017
by
R.K.Garcia
Browse files
caching of navigation speeds up cmi_changer a LOT
parent
23fb0bcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
himawari/ahi2cmi.py
View file @
b44e94a5
...
...
@@ -51,6 +51,9 @@ class HimawariAHIasCMIP(object):
_data_name
=
DEFAULT_CMIP_NAME
_projection_name
=
DEFAULT_CMIP_PROJECTION_NAME
_when
=
None
y
=
None
x
=
None
shape_m
=
None
def
__init__
(
self
,
path
,
as_radiances
=
False
,
data_name
=
None
):
"""
...
...
@@ -68,6 +71,10 @@ class HimawariAHIasCMIP(object):
data_name
=
DEFAULT_CMIP_NAME
if
not
as_radiances
else
DEFAULT_CMIP_RAD_NAME
self
.
_data_name
=
data_name
self
.
_when
=
datetime
.
utcnow
()
# cache the y and x angles
self
.
y
=
self
.
_y
self
.
x
=
self
.
_x
self
.
shape_m
=
self
.
_shape_m
def
p
(
self
,
*
strings
):
return
(
self
.
path
,)
+
tuple
(
strings
)
...
...
@@ -590,7 +597,7 @@ class HimawariAHIasCMIP(object):
return
self
.
_hs
.
radiances
()
@
property
def
y
(
self
):
def
_
y
(
self
):
"""
negate y values to match PUG convention
also see yx_pvda regarding negation of scale_factor and add_offset to keep monotonic increasing unscaled values
...
...
@@ -600,7 +607,7 @@ class HimawariAHIasCMIP(object):
return
-
y
.
squeeze
()
@
property
def
x
(
self
):
def
_
x
(
self
):
_
,
x
=
self
.
_hs
.
coords
(
lines
=
1
)
return
x
.
squeeze
()
...
...
@@ -633,7 +640,7 @@ class HimawariAHIasCMIP(object):
return
np
.
require
(
self
.
x
,
dtype
=
np
.
float64
)
*
self
.
perspective_point_height
@
property
def
shape_m
(
self
):
def
_
shape_m
(
self
):
"""
:return: (y, x) nadir-meters nominal size of a cell
"""
...
...
@@ -641,7 +648,9 @@ class HimawariAHIasCMIP(object):
h
=
self
.
perspective_point_height
return
mb
.
my
*
h
,
mb
.
mx
*
h
cell_size
=
shape_m
@
property
def
cell_size
(
self
):
return
self
.
shape_m
@
property
def
origin
(
self
):
...
...
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