예제 #1
0
def Distance(loc1, loc2):
    # print(loc1.x, loc1.y, loc2.x, loc2.y)
    return Haversine(loc1.y, loc1.x, loc2.y, loc2.x)


def Fetch(df, key_col, key, value):
    #counties['disposal.y'].loc[counties['COUNTY']=='San Diego'].values[0]
    return df[value].loc[df[key_col] == key].values[0]


############################################################

# bring in biomass data
gbm_pts, tbm_pts = MergeInventoryAndCounty(
    gross_inventory=opj(DATA_DIR, "raw/biomass.inventory.csv"),
    technical_inventory=opj(DATA_DIR, "raw/biomass.inventory.technical.csv"),
    county_shapefile=opj(DATA_DIR,
                         "raw/CA_Counties/CA_Counties_TIGER2016.shp"),
    fips_data=opj(DATA_DIR, "interim/CA_FIPS.csv"))

# mini gdfs of county wastes (tbm - location and MSW for 2014)
counties = gpd.read_file(opj(DATA_DIR, "clean/techbiomass_pts.shp"))
counties = counties.to_crs(epsg=4326)
# counties = tbm_pts

#counties = counties[(counties['biomass.ca'] == "organic fraction municipal solid waste") & (counties['year'] == 2014)].copy()
counties = counties[(counties['biomass.fe'] == "FOOD")
                    & (counties['year'] == 2014)].copy()

counties = counties[['FIPS', 'COUNTY', 'disposal.y', 'geometry']]
# subset out four counties
counties = counties[(counties['COUNTY'] == "Los Angeles") |
예제 #2
0
def Distance(loc1, loc2):
    # print(loc1.x, loc1.y, loc2.x, loc2.y)
    return Haversine(loc1.y, loc1.x, loc2.y, loc2.x)


def Fetch(df, key_col, key, value):
    #counties['disposal'].loc[counties['COUNTY']=='San Diego'].values[0]
    return df[value].loc[df[key_col]==key].values[0]

############################################################
# LOAD DATA

# bring in biomass data
gbm_pts, tbm_pts = MergeInventoryAndCounty(
    gross_inventory     = opj(DATA_DIR, "raw/biomass.inventory.csv"),
    technical_inventory = opj(DATA_DIR, "raw/biomass.inventory.technical.csv"),
    county_shapefile    = opj(DATA_DIR, "raw/CA_Counties/CA_Counties_TIGER2016.shp"),
    counties_popcen     = opj(DATA_DIR, "counties/CenPop2010_Mean_CO06.txt")
)

counties = tbm_pts # could change to GBM

# facilities
facilities = gpd.read_file(opj(DATA_DIR, "clean/clean_swis.shp"))
# facilities = facilities.to_crs(epsg=4326)
# facilities = facilities[0:10]

######################################################################
# RANGELAND FIX!
######################################################################

# Import rangelands