Last active
          August 29, 2015 13:59 
        
      - 
      
 - 
        
Save icecreammatt/10558338 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or 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
    
  
  
    
  | #!/bin/bash | |
| # Check to see if the data is already downloaded | |
| if [[ -e ./waterData ]]; then | |
| echo "Water data already downloaded reading from cache"; | |
| else | |
| # Data isn't downloaded so grab it from the web | |
| echo "No cached data found downloading water data..."; | |
| wget -O waterData "http://nwis.waterdata.usgs.gov/ca/nwis/uv/?search_station_nm=russian%20river&search_station_nm_match_type=beginning&county_cd=06097&index_pmcode_00400=1&index_pmcode_00095=1&index_pmcode_00010=1&index_pmcode_63680=1&group_key=NONE&sitefile_output_format=html_table&column_name=agency_cd&column_name=site_no&column_name=station_nm&range_selection=date_range&begin_date=2008-01-01&end_date=2008-12-31&format=rdb&date_format=YYYY-MM-DD&rdb_compression=value&list_of_search_criteria=county_cd%2Csearch_station_nm%2Crealtime_parameter_selection"; | |
| fi | |
| # Print the result | |
| cat waterData | grep USGS | awk '{ total += $6; count++ } END { print total/count }' | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment