From b6d8927274c7281140b61ce278311fb8c5aae3a0 Mon Sep 17 00:00:00 2001 From: adfarth Date: Mon, 22 Apr 2024 07:30:45 -0600 Subject: [PATCH 1/2] update EASIUR years --- CHANGELOG.md | 5 +++++ src/core/financial.jl | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4c7b37c2..8cbee0059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,11 @@ Classify the change according to the following categories: ### Deprecated ### Removed +## Develop - 2024-04-22 +### Changed +- Updated `pop_year` and `income_year` used in call to EASIUR data (`get_EASIUR2005`) each to 2024, from 2020. +- Updated usd conversion used for EASIUR health cost calcs from USD_2010_to_2020 = 1.246 to USD_2010_to_2024 = 1.432 + ## Develop - 2024-04-11 ### Fixed - Added `export_rate_beyond_net_metering_limit` to list of inputs to be converted to type Real, to avoid MethodError if type is vector of Any. diff --git a/src/core/financial.jl b/src/core/financial.jl index d17925861..1112812c5 100644 --- a/src/core/financial.jl +++ b/src/core/financial.jl @@ -220,7 +220,7 @@ function easiur_costs(latitude::Real, longitude::Real, grid_or_onsite::String) end EASIUR_data = nothing try - EASIUR_data = get_EASIUR2005(type, pop_year=2020, income_year=2020, dollar_year=2010) + EASIUR_data = get_EASIUR2005(type, pop_year=2024, income_year=2024, dollar_year=2010) catch e @warn "Could not look up EASIUR health costs from point ($latitude,$longitude). {$e}" return nothing @@ -232,13 +232,13 @@ function easiur_costs(latitude::Real, longitude::Real, grid_or_onsite::String) coords = g2l(longitude, latitude, datum="NAD83") x = Int(round(coords[1])) y = Int(round(coords[2])) - # Convert from 2010$ to 2020$ (source: https://www.in2013dollars.com/us/inflation/2010?amount=100) - USD_2010_to_2020 = 1.246 + # Convert from 2010$ to 2024$ (source: https://www.in2013dollars.com/us/inflation/2010?amount=100) + USD_2010_to_2024 = 1.432 try costs_per_tonne = Dict( - "NOx" => EASIUR_data["NOX_Annual"][x, y] .* USD_2010_to_2020, - "SO2" => EASIUR_data["SO2_Annual"][x, y] .* USD_2010_to_2020, - "PM25" => EASIUR_data["PEC_Annual"][x, y] .* USD_2010_to_2020 + "NOx" => EASIUR_data["NOX_Annual"][x, y] .* USD_2010_to_2024, + "SO2" => EASIUR_data["SO2_Annual"][x, y] .* USD_2010_to_2024, + "PM25" => EASIUR_data["PEC_Annual"][x, y] .* USD_2010_to_2024 ) return costs_per_tonne catch @@ -284,7 +284,7 @@ Adapted to Julia from example Python code for EASIUR found at https://barney.ce. """ get_EASIUR2005( stack::String, # area, p150, or p300 - pop_year::Int64=2005, # population year + pop_year::Int64=2005, # population year (2000 to 2050) income_year::Int64=2005, # income level (1990 to 2024) dollar_year::Int64=2010 # dollar year (1980 to 2010) ) @@ -388,7 +388,7 @@ function get_EASIUR2005(stack::String; pop_year::Int64=2005, income_year::Int64= setindex!(ret_map, v .* adj, k) end catch - throw(@error("income year is $(income_year) but must be between 1990 to 2024")) + throw(@error("EASIUR income year is $(income_year) but must be between 1990 to 2024")) return nothing end end @@ -399,7 +399,7 @@ function get_EASIUR2005(stack::String; pop_year::Int64=2005, income_year::Int64= setindex!(ret_map, v .* adj, k) end catch e - throw(@error("Dollar year must be between 1980 to 2010")) + throw(@error("EASIUR dollar year must be between 1980 to 2010")) return nothing end end From 5d890d3d39bb8c87a76c58a0798091220d0e1717 Mon Sep 17 00:00:00 2001 From: adfarth Date: Mon, 6 May 2024 08:53:33 -0600 Subject: [PATCH 2/2] update test value --- src/core/financial.jl | 1 + test/runtests.jl | 2 +- test/test_with_xpress.jl | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/financial.jl b/src/core/financial.jl index 1112812c5..59a1aaef3 100644 --- a/src/core/financial.jl +++ b/src/core/financial.jl @@ -248,6 +248,7 @@ function easiur_costs(latitude::Real, longitude::Real, grid_or_onsite::String) end function easiur_escalation_rates(latitude::Real, longitude::Real, inflation::Real) + # Calculate escalation rate as nominal compound annual growth rate in marginal emissions costs between 2020 and 2024 for this location. EASIUR_150m_yr2020 = nothing EASIUR_150m_yr2024 = nothing try diff --git a/test/runtests.jl b/test/runtests.jl index 652c3f389..b2905ca83 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1185,7 +1185,7 @@ else # run HiGHS tests d["Site"]["latitude"] = 30.2672 d["Site"]["longitude"] = -97.7431 scen = Scenario(d) - @test scen.financial.NOx_grid_cost_per_tonne ≈ 4534.032470 atol=0.1 + @test scen.financial.NOx_grid_cost_per_tonne ≈ 5510.61 atol=0.1 end @testset "Wind" begin diff --git a/test/test_with_xpress.jl b/test/test_with_xpress.jl index 895c28062..60a1cbc13 100644 --- a/test/test_with_xpress.jl +++ b/test/test_with_xpress.jl @@ -666,7 +666,7 @@ end d["Site"]["latitude"] = 30.2672 d["Site"]["longitude"] = -97.7431 scen = Scenario(d) - @test scen.financial.NOx_grid_cost_per_tonne ≈ 4534.032470 atol=0.1 + @test scen.financial.NOx_grid_cost_per_tonne ≈ 5510.61 atol=0.1 end @testset "Wind" begin