Week 4 overview#

Learning objectives:#

  1. Review: grep, output redirect and appending

  2. Creating and editing text files

  3. Introduction to shell scripting

Final project planning:#

  1. Choose your case

Tue. Feb. 11 activities:#

  1. Go to your atm350 directory and create a new directory named 250211

  2. change into the /data1/surface/sao directory

  3. list the contents of that directory

  4. View the contents of the 25021118_sao.wmo file

  5. Search all files in that directory from 250211 that contain the string TSSN

  6. As above, but redirect the output of the results of that command to a file named cantore_loves_this.txt in your /spare11/atm350/<netid>/250211 directory

  7. Search all files in the /data1/surface/sao directory from Feb 08 that have that same string

  8. As above, but append the output to your cantore_loves_this.txt file

  9. cd to your 250211 directory

  10. Edit cantore_loves_this.txt and add a descriptive line to the top of that file

  11. Create a text file

  12. Add to the file the following lines:

#!/bin/sh
echo "This is my first bash script" 
cp /data1/forecasts/250218.disc .
# Get number of lines containing the string "snow"
grep -c snow 250218.disc
# Get number of actual instances of the word "snow"
grep -cow snow 250218.disc
# Copy some local storm reports
cp /spare11/atm350/common/feb11/* .
echo "End of script!"
exit 0

  1. Save the file as myscript.sh.

  2. Try to execute the script: type ./myscript.sh

  3. chmod +x myscript.sh

  4. Try again to execute the script: type ./myscript.sh

HW1#

Homework 1: Due Tue, 2/18, 3PM

Thu. Feb. 13 activities:#

  1. In your atm350 directory, create a 250213 directory and cd into that directory

  2. cp /spare11/atm350/common/feb13/* .

  3. HW 1 comments and questions

  4. IA State Local Storm Report Archive

  5. Download a geojson file from Jupyterlab

  6. Visualize the geojson file on https://geojson.io

  7. Iowa State Mesonet Text Product Archive Documentation

  8. Interactive retrieval of text products … e.g. wget "https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=AFDALY"

  9. Redirect output of wget

  10. IA State product retrieval using a shell script

  11. Expand utility and flexibility of the data retrieval shell scripts