Example #1
0
    ng_raw = r"{}/Platts_CA_maps/Natural_Gas_Pipelines.shp".format(dataPath)
    products_raw = r"{}/Platts_CA_maps/NGL_Pipelines.shp".format(dataPath)
    house_ll = r"{}/output/CA_property_xy_assess.dta".format(buildPath)

    # Temp files
    temp_prj = "temp_prj.shp"
    dq_temp = "dq_temp.shp"
    crude_utmCA = r"{}/output/crude_utmCA.shp".format(buildPath)
    ng_utmCA = r"{}/output/ng_utmCA.shp".format(buildPath)
    products_utmCA = r"{}/output/products_utmCA.shp".format(buildPath)
    dq_utmCA = r"{}/output/dq_utmCA.dta".format(buildPath)

    # California Transverse Mercator Projection
    # (http://spatialreference.org/ref/sr-org/7098/)
    # Also known as UTM Zone 10.5
    ctm = ctm_proj()

    # Reproject all pipelines
    reproject(crude_raw, crude_utmCA, ctm)
    logging.info("crude done")

    reproject(ng_raw, ng_utmCA, ctm)
    logging.info("ng done")

    reproject(products_raw, products_utmCA, ctm)
    logging.info("products done")

    # Now read in and reproject all house locations
    df = pd.read_stata(house_ll)
    df = df[['sr_property_id', 'sa_x_coord', 'sa_y_coord']]
    if df['sa_x_coord'][0] > 0:
Example #2
0
    #####################################
    #   CHECK THESE EVERY TIME!
    #####################################

    outfile = r"{}/output/CA_assess_to_sanbruno.dta".format(buildPath)
    if os.path.exists(outfile) == False:
        print('Writing to a new output file. Script continues.')
    else:
        raise OSError(
            'Output file already exists. Delete it manually to overwrite.')

    # San Bruno explosion location:
    sblat = 37.622460
    sblon = -122.441891
    sbproj = pyproj.Proj(ctm_proj())
    (sb_x, sb_y) = sbproj(sblon, sblat)

    # Selections
    # To keep all of a type of pipeline: "1==1"
    # To keep none of a type of pipeline: ""
    # To keep all houses: ""
    selections = {}
    selections['crude'] = ""
    selections['ng'] = (
        "rec['properties']['OWNER']=='Pacific Gas and Electric Co.' and "
        " rec['properties']['SYSTEM1']=='132'")
    selections['products'] = ""

    # Filepaths
    crude_utmCA = r"{}/output/crude_utmCA.shp".format(buildPath)