Skip to content

Instantly share code, notes, and snippets.

@afcotroneo
Created September 28, 2021 14:08
Show Gist options
  • Select an option

  • Save afcotroneo/db2ab2d3b53237c81ccad297cbd7a6a4 to your computer and use it in GitHub Desktop.

Select an option

Save afcotroneo/db2ab2d3b53237c81ccad297cbd7a6a4 to your computer and use it in GitHub Desktop.
## Find the NYC area IDs using a bounding box:
SELECT
distinct id
FROM
noaa_data_geo a
WHERE
ST_Contains(ST_GeomFromText('POLYGON((-74.369989 40.978649, -73.46076 40.978649, -73.46076 40.427511, -74.369989 40.427511, -74.369989 40.978649))', 4326), ST_SetSRID(ST_Point(a.longitude, a.latitude), 4326))
LIMIT 10
## Create a table with the NYC NOAA sensor data after the year 2000
CREATE TABLE nyc_noaa_post2000 AS (
SELECT *
FROM noaa_data_geo
WHERE id in ('USW00014732' ,
'USW00014734' ,
'USW00094728' ,
'USW00094741' ,
'USW00094789' ,
'USW00054743' )
AND extract(year from dt) > 2000
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment