Beispiel #1
0
def rpLL_createdict(cf, ds, l6_info, output, called_by, flag_code):
    """
    Purpose:
     Creates a dictionary in ds to hold information about estimating ecosystem
     respiration using the Lasslop method.
    Usage:
    Side effects:
    Author: PRI
    Date April 2016
    """
    nrecs = int(ds.globalattributes["nc_nrecs"])
    # create the Lasslop settings directory
    if called_by not in l6_info.keys():
        l6_info[called_by] = {"outputs": {}, "info": {}, "gui": {}}
    # get the info section
    rpLL_createdict_info(cf, ds, l6_info[called_by], called_by)
    if ds.returncodes["value"] != 0:
        return
    # get the outputs section
    rpLL_createdict_outputs(cf, l6_info[called_by], output, called_by, flag_code)
    # create an empty series in ds if the output series doesn't exist yet
    Fc = pfp_utils.GetVariable(ds, l6_info[called_by]["info"]["source"])
    model_outputs = cf["EcosystemRespiration"][output][called_by].keys()
    for model_output in model_outputs:
        if model_output not in ds.series.keys():
            # create an empty variable
            variable = pfp_utils.CreateEmptyVariable(model_output, nrecs)
            variable["Attr"]["long_name"] = "Ecosystem respiration"
            variable["Attr"]["drivers"] = l6_info[called_by]["outputs"][model_output]["drivers"]
            variable["Attr"]["description_l6"] = "Modeled by Lasslop et al. (2010)"
            variable["Attr"]["target"] = l6_info[called_by]["info"]["target"]
            variable["Attr"]["source"] = l6_info[called_by]["info"]["source"]
            variable["Attr"]["units"] = Fc["Attr"]["units"]
            pfp_utils.CreateVariable(ds, variable)
    return
Beispiel #2
0
def DateTimeFromExcelDateAndTime(ds, dt_out, xlDate, xlTime):
    """ Get Datetime from Excel date and time fields."""
    xldate = ds.series[xlDate]
    xltime = ds.series[xlTime]
    nrecs = len(xldate["Data"])
    xldatetime = pfp_utils.CreateEmptyVariable("xlDateTime", nrecs)
    xldatetime["Data"] = xldate["Data"] + xltime["Data"]
    xldatetime["Attr"]["long_name"] = "Date/time in Excel format"
    xldatetime["Attr"]["units"] = "days since 1899-12-31 00:00:00"
    pfp_utils.CreateVariable(ds, xldatetime)
    pfp_utils.get_datetime_from_xldate(ds)
    return 1
Beispiel #3
0
def rpLL_createdict(cf, ds, l6_info, output, called_by, flag_code):
    """
    Purpose:
     Creates a dictionary in ds to hold information about estimating ecosystem
     respiration using the Lasslop method.
    Usage:
    Side effects:
    Author: PRI
    Date April 2016
    """
    nrecs = int(ds.globalattributes["nc_nrecs"])
    # make the L6 "description" attrubute for the target variable
    descr_level = "description_" + ds.globalattributes["nc_level"]
    # create the Lasslop settings directory
    if called_by not in list(l6_info.keys()):
        l6_info[called_by] = {"outputs": {}, "info": {}, "gui": {}}
    # get the info section
    rpLL_createdict_info(cf, ds, l6_info[called_by], called_by)
    if ds.returncodes["value"] != 0:
        return
    # get the outputs section
    rpLL_createdict_outputs(cf, l6_info[called_by], output, called_by,
                            flag_code)
    # create an empty series in ds if the output series doesn't exist yet
    Fco2 = pfp_utils.GetVariable(ds, l6_info[called_by]["info"]["source"])
    model_outputs = list(cf["EcosystemRespiration"][output][called_by].keys())
    for model_output in model_outputs:
        if model_output not in list(ds.series.keys()):
            l6_info["RemoveIntermediateSeries"]["not_output"].append(
                model_output)
            # create an empty variable
            variable = pfp_utils.CreateEmptyVariable(model_output, nrecs)
            variable["Attr"]["long_name"] = "Ecosystem respiration"
            variable["Attr"]["drivers"] = l6_info[called_by]["outputs"][
                model_output]["drivers"]
            variable["Attr"][descr_level] = "Modeled by Lasslop et al. (2010)"
            variable["Attr"]["target"] = l6_info[called_by]["info"]["target"]
            variable["Attr"]["source"] = l6_info[called_by]["info"]["source"]
            variable["Attr"]["units"] = Fco2["Attr"]["units"]
            pfp_utils.CreateVariable(ds, variable)
    # intermediate series to be deleted
    for item in [
            "alpha_LL", "beta_LL", "E0_LL", "k_LL", "rb_LL", "NEE_LL_all",
            "GPP_LL_all"
    ]:
        l6_info["RemoveIntermediateSeries"]["not_output"].append(item)
    return
Beispiel #4
0
def rpLT_createdict(cf, ds, l6_info, output, called_by, flag_code):
    """
    Purpose:
     Creates a dictionary in ds to hold information about estimating ecosystem
     respiration using the Lloyd-Taylor method.
    Usage:
    Author: PRI
    Date October 2015
    """
    nrecs = int(ds.globalattributes["nc_nrecs"])
    # make the L6 "description" attrubute for the target variable
    descr_level = "description_" + ds.globalattributes["nc_level"]
    # create the LT settings directory
    if called_by not in l6_info.keys():
        l6_info[called_by] = {"outputs": {}, "info": {"source": "Fc", "target": "ER"}, "gui": {}}
    # get the info section
    rpLT_createdict_info(cf, ds, l6_info[called_by], called_by)
    if ds.returncodes["value"] != 0:
        return
    # get the outputs section
    rpLT_createdict_outputs(cf, l6_info[called_by], output, called_by, flag_code)
    # create an empty series in ds if the output series doesn't exist yet
    Fc = pfp_utils.GetVariable(ds, l6_info[called_by]["info"]["source"])
    model_outputs = cf["EcosystemRespiration"][output][called_by].keys()
    for model_output in model_outputs:
        if model_output not in ds.series.keys():
            l6_info["RemoveIntermediateSeries"]["not_output"].append(model_output)
            # create an empty variable
            variable = pfp_utils.CreateEmptyVariable(model_output, nrecs)
            variable["Attr"]["long_name"] = "Ecosystem respiration"
            variable["Attr"]["drivers"] = l6_info[called_by]["outputs"][model_output]["drivers"]
            variable["Attr"][descr_level] = "Modeled by Lloyd-Taylor"
            variable["Attr"]["target"] = l6_info[called_by]["info"]["target"]
            variable["Attr"]["source"] = l6_info[called_by]["info"]["source"]
            variable["Attr"]["units"] = Fc["Attr"]["units"]
            pfp_utils.CreateVariable(ds, variable)
    return