Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
intercal
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Fazlul Shahriar
intercal
Commits
886650f1
Commit
886650f1
authored
13 years ago
by
Greg Quinn
Browse files
Options
Downloads
Patches
Plain Diff
Read in Liam's wavenumber-based VIIRS SRFs
parent
1e5fab38
No related branches found
Tags
v2-iasi-viirs
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cris2viirs_pre.py
+38
-24
38 additions, 24 deletions
cris2viirs_pre.py
with
38 additions
and
24 deletions
cris2viirs_pre.py
+
38
−
24
View file @
886650f1
from
collections
import
deque
import
sys
import
numpy
as
np
...
...
@@ -16,37 +17,50 @@ def parse_srf_file(filename):
and weights.
"""
# create an SRF object with the channel number and arrays
# to represent the RSR
# this function will return a dict of SRF objects indexed by band
srf_info
=
{}
with
open
(
filename
)
as
f
:
wn_list
,
resp_list
=
[],
[]
for
line
in
f
:
if
line
.
startswith
(
'
#
'
):
continue
wl_nm
,
resp
=
(
float
(
x
)
for
x
in
line
.
split
())
wn
=
1e7
/
wl_nm
resp
/=
wn
**
2
wn_list
.
append
(
wn
)
resp_list
.
append
(
resp
)
srf
=
SRF
()
srf
.
channel
=
filename
[
17
:
20
]
srf
.
wavenumbers
=
np
.
array
(
wn_list
[::
-
1
])
srf
.
weights
=
np
.
array
(
resp_list
[::
-
1
])
return
srf
if
len
(
sys
.
argv
)
<
2
:
print
'
usage: %s <srf_file> ... <output_filename>
'
%
sys
.
argv
[
0
]
# skip header line
f
.
readline
()
# remainder of file contains records that each have the band
# number, the number of points in the SRF, the first then last
# wavenumber, then the SRF response values
tokens
=
deque
(
f
.
read
().
split
())
while
tokens
:
band
=
int
(
tokens
.
popleft
())
points
=
int
(
tokens
.
popleft
())
nu_begin
=
float
(
tokens
.
popleft
())
nu_end
=
float
(
tokens
.
popleft
())
nu
=
np
.
linspace
(
nu_begin
,
nu_end
,
points
)
F
=
np
.
array
([
float
(
tokens
.
popleft
())
for
i
in
range
(
points
)])
srf
=
SRF
()
srf
.
channel
=
band
srf
.
wavenumbers
=
nu
srf
.
weights
=
F
srf_info
[
band
]
=
srf
return
srf_info
if
len
(
sys
.
argv
)
!=
3
:
print
'
usage: %s <srf_file> <output_filename>
'
%
sys
.
argv
[
0
]
sys
.
exit
(
1
)
srf_filename
s
=
sys
.
argv
[
1
:
-
1
]
output_filename
=
sys
.
argv
[
-
1
]
srf_filename
=
sys
.
argv
[
1
]
output_filename
=
sys
.
argv
[
2
]
# ingest SRF data for the given filenames
srf_info
=
[
parse_srf_file
(
srf_filename
)
for
srf_filename
in
srf_filenames
]
srf_info
=
parse_srf_file
(
srf_filename
)
srf_info
=
[
srf_info
[
band
]
for
band
in
(
13
,
15
,
16
)]
# create an array of the M-band numbers
# FIXME: we'll need to support I-bands too
viirs_bands
=
np
.
array
([
int
(
srf
.
channel
[
1
:
3
])
for
srf
in
srf_info
],
np
.
int32
)
viirs_bands
=
np
.
array
([
srf
.
channel
for
srf
in
srf_info
],
np
.
int32
)
# create an array of CrIS wavenumbers
# FIXME: is this right?
...
...
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