Skip to content

Instantly share code, notes, and snippets.

@cmj
Last active July 17, 2024 14:32
Show Gist options
  • Save cmj/25676c3b9d977f325d5ce84982de05e6 to your computer and use it in GitHub Desktop.
Save cmj/25676c3b9d977f325d5ce84982de05e6 to your computer and use it in GitHub Desktop.
Find longest streak of days 80° or above at SeaTac, 90° days at PDX

Find longest streak of days 80° or above at SeaTac

Daily summary csv: https://www.ncdc.noaa.gov/cdo-web/datasets/GHCND/stations/GHCND:USW00024233/detail

csvtool col 3,5 seatac-20240713.csv |
  while read line; do 
    if ! grep -E ',[189]..?$' <<< $line; then 
      echo null
    fi
  done |
  xargs | 
  sed "s/null /\n/g" | 
  grep ^[0-9] |
  sort -nr |
  awk '{ print length, $0 }' | 
  sort -nrs |
  cut -d\  -f2- | 
  while read output; do 
    count=$(sed '1s/[^ \t]//g' <<< $output | wc -c)
    echo $count $output
  done

SEA Results

15 2015-06-25,87 2015-06-26,89 2015-06-27,92 2015-06-28,83 2015-06-29,84 2015-06-30,87 2015-07-01,90 2015-07-02,93 2015-07-03,92 2015-07-04,92 2015-07-05,91 2015-07-06,85 2015-07-07,81 2015-07-08,86 2015-07-09,84
15 1977-07-30,82 1977-07-31,85 1977-08-01,87 1977-08-02,89 1977-08-03,88 1977-08-04,83 1977-08-05,89 1977-08-06,87 1977-08-07,86 1977-08-08,85 1977-08-09,91 1977-08-10,95 1977-08-11,95 1977-08-12,96 1977-08-13,86
13 2017-07-29,81 2017-07-30,80 2017-07-31,85 2017-08-01,87 2017-08-02,91 2017-08-03,94 2017-08-04,91 2017-08-05,82 2017-08-06,82 2017-08-07,84 2017-08-08,89 2017-08-09,91 2017-08-10,90
12 2014-07-06,84 2014-07-07,81 2014-07-08,86 2014-07-09,80 2014-07-10,84 2014-07-11,88 2014-07-12,90 2014-07-13,85 2014-07-14,82 2014-07-15,88 2014-07-16,88 2014-07-17,80
12 1967-08-09,91 1967-08-10,88 1967-08-11,84 1967-08-12,85 1967-08-13,89 1967-08-14,88 1967-08-15,92 1967-08-16,98 1967-08-17,89 1967-08-18,86 1967-08-19,88 1967-08-20,86
10 2009-07-25,86 2009-07-26,89 2009-07-27,94 2009-07-28,97 2009-07-29,103 2009-07-30,96 2009-07-31,84 2009-08-01,90 2009-08-02,89 2009-08-03,83
10 2018-07-22,86 2018-07-23,90 2018-07-24,91 2018-07-25,92 2018-07-26,92 2018-07-27,88 2018-07-28,85 2018-07-29,94 2018-07-30,89 2018-07-31,80
10 2016-08-11,81 2016-08-12,90 2016-08-13,91 2016-08-14,85 2016-08-15,83 2016-08-16,83 2016-08-17,80 2016-08-18,87 2016-08-19,95 2016-08-20,91
10 1998-08-28,82 1998-08-29,83 1998-08-30,82 1998-08-31,87 1998-09-01,86 1998-09-02,80 1998-09-03,82 1998-09-04,80 1998-09-05,81 1998-09-06,81
10 1981-08-06,86 1981-08-07,91 1981-08-08,93 1981-08-09,99 1981-08-10,98 1981-08-11,94 1981-08-12,86 1981-08-13,82 1981-08-14,84 1981-08-15,80

PDX

Portland International Airport

Longest streaks of >=90° days

Daily summary csv: https://www.ncdc.noaa.gov/cdo-web/datasets/GHCND/stations/GHCND:USW00024229/detail

csvtool col 3,4 3746661.csv |  
  while read line; do 
    if ! grep -E ',[19]..?$' <<< $line; then 
      echo null
    fi
  done | 
  xargs | 
  sed "s/null /\n/g" | 
  grep ^[0-9] |
  sort -nr |
  awk '{ print length, $0 }' | 
  sort -nrs |
  cut -d\  -f2- | 
  while read output; do 
    count=$(sed '1s/[^ \t]//g' <<< $output | wc -c)
    echo $count $output
  done

PDX Results

10 2009-07-25,90 2009-07-26,93 2009-07-27,103 2009-07-28,106 2009-07-29,106 2009-07-30,96 2009-07-31,94 2009-08-01,95 2009-08-02,94 2009-08-03,91
9 2018-07-22,94 2018-07-23,95 2018-07-24,95 2018-07-25,97 2018-07-26,96 2018-07-27,91 2018-07-28,90 2018-07-29,99 2018-07-30,92
8 2022-07-24,92 2022-07-25,99 2022-07-26,102 2022-07-27,96 2022-07-28,96 2022-07-29,100 2022-07-30,102 2022-07-31,98
8 2015-06-29,90 2015-06-30,92 2015-07-01,95 2015-07-02,97 2015-07-03,95 2015-07-04,95 2015-07-05,96 2015-07-06,93
8 1967-08-12,92 1967-08-13,95 1967-08-14,97 1967-08-15,98 1967-08-16,97 1967-08-17,92 1967-08-18,91 1967-08-19,94
7 2024-07-04,92 2024-07-05,99 2024-07-06,99 2024-07-07,100 2024-07-08,102 2024-07-09,104 2024-07-10,93
7 1972-08-03,94 1972-08-04,92 1972-08-05,95 1972-08-06,102 1972-08-07,104 1972-08-08,96 1972-08-09,91
7 1944-09-04,93 1944-09-05,101 1944-09-06,90 1944-09-07,93 1944-09-08,92 1944-09-09,92 1944-09-10,98
6 1941-07-13,101 1941-07-14,103 1941-07-15,103 1941-07-16,102 1941-07-17,100 1941-07-18,97
6 2023-08-12,91 2023-08-13,101 2023-08-14,108 2023-08-15,103 2023-08-16,103 2023-08-17,93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment