def read_oca_secondlayer_info(oca_nc): """Read ctth pressure file, for second layer.""" ctth2 = CtthObj() ctth2.pressure, ctth2.p_nodata = scale_oca_var( oca_nc['data']['measurement_data']['ctp']) ctth2.temperature, ctth2.t_nodata = scale_oca_var( oca_nc['data']['measurement_data']['ctt']) aux_dict = {"CTTH2": ctth2} aux_obj = AuxiliaryObj(aux_dict) return aux_obj
def read_oca_ctype_cmask_ctth_modis(oca_nc): """Read ctth pressure file.""" ctth = CtthObj() ctype = CtypeObj() cma = CmaObj() ctth.pressure, ctth.p_nodata = scale_oca_var_modis(oca_nc['ctp']) ctth.temperature, ctth.t_nodata = scale_oca_var_modis(oca_nc['ctt']) cma.cma_ext = np.where(oca_nc['moca_model_final'][:] > 0, 1, 0) ctype.phaseflag = None ctype.ct_conditions = None return ctype, cma, ctth
def read_cci_ctth(cci_nc): """Read cloud top: temperature, height and pressure from filename """ ctth = CtthObj() cth = cci_nc.variables['cth'][::] if hasattr(cth, 'mask'): cth_data = np.where(cth.mask, ATRAIN_MATCH_NODATA, cth.data) else: cth_data = cth.data # already scaled! logger.info("Setting ctth for non cloudy pixels do nodata ...") cth_data[cci_nc.variables['cc_total'][::] < 0.5] = ATRAIN_MATCH_NODATA cth_corr = cci_nc.variables['cth_corrected'][::] if hasattr(cth_corr, 'mask'): cth_data_corr = np.where(cth_corr.mask, ATRAIN_MATCH_NODATA, cth_corr.data) else: cth_data_corr = cth_corr.data # already scaled! logger.debug("Setting ctth for non cloudy pixels do nodata ...") cth_data_corr[cci_nc.variables['cc_total'][::] < 0.5] = ATRAIN_MATCH_NODATA ctth.h_gain = 1.0 ctth.h_intercept = 0.0 ctth.h_nodata = ATRAIN_MATCH_NODATA ctth.height = 1000*cth_data ctth.height_corr = 1000*cth_data_corr ctt = cci_nc.variables['ctt'][::] if hasattr(ctt, 'mask'): ctt_data = np.where(ctt.mask, ATRAIN_MATCH_NODATA, ctt.data) else: ctt_data = ctt.data logger.debug("Setting ctth for non cloudy pixels do nodata ...") ctt_data[cci_nc.variables['cc_total'][::] < 0.5] = ATRAIN_MATCH_NODATA ctth.t_gain = 1.0 ctth.t_intercept = 0.0 ctth.t_nodata = ATRAIN_MATCH_NODATA ctth.temperature = ctt_data ctp = cci_nc.variables['ctp'][::] if hasattr(ctp, 'mask'): ctp_data = np.where(ctp.mask, ATRAIN_MATCH_NODATA, ctp.data) # Upscaled else: ctp_data = ctp.data ctth.p_gain = 1.0 ctth.p_intercept = 0.0 ctth.p_nodata = ATRAIN_MATCH_NODATA logger.debug("Setting ctth for non cloudy pixels do nodata ...") ctp_data[cci_nc.variables['cc_total'][::] < 0.5] = ATRAIN_MATCH_NODATA ctth.pressure = ctp_data return ctth
def read_oca_ctype_cmask_ctth(oca_nc): """Read ctth pressure file.""" ctth = CtthObj() ctype = CtypeObj() cma = CmaObj() ctth.pressure, ctth.p_nodata = scale_oca_var( oca_nc['data']['measurement_data']['ctp']) ctth.temperature, ctth.t_nodata = scale_oca_var( oca_nc['data']['measurement_data']['ctt']) cma.cma_ext = np.where(ctth.pressure > 0, 1, 0) ctype.phaseflag = None ctype.ct_conditions = None return ctype, cma, ctth
def read_maia_ctype_cmask_ctth(maia_h5): """Read cloudtype and flag info from filename """ ctth = CtthObj() ctype = CtypeObj() cma = CmaObj() # ctth = CtthObj() cma.cma_ext maia_ct_bitflag = maia_h5['DATA']['CloudType'].value # bit-4-8 maia_ct = get_maia_ct_flag(maia_ct_bitflag) maia_ct[maia_ct == 7] = 6 maia_ct[maia_ct == 9] = 7 maia_ct[maia_ct == 11] = 8 maia_ct[maia_ct == 13] = 9 maia_ct[maia_ct == 15] = 11 maia_ct[maia_ct == 16] = 12 maia_ct[maia_ct == 17] = 13 maia_ct[maia_ct == 18] = 14 maia_ct[maia_ct == 19] = 10 ctype.cloudtype = maia_ct cma.cma_ext = 0 * maia_ct cma.cma_ext[maia_ct == 0] = 255 cma.cma_ext[maia_ct == 1] = 0 cma.cma_ext[maia_ct == 2] = 0 cma.cma_ext[maia_ct == 3] = 3 cma.cma_ext[maia_ct == 4] = 3 cma.cma_ext[np.logical_and(maia_ct > 4, maia_ct < 20)] = 1 # 0 -nodata # 1-2 clear # 34 -snow/ice # 5-19 cloudy ctype.phaseflag = None ctype.ct_conditions = None ctth.height = 5000.0 * maia_ct ctth.temperature = ATRAIN_MATCH_NODATA + 0 * maia_ct ctth.pressure = ATRAIN_MATCH_NODATA + 0 * maia_ct # ctype.landseaflag = return ctype, cma, ctth