Skip to content
Snippets Groups Projects
Commit 429d64f8 authored by Greg Quinn's avatar Greg Quinn
Browse files

Fork CrIS-VIIRS code to compare I5 instead of M bands

parent 9755a729
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -65,8 +65,8 @@ def cris2viirs(pre_filename, cris_filename, output_filename):
# write the output
writer = HdfWriter(output_filename)
writer.write('Bands', np.array([13, 15, 16], np.int32),
description='VIIRS M-band numbers')
writer.write('Bands', np.array([5], np.int32),
description='VIIRS I-band numbers')
writer.write('CrIS_Radiance', out_rad, fill=-9999.0)
writer.write('CrIS_Brightness_Temp', out_bt, fill=-9999.0)
writer.write('CrIS_Radiance_Imaginary', out_imag, fill=-9999.0)
......
......@@ -45,9 +45,8 @@ output_filename = sys.argv[-1]
# ingest SRF data for the given filenames
srf_info = [parse_srf_file(srf_filename) for srf_filename in srf_filenames]
# 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)
# create an array of the I-band numbers
viirs_bands = np.array([int(srf.channel[1:2]) for srf in srf_info], np.int32)
# create an array of CrIS wavenumbers
# FIXME: is this right?
......
......@@ -62,8 +62,8 @@ flags[missing_idxs] |= MISSING
# output to HDF
writer = HdfWriter(output_file)
writer.write('Bands', np.array([13, 15, 16], np.int32),
description='VIIRS M-band numbers')
writer.write('Bands', np.array([5], np.int32),
description='VIIRS I-band numbers')
writer.write('VIIRS_N', n)
writer.write('VIIRS_Radiance', rad_mean, fill=-9999.0)
writer.write('VIIRS_Radiance_Std', rad_std, fill=-9999.0,
......
......@@ -14,7 +14,7 @@ from viirs_bright import viirs_bright
def read_viirs_radiances(sdr_filenames):
rad = np.empty([len(sdr_filenames), 768, 3200], np.float64)
rad = np.empty([len(sdr_filenames), 1536, 6400], np.float64)
for i, sdr_filename in enumerate(sdr_filenames):
......@@ -38,13 +38,12 @@ def read_viirs_radiances(sdr_filenames):
return rad
if len(sys.argv) != 6:
print ('usage: python %s ' % sys.argv[0] +
'<coll_file> <m13_file> <m15_file> <m16_file> <out_file>')
if len(sys.argv) != 4:
print ('usage: python %s ' % sys.argv[0] + '<coll_file> <i5_file> <out_file>')
sys.exit(1)
coll_filename = sys.argv[1]
sdr_filenames = sys.argv[2:5]
out_filename = sys.argv[5]
sdr_filenames = sys.argv[2:3]
out_filename = sys.argv[3]
in_rads = read_viirs_radiances(sdr_filenames)
......@@ -55,13 +54,13 @@ viirs_across_idx = coll_sd.select('VIIRS_Across_Track_IDX')[:]
num_cris_scans, num_cris_angs, num_cris_dets = num_coll.shape
n_arr = np.empty([3, num_cris_scans, num_cris_angs, num_cris_dets],
n_arr = np.empty([1, num_cris_scans, num_cris_angs, num_cris_dets],
np.int32)
rad_sum_arr = np.empty([3, num_cris_scans, num_cris_angs, num_cris_dets],
rad_sum_arr = np.empty([1, num_cris_scans, num_cris_angs, num_cris_dets],
np.float64)
rad_squared_sum_arr = np.empty([3, num_cris_scans, num_cris_angs, num_cris_dets],
rad_squared_sum_arr = np.empty([1, num_cris_scans, num_cris_angs, num_cris_dets],
np.float64)
flags_arr = np.zeros([3, num_cris_scans, num_cris_angs, num_cris_dets],
flags_arr = np.zeros([1, num_cris_scans, num_cris_angs, num_cris_dets],
np.int8)
for cris_row in range(num_cris_scans):
......
......@@ -9,25 +9,19 @@ from bright import bright_wavelength, bright_wavenumber
# band center wavelengths in microns
centroid_wl = np.array([
4.06703067365, # M13
10.7343306552, # M15
11.8477889286 # M16
]).reshape([3, 1])
11.497860339744964 # I5
]).reshape([1, 1])
# center wavenumbers in inverse centimeters
centroid_wn = 1.0e4 / centroid_wl
a1 = np.array([
1.0006825717, # M13
1.00002170808, # M15
0.999660182876, # M16
]).reshape([3, 1])
0.99878213 # I5
]).reshape([1, 1])
a0 = np.array([
-0.272777656231, # M13
0.111109266746, # M15
0.165817224275, # M16
]).reshape([3, 1])
0.58485039 # I5
]).reshape([1, 1])
# helper function to make an array 2-dimensional. the first dimension
# is always left the same size. if there is only 1 dimension, a 2nd
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment