pudl.convert.censusdp1tract_to_sqlite

Convert the US Census DP1 ESRI GeoDatabase into an SQLite Database.

This is a thin wrapper around the GDAL ogr2ogr command line tool. We use it to convert the Census DP1 data which is distributed as an ESRI GeoDB into an SQLite DB. The module provides ogr2ogr with the Census DP 1 data from the PUDL datastore, and directs it to be output into the user’s SQLite directory alongside our other SQLite Databases (ferc1.sqlite and pudl.sqlite)

Note that the ogr2ogr command line utility must be available on the user’s system for this to work. This tool is part of the pudl-dev conda environment, but if you are using PUDL outside of the conda environment, you will need to install ogr2ogr separately. On Debian Linux based systems such as Ubuntu it can be installed with sudo apt-get install gdal-bin (which is what we do in our CI setup and Docker images.)

Module Contents

Functions

censusdp1tract_to_sqlite(pudl_settings=None, year=2010)

Use GDAL's ogr2ogr utility to convert the Census DP1 GeoDB to an SQLite DB.

parse_command_line(argv)

Parse command line arguments. See the -h option.

main()

Convert the Census DP1 GeoDatabase into an SQLite Database.

Attributes

logger

pudl.convert.censusdp1tract_to_sqlite.logger[source]
pudl.convert.censusdp1tract_to_sqlite.censusdp1tract_to_sqlite(pudl_settings=None, year=2010)[source]

Use GDAL’s ogr2ogr utility to convert the Census DP1 GeoDB to an SQLite DB.

The Census DP1 GeoDB is read from the datastore, where it is stored as a zipped archive. This archive is unzipped into a temporary directory so that ogr2ogr can operate on the ESRI GeoDB, and convert it to SQLite. The resulting SQLite DB file is put in the PUDL output directory alongside the ferc1 and pudl SQLite databases.

Parameters
  • pudl_settings (dict) – A PUDL settings dictionary.

  • year (int) – Year of Census data to extract (currently must be 2010)

Returns

None

pudl.convert.censusdp1tract_to_sqlite.parse_command_line(argv)[source]

Parse command line arguments. See the -h option.

Parameters

argv (str) – Command line arguments, including caller filename.

Returns

Dictionary of command line arguments and their parsed values.

Return type

dict

pudl.convert.censusdp1tract_to_sqlite.main()[source]

Convert the Census DP1 GeoDatabase into an SQLite Database.