Пример #1
0
def main(argv):

    heat_d, h2o_d = CD2.get_climate_data()
    the_db.query(queries.golm_starch_query)
    data = the_db.store_result().fetch_row(how=1, maxrows=9999999)

    print data[0]
    return None
    data = [DO.StarchData(d.keys(), d.values()) for d in data]

    golm_data = CD1.group_by([d for d in data if d.location_id == 4537],
                             'sub_id')
    dethl_data = CD1.group_by([d for d in data if d.location_id == 5519],
                              'sub_id')
    field_data = [d for d in data if d.location_id in FIELD_TRIALS]
    
    golm_results = CD1.compute_starch_rel_ctrl(golm_data, 4537, 
                                               [CD1.DROUGHT_ID])
    dethl_results = CD1.compute_starch_rel_ctrl(dethl_data, 5519,
                                                CD1.DETHLINGEN_DROUGHT_IDS)
    field_results = CD1.compute_starch_rel_field(field_data,
                                                 FIELD_TRIALS, CD1.DROUGHT_ID)
    # print field_results


    compiled = {}
    # compiled.update(golm_results)
    # compiled.update(dethl_results)
    compiled.update(field_results)
    for k, v in sorted(compiled.items()):
        if isinstance(k, str): continue
        # print k
        compiled[k].heat_sum, compiled[k].heat_nmeasures = heat_d[k[0]]
        compiled[k].limsloc = k[0]
        compiled[k].precipitation, compiled[k].prec_nmeasures = h2o_d[k[0]]
        # print v
    # print heat_d
    
    WT.write_table(compiled, WT.FIELDS)

    return None
    
    """
Пример #2
0
def main(argv):

    heat_d, h2o_d = CD2.get_climate_data()
    the_db.query(queries.golm_starch_query)
    data = the_db.store_result().fetch_row(how=1, maxrows=9999999)

    print data[0]
    return None
    data = [DO.StarchData(d.keys(), d.values()) for d in data]

    golm_data = CD1.group_by([d for d in data if d.location_id == 4537],
                             'sub_id')
    dethl_data = CD1.group_by([d for d in data if d.location_id == 5519],
                              'sub_id')
    field_data = [d for d in data if d.location_id in FIELD_TRIALS]

    golm_results = CD1.compute_starch_rel_ctrl(golm_data, 4537,
                                               [CD1.DROUGHT_ID])
    dethl_results = CD1.compute_starch_rel_ctrl(dethl_data, 5519,
                                                CD1.DETHLINGEN_DROUGHT_IDS)
    field_results = CD1.compute_starch_rel_field(field_data, FIELD_TRIALS,
                                                 CD1.DROUGHT_ID)
    # print field_results

    compiled = {}
    # compiled.update(golm_results)
    # compiled.update(dethl_results)
    compiled.update(field_results)
    for k, v in sorted(compiled.items()):
        if isinstance(k, str): continue
        # print k
        compiled[k].heat_sum, compiled[k].heat_nmeasures = heat_d[k[0]]
        compiled[k].limsloc = k[0]
        compiled[k].precipitation, compiled[k].prec_nmeasures = h2o_d[k[0]]
        # print v
    # print heat_d

    WT.write_table(compiled, WT.FIELDS)

    return None
    """
Пример #3
0
def main(argv):

    heat_d, h2o_d = CD2.get_climate_data()
    the_db.query(daisy_query)
    data = the_db.store_result().fetch_row(how=1, maxrows=0)
    data = [DO.StarchData(d.keys(), d.values()) for d in data]
    field_data = [d for d in data if d.location_id in CD2.FIELD_TRIALS]
    # print field_data
    field_results = CD1.compute_starch_rel_field(field_data,
                                                 CD2.FIELD_TRIALS, CD1.DROUGHT_ID)
    compiled = {}
    compiled.update(field_results)
    
    for k, v in sorted(compiled.items()):
        if isinstance(k, str): continue
        compiled[k].heat_sum, compiled[k].heat_nmeasures = heat_d[k[0]]
        compiled[k].limsloc = k[0]
        compiled[k].precipitation, compiled[k].prec_nmeasures = h2o_d[k[0]]

    WT.write_table(compiled, WT.FIELDS)
    return None
Пример #4
0
def main(argv):

    heat_d, h2o_d = CD2.get_climate_data()
    the_db.query(daisy_query)
    data = the_db.store_result().fetch_row(how=1, maxrows=0)
    data = [DO.StarchData(d.keys(), d.values()) for d in data]
    field_data = [d for d in data if d.location_id in CD2.FIELD_TRIALS]
    # print field_data
    field_results = CD1.compute_starch_rel_field(field_data, CD2.FIELD_TRIALS,
                                                 CD1.DROUGHT_ID)
    compiled = {}
    compiled.update(field_results)

    for k, v in sorted(compiled.items()):
        if isinstance(k, str): continue
        compiled[k].heat_sum, compiled[k].heat_nmeasures = heat_d[k[0]]
        compiled[k].limsloc = k[0]
        compiled[k].precipitation, compiled[k].prec_nmeasures = h2o_d[k[0]]

    WT.write_table(compiled, WT.FIELDS)
    return None