Source code for pudl_catalog
"""An installable catalog of open data related to the US energy system."""
import logging
import os
from pathlib import Path
import intake
import pkg_resources
import pudl_catalog.helpers # noqa: F401
logger.addHandler(logging.NullHandler())
# Ideally we would set this version automatically using setuptools_scm...
[docs]BASE_URLS = {
"gs": f"gs://{INTAKE_BUCKET}/{CATALOG_VERSION}",
"s3": f"s3://{INTAKE_BUCKET}/{CATALOG_VERSION}",
# HTTPS access doesn't really work well, so we're hiding it from users for now.
"https": f"https://storage.googleapis.com/{INTAKE_BUCKET}/{CATALOG_VERSION}",
}
# Ensure that the user has set the relevant environment variables
if os.getenv("PUDL_INTAKE_PATH") is None:
logger.info(
"Environment variable PUDL_INTAKE_PATH is not set. "
f"Defaulting to {BASE_URLS['s3']}"
)
os.environ["PUDL_INTAKE_PATH"] = BASE_URLS["s3"]
if os.getenv("PUDL_INTAKE_CACHE") is None:
logger.info(
"Environment variable PUDL_INTAKE_CACHE is not set. "
f"Defaulting to {os.getenv('HOME')}/.intake/cache"
)
os.environ["PUDL_INTAKE_CACHE"] = str(Path.home() / ".intake/cache")
# The catalog is a YAML file in the same directory as this init file
# After installation the catalog intake.cat.pudl_cat should be available