Agriculture-ERS



In [1]:
include("../src/nui.jl");


WARNING: RCall is not installed, so some graphing will not work.  If you have R installed, install RCall with `Pkg.add("RCall")`.
WARNING: New definition 
    write(Base.IO, ForwardDiff.Partials) at /Users/jrising/.julia/v0.4/ForwardDiff/src/partials.jl:57
is ambiguous with: 
    write(Base.Base64.Base64EncodePipe, AbstractArray{UInt8, 1}) at base64.jl:89.
To fix, define 
    write(Base.Base64.Base64EncodePipe, ForwardDiff.Partials{N<:Any, UInt8})
before the new definition.
┌──────────────────────────────────────────────────┐
    ▄▄    ▄▄      ▄▄    ▄▄       ▄▄▄▄    ▄▄    ▄▄ 
   ████   ██      ██   ████    ▄█▀▀▀▀█   ██    ██ 
   ████   ▀█▄  ▄█▀   ████    ██▄       ██    ██ 
  ██     ██ ██ ██     ██    ▀████▄   ████████ 
  ██████   ███▀▀███   ██████        ▀██  ██    ██ 
 ▄██  █▄  ███  ███  ▄█  ██▄  █▄▄▄▄▄█▀  ██    ██ 
 ▀▀    ▀▀  ▀▀▀  ▀▀▀  ▀▀    ▀▀   ▀▀▀▀▀    ▀▀    ▀▀ 
└──────────────────────────────────────────────────┘

Welcome to AWASH, the America's Water Model, version 0.8.

WARNING: New definition 
    +(AbstractArray{T<:Any, 2}, WoodburyMatrices.SymWoodbury) at /Users/jrising/.julia/v0.4/WoodburyMatrices/src/SymWoodburyMatrices.jl:138
is ambiguous with: 
    +(DataArrays.DataArray, AbstractArray) at /Users/jrising/.julia/v0.4/DataArrays/src/operators.jl:276.
To fix, define 
    +(DataArrays.DataArray{T<:Any, 2}, WoodburyMatrices.SymWoodbury)
before the new definition.
WARNING: New definition 
    +(AbstractArray{T<:Any, 2}, WoodburyMatrices.SymWoodbury) at /Users/jrising/.julia/v0.4/WoodburyMatrices/src/SymWoodburyMatrices.jl:138
is ambiguous with: 
    +(DataArrays.AbstractDataArray, AbstractArray) at /Users/jrising/.julia/v0.4/DataArrays/src/operators.jl:300.
To fix, define 
    +(DataArrays.AbstractDataArray{T<:Any, 2}, WoodburyMatrices.SymWoodbury)
before the new definition.

In [2]:
config = readconfig("../configs/standard-1year.yml")


Out[2]:
Dict{Any,Any} with 18 entries:
  "urbandemand-index"     => "FIPS_county"
  "optimtype"             => "SWGW"
  "filterstate"           => nothing
  "ncdatasets"            => Dict{Any,Any}("runoff"=>Dict{Any,Any}("csvcrc"=>20…
  "urbandemand-transform" => "repcap"
  "startweather"          => 612
  "timestep"              => 6
  "urbandemand-column"    => "per_capita"
  "indexlen"              => 5
  "startmonth"            => "10/2009"
  "indexcols"             => Any[:FIPS,:fips]
  "masterregions"         => "global/counties.csv"
  "rescap"                => "full"
  "dataset"               => "counties"
  "ncregion"              => "county"
  "urbandemand-path"      => "demand/urbandemand_May11.csv"
  "indexpad"              => "0"
  "endmonth"              => "9/2010"

In [3]:
masterregions = readtable(datapath(config["masterregions"]), eltypes=[String, String, String]);

In [4]:
include("../src/lib/agriculture-ers.jl");

In [5]:
ers_information_list("corn")


Out[5]:
36-element Array{UTF8String,1}:
 "cost"                                       
 "yield"                                      
 "price"                                      
 "revenue"                                    
 "Primary product:  Corn grain"               
 "Secondary product:  Corn silage"            
 "Total, gross value of production"           
 "Seed"                                       
 "Fertilizer"                                 
 "Chemicals"                                  
 "Custom operations"                          
 "Fuel, lube, and electricity"                
 "Repairs"                                    
 ⋮                                            
 "Value of production less total costs listed"
 "Value of production less operating costs"   
 "Yield (bushels per planted acre)"           
 "Price (dollars per bushel at harvest)"      
 "Enterprise size (planted acres)"            
 "Irrigated (percent)"                        
 "Dryland (percent)"                          
 "Corn grain"                                 
 "Corn silage"                                
 "Capital recovery of mach and equip"         
 "Value of prod less total costs listed"      
 "Value of prod less operating costs"         

In [6]:
cost = ers_information("corn", "cost", 2010)


Out[6]:
3109-element DataArrays.DataArray{Float64,1}:
 439.51
 439.51
 439.51
 368.71
 368.71
 439.51
 439.51
 368.71
 439.51
 368.71
 368.71
 439.51
 439.51
   ⋮   
 400.33
 400.33
 389.98
 400.33
 389.98
 389.98
 400.33
 400.33
 400.33
 400.33
 400.33
 389.98

In [7]:
profit = ers_information("corn", "price", 2010) .* ers_information("corn", "yield", 2010) - cost


Out[7]:
3109-element DataArrays.DataArray{Float64,1}:
 118.25
 118.25
 118.25
 270.54
 270.54
 118.25
 118.25
 270.54
 118.25
 270.54
 270.54
 118.25
 118.25
   ⋮   
 289.06
 289.06
 185.76
 289.06
 185.76
 185.76
 289.06
 289.06
 289.06
 289.06
 289.06
 185.76

In [ ]: