Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just max temp #14

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions max-temp/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions max-temp/analytics-preprocess.sh

This file was deleted.

19 changes: 0 additions & 19 deletions max-temp/analytics-process.sh

This file was deleted.

8 changes: 8 additions & 0 deletions max-temp/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

REPO_TOP=$(git rev-parse --show-toplevel)
results_dir="${REPO_TOP}/max-temp/results"

echo "Cleaning up outputs..."
rm -rf $results_dir

25 changes: 25 additions & 0 deletions max-temp/input.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

REPO_TOP=$(git rev-parse --show-toplevel)

eval_dir="${REPO_TOP}/max-temp"
results_dir="${eval_dir}/results"
scripts_dir="${eval_dir}/scripts"
input_dir="${eval_dir}/input"

FROM=${FROM:-2015}
TO=${TO:-2015}
URL='https://www1.ncdc.noaa.gov/pub/data/noaa/'

## Downloading and extracting
seq $FROM $TO |
sed "s;^;$URL;" |
sed 's;$;/;' |
xargs -r -n1 --insecure |
grep gz |
tr -s ' \n' |
cut -d ' ' -f9 |
sed 's;^\(.*\)\(20[0-9][0-9]\).gz;\2/\1\2\.gz;' |
sed "s;^;$URL;" |
xargs -n1 curl --insecure |
gunzip > "$input_dir/temperatures2015.txt"
1 change: 1 addition & 0 deletions max-temp/input/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file removed max-temp/inputs/README.md
Empty file.
4 changes: 0 additions & 4 deletions max-temp/inputs/cleanup.sh

This file was deleted.

3 changes: 0 additions & 3 deletions max-temp/inputs/dependencies.sh

This file was deleted.

11 changes: 0 additions & 11 deletions max-temp/inputs/inputs.sh

This file was deleted.

40 changes: 0 additions & 40 deletions max-temp/inputs/run.sh

This file was deleted.

45 changes: 0 additions & 45 deletions max-temp/inputs/tes.sh

This file was deleted.

74 changes: 0 additions & 74 deletions max-temp/inputs/verify.sh

This file was deleted.

24 changes: 0 additions & 24 deletions max-temp/max-temp.sh

This file was deleted.

44 changes: 0 additions & 44 deletions max-temp/new-temp-analytics.sh

This file was deleted.

19 changes: 19 additions & 0 deletions max-temp/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

REPO_TOP=$(git rev-parse --show-toplevel)

eval_dir="${REPO_TOP}/max-temp"
results_dir="${eval_dir}/results"
scripts_dir="${eval_dir}/scripts"
input_dir="${eval_dir}/input"

shell="/bin/bash"

mkdir -p $results_dir

export input_file=${input_dir}/temperatures2015.txt
export results_dir
script="${scripts_dir}/temp-analytics.sh"

echo "Executing $(basename "$script")"
$shell "$script" > "$results_dir/$(basename "$script").out"
21 changes: 21 additions & 0 deletions max-temp/scripts/temp-analytics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

[[ -n "$input_file" ]] || echo "script was not provided with \$input_file"
[[ -n "$results_dir" ]] || echo "script was not provided with \$results_dir"

cat "${input_file}" |
cut -c 88-92 |
grep -v 999 |
sort -rn |
head -n1 > ${results_dir}/max.txt

cat "${input_file}" |
cut -c 88-92 |
grep -v 999 |
sort -n |
head -n1 > ${results_dir}/min.txt

cat "${input_file}" |
cut -c 88-92 |
grep -v 999 |
awk "{ total += \$1; count++ } END { print total/count }" > ${results_dir}/average.txt
Loading
Loading