def layer(parms, itime, step, which, config):
    """ Perform layering

    NOTE: here is where returns status will be added and used

    Parameters
    ----------
    parms : Parms
        parameters

    """        

    WhfLog.debug("LAYERING: %s  %d %s", itime.strftime("%Y%m%d%H"),
                  step, which)
    aaf.anal_assim_layer(itime.strftime('%Y%m%d%H'), '-%01d'%(step), which, config)
    WhfLog.debug("DONE LAYERING: %s  %d %s", itime.strftime("%Y%m%d%H"),
                  step, which)
def layer(parms, itime, step, which, config):
    """ Perform layering

    NOTE: here is where returns status will be added and used

    Parameters
    ----------
    parms : Parms
        parameters

    """

    WhfLog.debug("LAYERING: %s  %d %s", itime.strftime("%Y%m%d%H"), step,
                 which)
    aaf.anal_assim_layer(itime.strftime('%Y%m%d%H'), '-%01d' % (step), which,
                         config)
    WhfLog.debug("DONE LAYERING: %s  %d %s", itime.strftime("%Y%m%d%H"), step,
                 which)
def do_layering(config_file,parser,rap_downscale_dir, hrrr_downscale_dir, mrms_downscale_dir, fcst_hr, is_yellowstone=False):
    # Initialize some flags and lists,
    # assume that we only have RAP for now.
    request_hrrr = False
    request_mrms = False 
    rap_files = []
    hrrr_files = []
    mrms_files = []
    
    # Set flags to be used to determine which layers need to be layered.
    if hrrr_downscale_dir is not None:
        request_hrrr = True
    if mrms_downscale_dir is not None:
        request_mrmrs = True
  
    # We will always have RAP when calling do_layering.
    print "RAP downscale dir: %s"%rap_downscale_dir
    rap_file_paths = whf.get_filepaths(rap_downscale_dir)
    size = len(rap_file_paths)
    print("number of RAP files in %s, %s")%(rap_downscale_dir, size)
    if request_hrrr == True:
        print "HRRR true, layer RAP and HRRR"
        # Layer only RAP and HRRR
        hrrr_file_paths = whf.get_filepaths(hrrr_downscale_dir)
        if is_yellowstone:
            for rap in rap_file_paths:
                match = re.match(r'.*/RAP.*/([0-9]{10})/([0-9]{12}.LDASIN_DOMAIN1.*)',rap)
                model_run = match.group(1)
                aaf.anal_assim_layer(model_run,fcst_hr,"RAP_HRRR",config_file)

        else:
            for rap in rap_file_paths:
                match = re.match(r'.*/RAP.*/([0-9]{10})/([0-9]{12}.LDASIN_DOMAIN1.*)',rap)
                model_run = match.group(1)
                aaf.anal_assim_layer(model_run,fcst_hr,"RAP_HRRR", config_file)
 
        if request_mrms == True:
            # Layer all three: RAP, HRRR, and MRMS
            # Compare the YYYYMMDDHH/YYYYMMDDhh00.LDASIN_DOMAIN1.nc portions
            mrms_file_paths = whf.get_filepaths(mrms_downscale_dir)
            if is_yellowstone:    
                for rap in rap_file_paths:
                    match = re.match(r'.*/RAP.*([0-9]{10})/([0-9]{12}.LDASIN_DOMAIN1.*)',rap)
                    model_run = match.group(1)
                    whf.anal_assim_layer(model_run, fcst_hr, 'RAP_HRRR_MRMS',config_file) 
            else:
                # Testing on development/test host
                for rap in rap_file_paths:
                    match = re.match(r'.*/RAP.*([0-9]{10})/([0-9]{12}.LDASIN_DOMAIN1.*)',rap)
                    model_run = match.group(1)
                    whf.anal_assim_layer(model_run, fcst_hr, 'RAP_HRRR_MRMS',config_file) 
    else:
        # Only RAP requested, call layering with just RAP.     
        print ("Only RAP requested, layering called with just RAP")
        if is_yellowstone:    
            for rap in rap_file_paths:
                print("layering rap file: %s")%rap
                match = re.match(r'.*/RAP/.*([0-9]{10})/([0-9]{12}.LDASIN_DOMAIN1.*)',rap)
                model_run = match.group(1)
                print("model run: %s, fcst hr %s")%(model_run,fcst_hr)
                aaf.anal_assim_layer(model_run, fcst_hr, "RAP",config_file)
         
        else:
            for rap in rap_file_paths:
                match = re.match(r'.*/RAP/.*([0-9]{10})/([0-9]{12}.LDASIN_DOMAIN1.*)',rap)
                model_run = match.group(1)
                aaf.anal_assim_layer(model_run, fcst_hr, "RAP",config_file)