Go to the documentation of this file.
4 * DESCRIPTION: VIIRS product and LUT object classes and supporting data structures.
5 * This is not an executable but is required for cal_viirs.py and obc_viirs.py.
7 * Created on July 15, 2016
9 * Author: Samuel Anderson
15 l1b_type = {
"OBC_S":
"OBC",
25 vcst_type = {
"SVIMG_":
"SVIMG",
36 idps_type = {
"SVI01":
"VIIRS-I1-SDR",
37 "SVI02":
"VIIRS-I2-SDR",
38 "SVI03":
"VIIRS-I3-SDR",
39 "SVI04":
"VIIRS-I4-SDR",
40 "SVI05":
"VIIRS-I5-SDR",
41 "SVM01":
"VIIRS-M1-SDR",
42 "SVM02":
"VIIRS-M2-SDR",
43 "SVM03":
"VIIRS-M3-SDR",
44 "SVM04":
"VIIRS-M4-SDR",
45 "SVM05":
"VIIRS-M5-SDR",
46 "SVM06":
"VIIRS-M6-SDR",
47 "SVM07":
"VIIRS-M7-SDR",
48 "SVM08":
"VIIRS-M8-SDR",
49 "SVM09":
"VIIRS-M9-SDR",
50 "SVM10":
"VIIRS-M10-SDR",
51 "SVM11":
"VIIRS-M11-SDR",
52 "SVM12":
"VIIRS-M12-SDR",
53 "SVM13":
"VIIRS-M13-SDR",
54 "SVM14":
"VIIRS-M14-SDR",
55 "SVM15":
"VIIRS-M15-SDR",
56 "SVM16":
"VIIRS-M16-SDR",
57 "SVM16":
"VIIRS-M16-SDR",
58 "SVDNB":
"VIIRS-DNB-SDR",
59 "IVOBC":
"VIIRS-OBC-IP",
60 "IVCDB":
"VIIRS-DualGain-Cal-IP",
61 "RNSCA":
"VIIRS-Sci-RDR",
62 "GDNBO":
"VIIRS-DNB-SDR",
63 "GMODO":
"VIIRS-MOD-SDR",
64 "GIMGO":
"VIIRS-IMG-SDR"
67 lut_type = {
"TERRAIN-PATH":(0,
"TERRAIN_PATH_LUN"),
68 "LANDWATER-PATH":(0,
"LANDWATER_PATH_LUN"),
69 "CMNGEO-LEAPSEC":(0,
"LEAPSEC_FILE_LUN"),
70 "CMNGEO-PLANET-EPHEMERIS-LUT":(0,
"JPL_EPHEMERIS_LUN"),
71 "CMNGEO-SAA-LUT":(0,
"SAA_COEFFS_LUN"),
72 "CMNGEO-POLAR-WANDER-LUT":(0,
"POLAR_WANDER_LUN"),
73 "CMNGEO-PARAM-LUT":(120,
"CMNGEO_PARAM_LUT_LUN"),
74 "VIIRS-SDR-GEO-DNB-PARAM-LUT":(6664,
"GEOLOCATION_DNB_PARAMS_LUN"),
75 "VIIRS-SDR-GEO-IMG-PARAM-LUT":(6664,
"GEOLOCATION_IMG_PARAMS_LUN"),
76 "VIIRS-SDR-GEO-MOD-PARAM-LUT":(6664,
"GEOLOCATION_MOD_PARAMS_LUN"),
77 "VIIRS-SDR-DG-ANOMALY-DN-LIMITS-LUT":(768,
"SDR_DG_ANOMALY_DN_LIMITS_LUT_LUN"),
78 "VIIRS-SDR-DNB-DN0-LUT":(1560576,
"DNB_DN0_LUT_LUN"),
79 "VIIRS-SDR-DNB-RVF-LUT":(520192,
"DNB_RVS_LUT_LUN"),
80 "VIIRS-SDR-DNB-STRAY-LIGHT-LUT":(88,
"SDR_DNB_STRAY_LIGHT_LUT_LUN"),
81 "VIIRS-SDR-DNB-FRAME-TO-ZONE-LUT":(16256,
"DNB_FRAME_TO_ZONE_LUN"),
82 "VIIRS-SDR-DNB-C-COEFFS-LUT":(73728,
"DNB_C_COEFF_LUT_LUN"),
83 "VIIRS-SDR-DNB-F-PREDICTED-LUT":(24592,
"SDR_DNB_F_PREDICTED_LUT_LUN"),
84 "VIIRS-SDR-F-PREDICTED-LUT":(101408,
"SDR_F_PREDICTED_LUT_LUN"),
85 "VIIRS-SDR-GAIN-LUT":(176,
"SDR_GAIN_LUT_LUN"),
86 "VIIRS-SDR-HAM-ER-LUT":(120024,
"SDR_HAM_ER_LUT_LUN"),
87 "VIIRS-SDR-RTA-ER-LUT":(120024,
"SDR_RTA_ER_LUT_LUN"),
88 "VIIRS-SDR-OBC-ER-LUT":(120024,
"SDR_OBC_ER_LUT_LUN"),
89 "VIIRS-SDR-OBC-RR-LUT":(120024,
"SDR_OBC_RR_LUT_LUN"),
90 "VIIRS-SDR-EBBT-LUT":(16800056,
"SDR_EB_BT_LUT_LUN"),
91 "VIIRS-SDR-TELE-COEFFS-LUT":(928,
"SDR_TELEM_COEFFS_LUN"),
92 "VIIRS-SDR-SOLAR-IRAD-LUT":(799216,
"SDR_SOLAR_IRAD_LUT_LUN"),
93 "VIIRS-SDR-RSR-LUT":(224056,
"SDR_RSR_LUT_LUN"),
94 "VIIRS-SDR-OBS-TO-PIXELS-LUT":(25216,
"SDR_OBS_TO_PIXELS_LUT_LUN"),
95 "VIIRS-SDR-RADIOMETRIC-PARAM-LUT":(220,
"SDR_RADIOMETRIC_PARAMS_LUN"),
96 "VIIRS-SDR-RADIOMETRIC-PARAM-V2-LUT":(232,
"SDR_RADIOMETRIC_PARAMS_LUN"),
97 "VIIRS-SDR-RADIOMETRIC-PARAM-V3-LUT":(236,
"SDR_RADIOMETRIC_PARAMS_LUN"),
98 "VIIRS-SDR-QA-LUT":(3812,
"SDR_QA_LUT_LUN"),
99 "VIIRS-SDR-EMISSIVE-LUT":(48,
"SDR_EMISSIVE_LUT_LUN"),
100 "VIIRS-SDR-REFLECTIVE-LUT":(8,
"SDR_REFLECTIVE_LUT_LUN"),
101 "VIIRS-SDR-RVF-LUT":(17533440,
"SDR_RVS_LUT_LUN"),
102 "VIIRS-SDR-BB-TEMP-COEFFS-LUT":(240,
"SDR_BB_TEMP_CONSTANTS_LUN"),
103 "VIIRS-SDR-COEFF-A-LUT":(901120,
"SDR_COEFF_A_LUT_LUN"),
104 "VIIRS-SDR-COEFF-B-LUT":(450560,
"SDR_COEFF_B_LUT_LUN"),
105 "VIIRS-SDR-DELTA-C-LUT":(4505920,
"SDR_DELTA_C_LUT_LUN"),
106 "VIIRS-SOLAR-DIFF-VOLT-LUT":(1280,
"SOLAR_DIFF_VOLT_LUT_LUN"),
107 "VIIRS-SOLAR-DIFF-AGG-HISTORY-AUX-AC":(184,
"SOLAR_DIFF_HIST_AGG_AUX_LUN"),
108 "VIIRS-SOLAR-DIFF-AGG-LUT":(1208,
"SOLAR_DIFF_AGG_LUT_LUN"),
109 "VIIRS-SOLAR-DIFF-PROC-COEFFS-LUT":(176,
"SOLAR_DIFF_PROC_COEFFS_LUN"),
110 "VIIRS-SOLAR-DIFF-REFL-LUT":(2296848,
"SOLAR_DIFF_REFLECTANCE_LUT_LUN"),
111 "VIIRS-SOLAR-DIFF-ROT-MATRIX-LUT":(72,
"SOLAR_DIFF_ROT_MAT_LUT_LUN"),
112 "VIIRS-SOLAR-DIFF-RVF-LUT":(7168,
"SOLAR_DIFF_RVS_LUT_LUN"),
113 "VIIRS-SOLAR-DIFF-SDSM-BRDF-LUT":(19520,
"SOLAR_DIFF_SDSM_BRDF_LUT_LUN"),
114 "VIIRS-SOLAR-DIFF-SDSM-TIME-LUT":(20,
"SOLAR_DIFF_SDSM_TIME_LUT_LUN"),
115 "VIIRS-SOLAR-DIFF-SDSM-TRANS-SCREEN-LUT":(16608,
"SOLAR_DIFF_SDSM_TRN_SCR_LUT_LUN"),
116 "VIIRS-SOLAR-DIFF-TRANS-SCREEN-LUT":(19520,
"SOLAR_DIFF_TRANS_SCR_LUT_LUN"),
117 "VIIRS-SDR-CAL-AUTOMATE-LUT":(21408,
"SDR_CAL_AUTOMATE_LUT_LUN"),
118 "VIIRS-SDR-ONBOARD-DNB-OFFSETS-LUT":(520192,
"SDR_ONBOARD_DNB_OFFSETS_LUT_LUN"),
119 "VIIRS-SDR-DNB-GAIN-RATIOS-LUT":(27648,
"SDR_DNB_GAIN_RATIOS_LUT_LUN"),
120 "VIIRS-SDR-DNB-LGS-GAINS-LUT":(27664,
"SDR_DNB_LGS_GAINS_LUT_LUN"),
121 "VIIRS-SDR-DNB-STRAY-LIGHT-CORRECTION-LUT":(487943852,
"SDR_DNB_STRAY_LIGHT_CORRECTION_LUT_LUN"),
122 "VIIRS-SDR-RELATIVE-SPECTRAL-RESPONSE-LUT":(240064,
"SDR_RELATIVE_SPECTRAL_RESPONSE_LUT_LUN"),
123 "VIIRS-RSBAUTOCAL-BRDF-RTA-VIEW-LUT":(538832,
"RSBAUTOCAL_BRDF_RTA_VIEW_LUT_LUN"),
124 "VIIRS-RSBAUTOCAL-BRDF-SDSM-VIEW-LUT":(158080,
"RSBAUTOCAL_BRDF_SDSM_VIEW_LUT_LUN"),
125 "VIIRS-RSBAUTOCAL-DNB-DARK-SIGNAL-AUTOMATE-LUT":(147472,
"RSBAUTOCAL_DNB_DARK_SIGNAL_AUTOMATE_LUT_LUN"),
126 "VIIRS-RSBAUTOCAL-DNB-GAIN-RATIOS-AUTOMATE-LUT":(41480,
"RSBAUTOCAL_DNB_GAIN_RATIOS_AUTOMATE_LUT_LUN"),
127 "VIIRS-RSBAUTOCAL-DNB-LGS-GAIN-AUTOMATE-LUT":(32264,
"RSBAUTOCAL_DNB_LGS_GAIN_AUTOMATE_LUT_LUN"),
128 "VIIRS-RSBAUTOCAL-DNB-MOON-ILLUMINATION-LUT":(175200,
"RSBAUTOCAL_DNB_MOON_ILLUMINATION_LUT_LUN"),
129 "VIIRS-RSBAUTOCAL-H-AUTOMATE-LUT":(508,
"RSBAUTOCAL_H_AUTOMATE_LUT_LUN"),
130 "VIIRS-RSBAUTOCAL-H-LUT":(624,
"RSBAUTOCAL_H_LUT_LUN"),
131 "VIIRS-RSBAUTOCAL-ROT-MATRIX-LUT":(72,
"RSBAUTOCAL_ROT_MATRIX_LUT_LUN"),
132 "VIIRS-RSBAUTOCAL-RSB-F-AUTOMATE-LUT":(50180,
"RSBAUTOCAL_RSB_F_AUTOMATE_LUT_LUN"),
133 "VIIRS-RSBAUTOCAL-RVF-LUT":(7680,
"RSBAUTOCAL_RVF_LUT_LUN"),
134 "VIIRS-RSBAUTOCAL-SDSM-SOLAR-SCREEN-TRANS-LUT":(106240,
"RSBAUTOCAL_SDSM_SOLAR_SCREEN_TRANS_LUT_LUN"),
135 "VIIRS-RSBAUTOCAL-VOLT-LUT":(1280,
"RSBAUTOCAL_VOLT_LUT_LUN"),
136 "VIIRS-RSBAUTOCAL-SDSM-TIME-LUT":(20,
"RSBAUTOCAL_SDSM_TIME_LUT_LUN")
140 iopath_type = {
"Sci-RDR-LIST":(
"#VIIRS_SCIENCE_RDR_LUN",
"Sci_RDR_List"),
141 "Sci-RDR-IN-PATH":(
"RDR_INPUT_PATH_LUN",
"Sci_RDR"),
142 "OBCIP-IN-PATH":(
"OBC_IP_INPUT_PATH_LUN",
"OBCIP_INPUT"),
143 "IP-STAGING-PATH":(
"IP_STAGING_PATH_LUN",
"STAGING"),
144 "VRDR-OUT-PATH":(
"VERIFIED_RDR_PATH_LUN",
"VRDR"),
145 "GEO-OUT-PATH":(
"GEO_OUTPUT_PATH_LUN",
"GEO"),
146 "DNB-OUT-PATH":(
"DAYNIGHT_SDR_OUTPUT_PATH_LUN",
"SDR_DNB"),
147 "IMG-OUT-PATH":(
"IMAGERY_SDR_OUTPUT_PATH_LUN",
"SDR_IMG"),
148 "MOD-OUT-PATH":(
"MODERATE_SDR_OUTPUT_PATH_LUN",
"SDR_MOD"),
149 "OBCIP-OUT-PATH":(
"OBC_IP_OUTPUT_PATH_LUN",
"OBCIP"),
150 "DGIP-OUT-PATH":(
"DUAL_GAIN_IP_OUTPUT_PATH_LUN",
"DGIP"),
151 "SD-OUT-PATH":(
"SD_OUTPUT_PATH_LUN",
"SD_HISTORY"),
152 "CAL-HISTORY-PATH":(
"RSBAUTOCAL_HISTORY_AUX_LUN",
"HISTORY"),
153 "OBCIP-HISTORY-PATH":(
"RSBAUTOCAL_OBCIP_HISTORY_AUX_LUN",
"HISTORY")
169 print(self.vtype, self.itype)
180 m = (self.
time - s)/100 % 100
181 h = (self.
time - m*100 - s)/10000
185 s = self.endTime % 100
186 m = (self.endTime - s)/100 % 100
187 h = (self.endTime - m*100 - s)/10000
191 pos = str.find(
".L1B-M")
194 pos = str.find(
".L1A_SNPP")
197 pos = str.find(
".L1A_JPSS1")
200 pos = str.find(
".nc")
207 if not os.path.isdir(arg):
253 str_type = str[15:20]
254 if str.find(
".nc") < 0:
256 elif str_type
not in l1b_type:
259 return l1b_type[str_type]
262 if str.startswith(
"OA"):
264 elif str.startswith(
"VL1B"):
265 str_date = str[13:19]
266 elif str.startswith(
"PACE_OCI_SIM"):
267 str_date = str[13:21]
273 if str.startswith(
"OA"):
275 elif str.startswith(
"VL1B"):
276 str_time = str[22:28]
277 elif str.startswith(
"PACE_OCI_SIM"):
278 str_time = str[22:28]
307 m = (self.
endTime - s)/1000 % 100
308 h = (self.
endTime - m*1000 - s)/100000
312 if str.find(
"unscaled") > 0:
314 elif str.find(
".h5") < 0:
316 elif str[:6]
not in vcst_type:
319 return vcst_type[str[:6]]
322 if str[-3:] !=
".h5":
324 elif str[:5]
not in idps_type:
327 return idps_type[str[:5]]
331 return int(str[pos+2:pos+10])
335 return int(str[pos+2:pos+9])
339 return int(str[pos+2:pos+9])
344 if os.path.isdir(arg2):
360 path,filename = os.path.split(str)
361 pos = str.find(
"PolarWander")
363 return "CMNGEO-POLAR-WANDER-LUT"
364 pos = str.find(
"VIIRS-RSBAUTOCAL-BRDF-SCREEN-TRANSMISSION-PRODUCT-RTA-VIEW-LUT")
366 return "VIIRS-RSBAUTOCAL-BRDF-RTA-VIEW-LUT"
367 pos = str.find(
"VIIRS-RSBAUTOCAL-BRDF-SCREEN-TRANSMISSION-PRODUCT-SDSM-VIEW-LUT")
369 return "VIIRS-RSBAUTOCAL-BRDF-SDSM-VIEW-LUT"
370 pos = filename.find(
"_npp_")
378 pos = str.find(
"PolarWander")
380 return int(str[pos+35:pos+43])
381 pos = str.find(
"_npp_")
383 return int(str[pos+21:pos+29])
390 return int(str[pos+1:pos+9])
def parseL1Type(self, str)
def parseSdrEndTime(self, str)
def parseSdrDate(self, str)
def parseVcstType(self, str)
def getCorename(self, str)
def setOutputPath(self, arg)
def parseLutType(self, str)
def getGeoDFilename(self)
def parseL1Time(self, str)
def getGeoIFilename(self)
def parseVcstLutDate(self, str)
def parseIdpsType(self, str)
def parseL1Date(self, str)
def parseSdrStartTime(self, str)
def __init__(self, arg1, arg2)
def getGeoMFilename(self)
def __init__(self, arg1, arg2)
def parseLutDate(self, str)