code: def _load_hourly_od(basename):
      filename = os.path.join(DATA, basename.replace(".csv.gz", ".pkl"))
      if os.path.exists(filename):
          return filename
  
      # Download source files.
      gz_filename = os.path.join(DATA, basename)
      if not os.path.exists(gz_filename):
          url = SOURCE_DIR + basename
          logging.debug("downloading {}".format(url))
          urllib.request.urlretrieve(url, gz_filename)
      csv_filename = gz_filename[:-3]
      assert csv_filename.endswith(".csv")
      if not os.path.exists(csv_filename):
          logging.debug("unzipping {}".format(gz_filename))
          subprocess.check_call(["gunzip", "-k", gz_filename])
      assert os.path.exists(csv_filename)
  
      # Convert to PyTorch.
      logging.debug("converting {}".format(csv_filename))
      start_date = datetime.datetime.strptime("2000-01-01", "%Y-%m-%d")
      stations = {}
      num_rows = sum(1 for _ in open(csv_filename))
      logging.info("Formatting {} rows".format(num_rows))
      rows = torch.empty((num_rows, 4), dtype=torch.long)
      with open(csv_filename) as f:
          for i, (date, hour, origin, destin, trip_count) in enumerate(
              csv.reader(f)
          ):
              date = datetime.datetime.strptime(date, "%Y-%m-%d")
              date += datetime.timedelta(hours=int(hour))
              rows[i, 0] = int(
                  (date - start_date).total_seconds() / 3600
              )
              rows[i, 1] = stations.setdefault(origin, len(stations))
              rows[i, 2] = stations.setdefault(destin, len(stations))
              rows[i, 3] = int(trip_count)
              if i % 10000 == 0:
                  sys.stderr.write(".")
                  sys.stderr.flush()
  
      # Save data with metadata.
      dataset = {
          "basename": basename,
          "start_date": start_date,
          "stations": stations,
          "rows": rows,
          "schema": ["time_hours", "origin", "destin", "trip_count"],
      }
      dataset["rows"]
      logging.debug("saving {}".format(filename))
      torch.save(dataset, filename)
      return filename
  
file_path: pyro/pyro/contrib/examples/bart.py
imports: import argparse
  import bz2
  import csv
  import datetime
  import logging
  import multiprocessing
  import os
  import subprocess
  import sys
  import urllib
  import torch
  from pyro.contrib.examples.util import _mkdir_p, get_data_directory
label_desc: Use image node_id 1 for calling a global function with example usage: _load_hourly_od(basename) and returns: filename, filename