ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin
Loading...

Query the Data Delivery Network

Query the DDN

The easiest way to query any data on Splitgraph is via the "Data Delivery Network" (DDN). The DDN is a single endpoint that speaks the PostgreSQL wire protocol. Any Splitgraph user can connect to it at data.splitgraph.com:5432 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

For example, you can query the title_v_emissions_inventory_beginning_2010 table in this repository, by referencing it like:

"ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin:latest"."title_v_emissions_inventory_beginning_2010"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    ":@computed_region_kjdx_g34t",
    "pm10", -- Particles that are less than 10 microns in diameter.  Most particulate matter is PM10. Annual particulate matter (less than 10 microns in diameter) emissions at the facility measured in tons. 
    "co", -- Carbon monoxide is a colorless, odorless gas that forms when carbon in fuel is not burned completely. Carbon monoxide is a component of exhaust from motor vehicles and engines. Carbon monoxide emissions increase when conditions are poor for combustion; thus, the highest carbon monoxide levels tend to occur when the weather is very cold or at high elevations where there is less oxygen in the air to burn the fuel.  Annual carbon monoxide emissions at the facility measured in tons.
    "particulates", -- Particulates are tiny particles or liquid droplets suspended in the air that can contain a variety of chemical components. Larger particles are visible as smoke or dust and settle out relatively rapidly. The tiniest particles can be suspended in the air for long periods of time and are the most harmful to human health because they can penetrate deep into the lungs. Some particles are directly emitted into the air. They come from a variety of sources such as cars, trucks, buses, factories, construction sites, tilled fields, unpaved roads, stone crushing, and wood burning. Other particles are formed in the atmosphere by chemical reactions. Annual particulate matter (total) emissions at the facility measured in tons.
    "so2", -- Sulfur dioxide isone of a group of highly reactive gasses known as “oxides of sulfur.”  The largest sources of SO2 emissions are from fossil fuel combustion at power plants (73%) and other industrial facilities (20%).  Smaller sources of SO2 emissions include industrial processes such as extracting metal from ore, and the burning of high sulfur containing fuels by locomotives, large ships, and non-road equipment.  SO2 is linked with a number of adverse effects on the respiratory system. Annual sulfur dioxide emissions at the facility measured in tons.
    "location", -- Open Data/Socrata-generated geocoding information from supplied address components.
    "voc", -- Volatile organic compounds (VOC) means any compound of carbon, excluding carbon monoxide, carbon dioxide, carbonic acid, metallic carbides or carbonates and ammonium carbonate, which participates in atmospheric photochemical reactions, except those designated by EPA as having negligible photochemical reactivity.  Annual volatile organic compound emissions at the facility measured in tons.
    "nox", -- Nitrogen oxides (NOx) is the term used to describe the sum of nitric oxide (NO), nitrogen dioxide (NO2), and other oxides of nitrogen. Most airborne NOX comes from combustion-related emissions sources of human origin, primarily fossil fuel combustion in electric utilities, high-temperature operations at other industrial sources, and operation of motor vehicles. Annual nitrogen oxide emissions at the facility measured in tons.
    ":@computed_region_yamh_8v7k",
    "facility_name", -- Title V Facility Name
    "year", -- Calendar year for emissions inventory data
    "municipality", -- Municipality where facility is located
    ":@computed_region_wbg7_3whc",
    "dec_id", -- Title V Facility Identification Number
    "co2", -- Carbon dioxide is a naturally occurring gas, and also a by-product of burning fossil fuels and biomass, as well as land-use changes and other industrial processes. It is the principal human caused greenhouse gas that affects the Earth's radiative balance.  Annual carbon dioxide emissions at the facility measured in tons.
    "haps", -- Hazardous air pollutants, also known as toxic air pollutants or air toxics, are those pollutants that are known or suspected to cause cancer or other serious health effects, such as reproductive effects or birth defects, or adverse environmental effects. EPA is working with state, local, and tribal governments to reduce air emissions of 187 toxic air pollutants to the environment. Examples of toxic air pollutants include benzene, which is found in gasoline; perchloroethylene, which is emitted from some dry cleaning facilities; and methylene chloride, which is used as a solvent and paint stripper by a number of industries. Examples of other listed air toxics include dioxin, asbestos, toluene, and metals such as cadmium, mercury, chromium, and lead compounds. Annual hazardous air pollutants (HAPs) emissions at the facility measured in tons.
    "pm2_5", -- Particles that are less than 2.5 microns in diameter. These particles are often referred to as "PM fine." PM fine particles are so small that they are not typically visible to the naked eye. In the atmosphere, however, they are significant contributors to haze. Smaller particles are generally more harmful to human health because they can penetrate more deeply into the lungs than larger particles. Annual particulate matter (less than 2.5 microns in diameter) emissions at the facility measured in tons.
    "sic_code", -- Standard Industrial Classification Code describing the general type of activity at the facility.  SIC code lookup is available at https://www.osha.gov/pls/imis/sicsearch.html
    "county" -- New York Counties where facility is located
FROM
    "ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin:latest"."title_v_emissions_inventory_beginning_2010"
LIMIT 100;

Connecting to the DDN is easy. All you need is an existing SQL client that can connect to Postgres. As long as you have a SQL client ready, you'll be able to query ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin with SQL in under 60 seconds.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

Read the installation docs.

Splitgraph Cloud is built around Splitgraph Core (GitHub), which includes a local Splitgraph Engine packaged as a Docker image. Splitgraph Cloud is basically a scaled-up version of that local Engine. When you query the Data Delivery Network or the REST API, we mount the relevant datasets in an Engine on our servers and execute your query on it.

It's possible to run this engine locally. You'll need a Mac, Windows or Linux system to install sgr, and a Docker installation to run the engine. You don't need to know how to actually use Docker; sgrcan manage the image, container and volume for you.

There are a few ways to ingest data into the local engine.

For external repositories, the Splitgraph Engine can "mount" upstream data sources by using sgr mount. This feature is built around Postgres Foreign Data Wrappers (FDW). You can write custom "mount handlers" for any upstream data source. For an example, we blogged about making a custom mount handler for HackerNews stories.

For hosted datasets (like this repository), where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Cloning Data

Because ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin:latest is a Splitgraph Image, you can clone the data from Spltgraph Cloud to your local engine, where you can query it like any other Postgres database, using any of your existing tools.

First, install Splitgraph if you haven't already.

Clone the metadata with sgr clone

This will be quick, and does not download the actual data.

sgr clone ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin

Checkout the data

Once you've cloned the data, you need to "checkout" the tag that you want. For example, to checkout the latest tag:

sgr checkout ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin:latest

This will download all the objects for the latest tag of ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin and load them into the Splitgraph Engine. Depending on your connection speed and the size of the data, you will need to wait for the checkout to complete. Once it's complete, you will be able to query the data like you would any other Postgres database.

Alternatively, use "layered checkout" to avoid downloading all the data

The data in ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin:latest is 0 bytes. If this is too big to download all at once, or perhaps you only need to query a subset of it, you can use a layered checkout.:

sgr checkout --layered ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin:latest

This will not download all the data, but it will create a schema comprised of foreign tables, that you can query as you would any other data. Splitgraph will lazily download the required objects as you query the data. In some cases, this might be faster or more efficient than a regular checkout.

Read the layered querying documentation to learn about when and why you might want to use layered queries.

Query the data with your existing tools

Once you've loaded the data into your local Splitgraph Engine, you can query it with any of your existing tools. As far as they're concerned, ny-gov/title-v-emissions-inventory-beginning-2010-4ry5-tfin is just another Postgres schema.

Related Documentation:

Loading...