Created
May 28, 2024 10:08
-
-
Save lfy79001/71fe2df9ce906b1745cd7e43dad85c6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
wx.date, | |
MAX(prcp) AS prcp, | |
MAX(tmin) AS tmin, | |
MAX(tmax) AS tmax, | |
IF(MAX(haswx) = 'True', 'True', 'False') AS haswx | |
FROM ( | |
SELECT | |
wx.date, | |
IF (wx.element = 'PRCP', wx.value/10, NULL) AS prcp, | |
IF (wx.element = 'TMIN', wx.value/10, NULL) AS tmin, | |
IF (wx.element = 'TMAX', wx.value/10, NULL) AS tmax, | |
IF (SUBSTR(wx.element, 0, 2) = 'WT', 'True', NULL) AS haswx | |
FROM | |
`bigquery-public-data.ghcn_d.ghcnd_2015` AS wx | |
WHERE | |
id = 'USW00094846' | |
AND qflag IS NULL ) | |
GROUP BY | |
wx.date | |
ORDER BY | |
wx.date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment