Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goesr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ray Garcia
goesr
Commits
2d48cdd3
Commit
2d48cdd3
authored
7 years ago
by
Ray Garcia
Browse files
Options
Downloads
Patches
Plain Diff
more correct handling of band dimension in CMI and L1b
still need better handling of multi-band possibility
parent
59deb1bc
No related branches found
Branches containing commit
Tags
v20171013
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
goesr/l1b.py
+8
-5
8 additions, 5 deletions
goesr/l1b.py
with
8 additions
and
5 deletions
goesr/l1b.py
+
8
−
5
View file @
2d48cdd3
...
...
@@ -269,6 +269,7 @@ class PugFile(object):
or a multi-band NetCDF4 file and an offset in the band dimension
"""
nc
=
None
# if we opened the file for you, it's here
_band_offset
=
None
band
=
None
# band number
central_wavelength
=
None
# um
platform_id
=
None
# platform_ID as string
...
...
@@ -276,7 +277,7 @@ class PugFile(object):
time_span
=
None
# (start,end) datetime pair
timeline_id
=
None
# string, instrument mode
bit_depth
=
None
# bit depth
shape_m
=
None
# nadir-meter dy,dx approximation
shape_m
=
None
# nadir-meter dy,dx approximation
: FUTURE: deprecate this toward cell_size, too confusing vs .shape being whole array
scene_id
=
None
# string, type of scene e.g. "Full Disk"
resolution
=
None
# approximate nadir meters: 500, 1000, 2000, 4000
display_time
=
None
# str form of timeline YYYY-mm-dd HH:MM
...
...
@@ -305,15 +306,17 @@ class PugFile(object):
:param primary_var_name: radiance variable to convert to BT/Refl
:param band_offset: typically 0, eventually nonzero for multi-band files
"""
# FUTURE: handle band dimension more effectively, including surveying metadata for multi-band files
super
(
PugFile
,
self
).
__init__
()
if
not
isinstance
(
nc
,
nc4
.
Dataset
):
# then we can open and retain the file for our use
nc
=
nc4
.
Dataset
(
nc
)
self
.
nc
=
nc
self
.
primary_var_name
=
primary_var_name
primary_var
=
nc
[
primary_var_name
]
self
.
_band_offset
=
band_offset
self
.
band
=
int
(
nc
[
'
band_id
'
][
band_offset
])
# FUTURE: this has a band dimension
self
.
nav
=
nc_nav_values
(
nc
,
primary_var_name
)
self
.
shape
=
primary_var
.
shape
self
.
shape
=
primary_var
.
shape
[
-
2
:]
self
.
platform_id
=
nc
.
platform_ID
self
.
instrument_type
=
nc
.
instrument_type
self
.
instrument_name
=
"
ABI
"
if
"
Himawari
"
not
in
self
.
instrument_type
else
"
AHI
"
...
...
@@ -591,14 +594,14 @@ class PugCmiTools(PugFile):
def
data
(
self
):
if
None
is
self
.
nc
:
return
None
return
self
.
nc
[
self
.
primary_var_name
][:,
:].
squeeze
()
return
self
.
nc
[
self
.
primary_var_name
][
self
.
_band_offset
,
:,
:].
squeeze
()
@property
def
bt
(
self
):
if
None
is
self
.
nc
:
return
None
if
'
bt
'
==
self
.
bt_or_refl
:
return
self
.
nc
[
self
.
primary_var_name
][:,:].
squeeze
()
return
self
.
nc
[
self
.
primary_var_name
][
self
.
_band_offset
,
:,:].
squeeze
()
LOG
.
warning
(
'
cannot request bt from non-emissive band
'
)
return
None
...
...
@@ -607,7 +610,7 @@ class PugCmiTools(PugFile):
if
None
is
self
.
nc
:
return
None
if
'
refl
'
==
self
.
bt_or_refl
:
return
self
.
nc
[
self
.
primary_var_name
][:,:].
squeeze
()
return
self
.
nc
[
self
.
primary_var_name
][
self
.
_band_offset
,
:,:].
squeeze
()
LOG
.
warning
(
'
cannot request refl from non-reflectance band
'
)
return
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment