コード例 #1
0
def main(argv=None):
    """
    Download the PCO2A data from the Gold Copy THREDDS server and create the
    QARTOD gross range and climatology test lookup tables.
    """
    # setup the input arguments
    args = inputs(argv)
    site = args.site
    node = args.node
    sensor = args.sensor
    cut_off = args.cut_off

    # create the initial HITL annotation blocks, the QARTOD gross range and climatology lookup values, and
    # the climatology table for the pco2_seawater parameter
    annotations, gr_lookup, clm_lookup, atm_table, ssw_table = generate_qartod(
        site, node, sensor, cut_off)

    # save the resulting annotations and qartod lookups and tables
    out_path = os.path.join(os.path.expanduser('~'), 'ooidata/qartod/pco2a')
    out_path = os.path.abspath(out_path)
    if not os.path.exists(out_path):
        os.makedirs(out_path)

    # save the annotations to a csv file for further processing
    csv_names = [
        'id', 'subsite', 'node', 'sensor', 'method', 'stream', 'parameters',
        'beginDate', 'endDate', 'exclusionFlag', 'qcFlag', 'source',
        'annotation'
    ]
    anno_csv = '-'.join([site, node, sensor]) + '.quality_annotations.csv'
    annotations.to_csv(os.path.join(out_path, anno_csv),
                       index=False,
                       columns=csv_names)

    # save the gross range values to a csv for further processing
    csv_names = [
        'subsite', 'node', 'sensor', 'stream', 'parameter', 'qcConfig',
        'source'
    ]
    gr_csv = '-'.join([site, node, sensor]) + '.gross_range.csv'
    gr_lookup.to_csv(os.path.join(out_path, gr_csv),
                     index=False,
                     columns=csv_names)

    # save the climatology values and table to a csv for further processing
    csv_names = [
        'subsite', 'node', 'sensor', 'stream', 'parameters',
        'climatologyTable', 'source'
    ]
    clm_csv = '-'.join([site, node, sensor]) + '.climatology.csv'
    atm_tbl = '-'.join([site, node, sensor]) + '-partial_pressure_co2_atm.csv'
    ssw_tbl = '-'.join([site, node, sensor]) + '-partial_pressure_co2_ssw.csv'
    clm_lookup.to_csv(os.path.join(out_path, clm_csv),
                      index=False,
                      columns=csv_names)
    with open(os.path.join(out_path, atm_tbl), 'w') as clm:
        clm.write(atm_table[0])
    with open(os.path.join(out_path, ssw_tbl), 'w') as clm:
        clm.write(ssw_table[0])
コード例 #2
0
def main(argv=None):
    """
    Download the PRESF data from the Gold Copy THREDDS server and create the
    QARTOD gross range and climatology test lookup tables.
    """
    # setup the input arguments
    args = inputs(argv)
    site = args.site
    node = args.node
    sensor = args.sensor
    cut_off = args.cut_off

    # create the QARTOD gross range and climatology lookup values and tables
    annotations, gr_lookup, clm_lookup, clm_table = generate_qartod(
        site, node, sensor, cut_off)

    # save the downloaded annotations and qartod lookups and tables
    out_path = os.path.join(os.path.expanduser('~'), 'ooidata/qartod/presf')
    out_path = os.path.abspath(out_path)
    if not os.path.exists(out_path):
        os.makedirs(out_path)

    # save the annotations to a csv file for further processing
    anno_csv = '-'.join([site, node, sensor]) + '.quality_annotations.csv'
    annotations.to_csv(os.path.join(out_path, anno_csv),
                       index=False,
                       columns=ANNO_HEADER)

    # save the gross range values to a csv for further processing
    gr_csv = '-'.join([site, node, sensor]) + '.gross_range.csv'
    gr_lookup.to_csv(os.path.join(out_path, gr_csv),
                     index=False,
                     columns=GR_HEADER)

    # save the climatology values and table to a csv for further processing
    clm_csv = '-'.join([site, node, sensor]) + '.climatology.csv'
    clm_lookup.to_csv(os.path.join(out_path, clm_csv),
                      index=False,
                      columns=CLM_HEADER)
    parameters = [
        'seawater_temperature', 'abs_seafloor_pressure',
        'seawater_temperature', 'abs_seafloor_pressure',
        'presf_tide_temperature', 'presf_tide_pressure'
    ]
    for i in range(len(parameters)):
        tbl = '-'.join([site, node, sensor, parameters[i]]) + '.csv'
        with open(os.path.join(out_path, tbl), 'w') as clm:
            clm.write(clm_table[i])
コード例 #3
0
def main(argv=None):
    """
    Download the PHSEN data from the Gold Copy THREDDS server and create the
    QARTOD gross range and climatology test lookup tables.
    """
    # setup the input arguments
    args = inputs(argv)
    site = args.site
    node = args.node
    sensor = args.sensor
    cut_off = args.cut_off

    # create the initial HITL annotation blocks, the QARTOD gross range and climatology lookup values, and
    # the climatology table for the seawater_ph parameter
    annotations, gr_lookup, clm_lookup, clm_table = generate_qartod(
        site, node, sensor, cut_off)

    # save the resulting annotations and qartod lookups and tables
    out_path = os.path.join(os.path.expanduser('~'), 'ooidata/qartod/phsen')
    out_path = os.path.abspath(out_path)
    if not os.path.exists(out_path):
        os.makedirs(out_path)

    # save the annotations to a csv file for further processing
    anno_csv = '-'.join([site, node, sensor]) + '.quality_annotations.csv'
    annotations.to_csv(os.path.join(out_path, anno_csv),
                       index=False,
                       columns=ANNO_HEADER)

    # save the gross range values to a csv for further processing
    gr_csv = '-'.join([site, node, sensor]) + '.gross_range.csv'
    gr_lookup.to_csv(os.path.join(out_path, gr_csv),
                     index=False,
                     columns=GR_HEADER)

    # save the climatology values and table to a csv for further processing
    clm_csv = '-'.join([site, node, sensor]) + '.climatology.csv'
    clm_tbl = '-'.join([site, node, sensor]) + '-seawater_ph.csv'
    clm_lookup.to_csv(os.path.join(out_path, clm_csv),
                      index=False,
                      columns=CLM_HEADER)
    with open(os.path.join(out_path, clm_tbl), 'w') as clm:
        clm.write(clm_table[0])