INNER CODE UNIT · Python

prep_river_data

aeturrell/coding-for-economists · data_set_prep.py:75

def prep_river_data():
    """
    Download the 10m rivers, lakes, and centerlines from and put in scratch/rivers/
    https://www.naturalearthdata.com/downloads/10m-physical-vectors/10m-rivers-lake-centerlines/
    TODO: automate download of shapefile
    """
    rivers = gpd.read_file(
        os.path.join("scratch", "rivers", "ne_10m_rivers_lake_centerlines.shp")
    )
    uk_bound_box = (-7.57216793459, 49.959999905, 1.68153079591, 58.6350001085)
    uk_polygon = shapely.geometry.box(*uk_bound_box, ccw=True)
    rivers = rivers[rivers.within(uk_polygon)]
    rivers.to_file(os.path.join("data", "geo", "rivers", "rivers.shp"))


def prep_covid_data():
    """
    Downloads covid data from uk gov't website and processes it ready for plotting.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…