Ejemplo n.º 1
0
def init_atlas(ir_at_dir, brdf_at_dir, month):
    """Initiate the IR and BRDF atlases in pyRTTOV."""
    iratlas = pyrttov.Atlas()
    iratlas.AtlasPath = ir_at_dir
    iratlas.loadIrEmisAtlas(month, ang_corr=True)

    brdf_atlas = pyrttov.Atlas()
    brdf_atlas.AtlasPath = brdf_at_dir
    brdf_atlas.loadBrdfAtlas(month)
    brdf_atlas.IncSea = True

    return iratlas, brdf_atlas
Ejemplo n.º 2
0
def setup_IR():
    config = Container()
    seviriRttov = pyrttov.Rttov()

    chan_list_seviri = (
        3, 4, 6, 9
    )  # https://nwp-saf.eumetsat.int/downloads/rtcoef_rttov12/ir_srf/rtcoef_msg_4_seviri_srf.html
    config.nchan = len(chan_list_seviri)
    config.chan_seviri_names = ('NIR16', 'IR39', 'WV73', 'IR108')

    seviriRttov.FileCoef = '{}/{}'.format(
        path_RTTOV, "/rtcoef_rttov12/rttov9pred54L/rtcoef_msg_4_seviri.dat")
    seviriRttov.FileSccld = '{}/{}'.format(
        path_RTTOV, "/rtcoef_rttov12/cldaer_visir/sccldcoef_msg_4_seviri.dat")

    seviriRttov.Options.StoreRad = False
    seviriRttov.Options.Nthreads = 12
    seviriRttov.Options.NprofsPerCall = 1000

    seviriRttov.Options.AddInterp = True
    seviriRttov.Options.AddSolar = True  # true with MFASIS
    seviriRttov.Options.AddClouds = True
    seviriRttov.Options.GridBoxAvgCloud = True
    seviriRttov.Options.UserCldOptParam = False
    seviriRttov.Options.VisScattModel = 1  # MFASIS=3  / 1 for IR sim necessary!
    seviriRttov.Options.IrScattModel = 2
    seviriRttov.Options.OzoneData = False
    seviriRttov.Options.VerboseWrapper = False
    seviriRttov.Options.Verbose = False  # False: do not print warnings

    # ApplyRegLimits=True: Input profiles can be clipped to the regression limits when the limits are exceeded
    seviriRttov.Options.ApplyRegLimits = True

    try:
        seviriRttov.loadInst(chan_list_seviri)
    except pyrttov.RttovError as e:
        sys.stderr.write("Error loading instrument(s): {!s}".format(e))
        sys.exit(1)

    irAtlas = pyrttov.Atlas()
    irAtlas.AtlasPath = '{}/{}'.format(path_RTTOV, "/emis_data")

    brdfAtlas = pyrttov.Atlas()
    brdfAtlas.AtlasPath = '{}/{}'.format(path_RTTOV, "/brdf_data")

    config.seviriRttov = seviriRttov
    config.irAtlas = irAtlas
    config.brdfAtlas = brdfAtlas
    return config
Ejemplo n.º 3
0
def setup_atlas(ir_atlas_dir, brdf_atlas_dir, mn, inst_inst, nchan, nprofiles):
    """Set up the emissivity and BRDF atlases."""
    irAtlas = pyrttov.Atlas()
    irAtlas.AtlasPath = ir_atlas_dir
    irAtlas.loadIrEmisAtlas(mn, inst_inst, ang_corr=True)

    brdfAtlas = pyrttov.Atlas()
    brdfAtlas.AtlasPath = brdf_atlas_dir
    brdfAtlas.loadBrdfAtlas(
        mn, inst_inst
    )  # Supply RTTOV object to enable single-instrument initialisation
    brdfAtlas.IncSea = False
    surfemisrefl = np.zeros((4, nprofiles, nchan), dtype=np.float64)
    surfemisrefl[:, :, :] = -1.
    surfemisrefl[0, :, :] = irAtlas.getEmisBrdf(inst_inst)
    surfemisrefl[1, :, :] = brdfAtlas.getEmisBrdf(inst_inst)
    return surfemisrefl
Ejemplo n.º 4
0
def setup_VIS():
    config = Container()
    seviriRttov = pyrttov.Rttov()

    # select channels
    chan_list_seviri = (
        1,
    )  # 2 )   # https://nwp-saf.eumetsat.int/downloads/rtcoef_rttov12/ir_srf/rtcoef_msg_4_seviri_srf.html
    config.nchan = len(chan_list_seviri)
    config.chan_seviri_names = (
        'VIS06', )  # 'VIS08') #, 'NIR16', 'IR39', 'WV73', 'IR108')

    # Set the options for each Rttov instance:
    # - the path to the coefficient file must always be specified
    # - turn RTTOV interpolation on (because input pressure levels differ from
    #   coefficient file levels)
    # - set the verbose_wrapper flag to true so the wrapper provides more
    #   information
    # - enable solar simulations for SEVIRI
    # - enable CO2 simulations for HIRS (the CO2 profiles are ignored for
    #   the SEVIRI and MHS simulations)

    seviriRttov.FileCoef = '{}/{}'.format(
        path_RTTOV,
        "/rtcoef_rttov13/rttov13pred54L/rtcoef_msg_4_seviri_o3co2.dat")
    # CLOUD COEFFICIENTS
    seviriRttov.FileSccld = '{}/{}'.format(
        path_RTTOV, "/rtcoef_rttov13/cldaer_visir/sccldcoef_msg_4_seviri.dat")
    # MFASIS LOOKUPTABLE
    # seviriRttov.FileMfasisCld = '{}/{}'.format(path_RTTOV,
    #                                       "/rtcoef_rttov12/mfasis_lut/rttov_mfasis_cld_msg_4_seviri_opac.H5")
    seviriRttov.FileMfasisCld = '{}/{}'.format(
        path_RTTOV,
        "/rtcoef_rttov13/mfasis_lut/rttov_mfasis_cld_msg_4_seviri_deff.H5")

    seviriRttov.Options.StoreRad = False
    seviriRttov.Options.Nthreads = 48
    seviriRttov.Options.NprofsPerCall = 840

    seviriRttov.Options.AddInterp = True
    seviriRttov.Options.AddSolar = True
    seviriRttov.Options.AddClouds = True
    seviriRttov.Options.GridBoxAvgCloud = True
    seviriRttov.Options.UserCldOptParam = False
    seviriRttov.Options.VisScattModel = 3  # MFASIS=3
    seviriRttov.Options.IrScattModel = 2
    seviriRttov.Options.OzoneData = False
    seviriRttov.Options.VerboseWrapper = False  #True
    seviriRttov.Options.Verbose = False  # False: do not print warnings

    # ApplyRegLimits=True: Input profiles can be clipped to the regression limits when the limits are exceeded
    seviriRttov.Options.ApplyRegLimits = True

    # Load the instruments: for HIRS and MHS do not supply a channel list and
    try:
        seviriRttov.loadInst(chan_list_seviri)
    except pyrttov.RttovError as e:
        sys.stderr.write("Error loading instrument(s): {!s}".format(e))
        sys.exit(1)

    irAtlas = pyrttov.Atlas()
    irAtlas.AtlasPath = '{}/{}'.format(path_RTTOV, "/emis_data")

    brdfAtlas = pyrttov.Atlas()
    brdfAtlas.AtlasPath = '{}/{}'.format(path_RTTOV, "/brdf_data")

    config.seviriRttov = seviriRttov
    config.irAtlas = irAtlas
    config.brdfAtlas = brdfAtlas
    return config