Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EdosL0Util
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
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
SIPS
EdosL0Util
Commits
e3a51b48
Commit
e3a51b48
authored
3 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Patches
Plain Diff
rdrgen Fix attr comparison issues, support additional mission names
parent
bb6b5e6d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
edosl0util/rdrgen.py
+18
-2
18 additions, 2 deletions
edosl0util/rdrgen.py
with
18 additions
and
2 deletions
edosl0util/rdrgen.py
+
18
−
2
View file @
e3a51b48
...
...
@@ -294,6 +294,14 @@ class BinnedTemporaryFileManager(object):
shutil
.
rmtree
(
self
.
dir
)
missions
=
{
"
npp
"
:
"
S-NPP/JPSS
"
,
"
snpp
"
:
"
S-NPP/JPSS
"
,
"
j01
"
:
"
NOAA-20/JPSS
"
,
"
jpss1
"
:
"
NOAA-20/JPSS
"
,
"
noaa20
"
:
"
NOAA-20/JPSS
"
,
}
class
RdrWriter
(
object
):
def
__init__
(
self
,
...
...
@@ -341,7 +349,7 @@ class RdrWriter(object):
self
.
_h5_file
,
{
"
Distributor
"
:
distributor
,
"
Mission_Name
"
:
"
S-NPP/JPSS
"
,
# FIXME: what will this be for J1?
"
Mission_Name
"
:
missions
[
self
.
sat
],
"
N_Dataset_Source
"
:
origin
,
"
N_HDF_Creation_Date
"
:
self
.
_format_date_attr
(
self
.
_creation_time
),
"
N_HDF_Creation_Time
"
:
self
.
_format_time_attr
(
self
.
_creation_time
),
...
...
@@ -443,13 +451,21 @@ class RdrWriter(object):
@staticmethod
def
_set_h5_attrs
(
h5_obj
,
attrs
):
attrs
=
_encodeall
(
attrs
)
def
tpcnv
(
v
):
if
isinstance
(
v
,
list
):
return
[
tpcnv
(
x
)
for
x
in
v
]
elif
isinstance
(
v
,
str
):
return
np
.
array
(
v
.
encode
(
'
ascii
'
),
dtype
=
"
S
"
)
elif
isinstance
(
v
,
bytes
):
return
np
.
array
(
v
,
dtype
=
"
S
"
)
return
v
# for some reason all the H5 attributes are in 2-D arrays in IDPS files
for
name
,
value
in
attrs
.
items
():
if
isinstance
(
value
,
list
):
value
=
[[
x
]
for
x
in
value
]
else
:
value
=
[[
value
]]
h5_obj
.
attrs
[
name
]
=
value
h5_obj
.
attrs
[
name
]
=
tpcnv
(
value
)
@staticmethod
def
_format_date_attr
(
t
):
...
...
This diff is collapsed.
Click to expand it.
Bruce Flynn
@brucef
mentioned in commit
341356fa
·
3 years ago
mentioned in commit
341356fa
mentioned in commit 341356fa7660a3056249c34d8cef36c9a4232ac3
Toggle commit list
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