Class: Forecaster::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/forecaster/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/forecaster/configuration.rb', line 5

def initialize
  @server = "http://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod"
  @cache_dir = "/tmp/forecaster"
  @curl_path = "curl"
  @wgrib2_path = "wgrib2"

  # See: http://www.nco.ncep.noaa.gov/pmb/products/gfs/gfs_upgrade/gfs.t06z.pgrb2.0p25.f006.shtml
  # See: http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/
  # Use `variable` and `level` attributes separated by colons to identify
  # the records to download and read.
  @records = {
    :prate => ":PRATE:surface:",
    :tmp   => ":TMP:2 m above ground:",
    :ugrd  => ":UGRD:10 m above ground:",
    :vgrd  => ":VGRD:10 m above ground:",
    :tcdc  => ":TCDC:entire atmosphere:"
  }
end

Instance Attribute Details

#cache_dirObject

Returns the value of attribute cache_dir.



3
4
5
# File 'lib/forecaster/configuration.rb', line 3

def cache_dir
  @cache_dir
end

#curl_pathObject

Returns the value of attribute curl_path.



3
4
5
# File 'lib/forecaster/configuration.rb', line 3

def curl_path
  @curl_path
end

#recordsObject

Returns the value of attribute records.



3
4
5
# File 'lib/forecaster/configuration.rb', line 3

def records
  @records
end

#serverObject

Returns the value of attribute server.



3
4
5
# File 'lib/forecaster/configuration.rb', line 3

def server
  @server
end

#wgrib2_pathObject

Returns the value of attribute wgrib2_path.



3
4
5
# File 'lib/forecaster/configuration.rb', line 3

def wgrib2_path
  @wgrib2_path
end

Class Method Details

.configure(options) ⇒ Object



24
25
26
27
28
# File 'lib/forecaster/configuration.rb', line 24

def self.configure(options)
  options.each do |option, value|
    self[option] = value
  end
end