Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
def read_cci_cma(cci_nc):
    """Read cloudtype and flag info from filename
    """
    cma = CmaObj()
    # cci_nc.variables['cc_total'][:])
    # cci_nc.variables['ls_flag'][:])
    # ctype = CtypeObj()
    # pps 0 cloudfree 3 cloudfree snow 1: cloudy, 2:cloudy
    # cci lsflag 0:sea 1:land
    cma.cma_ext = 0*cci_nc.variables['lsflag'][::]
    cma.cma_ext[cci_nc.variables['cc_total'][::] > 0.5] = 1
    # ctype.landseaflag = cci_nc.variables['lsflag'][::]
    return cma
Exemplo n.º 4
0
def read_patmosx_ctype_cmask_ctth(patmosx_nc):
    """Read cloudtype and flag info from filename."""
    ctth = CtthObj()
    ctype = CtypeObj()
    cma = CmaObj()
    ctth.height = patmosx_nc.variables['cld_height_acha'][0, :, :].astype(np.float)
    ctth.h_nodata = patmosx_nc.variables['cld_height_acha']._FillValue
    if np.ma.is_masked(ctth.height):
        ctth.height.data[ctth.height.mask] = ATRAIN_MATCH_NODATA
        ctth.height = ctth.height.data
    ctth.height = 1000*ctth.height
    cf = patmosx_nc.variables['cloud_fraction'][0, :, :].astype(np.float)
    cma.cma_ext = np.where(cf >= 0.5, 1, 0)
    if np.ma.is_masked(cf):
        cma.cma_ext[cf.mask] = 255
    ctype.phaseflag = None
    ctype.ct_conditions = None
    return ctype, cma, ctth
Exemplo n.º 5
0
def read_oca_cmask_modis(oca_nc):
    """Read ctth pressure file."""
    cma = CmaObj()
    cma.cma_ext = np.where(oca_nc['flag_cm'][:] > 1, 1, 0)
    cma.cma_bin = np.int64(0 * cma.cma_ext.copy())
    cma.cma_bin[oca_nc['flag_cm'][:] == 3] = 1.0
    cma.cma_bin[oca_nc['flag_cm'][:] == 4] = 1.0
    return cma
Exemplo n.º 6
0
def read_patmosx_ctype_cmask_ctth_hdf(patmosx_hdf):
    """Read cloudtype and flag info from filename."""
    ctth = CtthObj()
    ctype = CtypeObj()
    cma = CmaObj()
    name = 'cld_height_acha'
    height_unscaled = np.array(patmosx_hdf.select(name).get())
    offset = patmosx_hdf.select(name).attributes()['add_offset']
    gain = patmosx_hdf.select(name).attributes()['scale_factor']
    ctth.height = height_unscaled * gain + offset
    ctth.h_nodata = patmosx_hdf.select(name)._FillValue
    # ctth.height = 1000*ctth.height
    ctth.height[height_unscaled == ctth.h_nodata] = ATRAIN_MATCH_NODATA
    name = 'cloud_fraction'
    cf_unscaled = np.array(patmosx_hdf.select(name).get())
    offset = patmosx_hdf.select(name).attributes()['add_offset']
    gain = patmosx_hdf.select(name).attributes()['scale_factor']
    cf = cf_unscaled * gain + offset
    cf[cf_unscaled == patmosx_hdf.select(name)._FillValue] = ATRAIN_MATCH_NODATA
    cma.cma_ext = np.where(cf >= 0.5, 1, 0)
    ctype.phaseflag = None
    ctype.ct_conditions = None
    return ctype, cma, ctth
Exemplo n.º 7
0
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