Skip to content

Commit

Permalink
Merge pull request #96 from SchmidtDSE/update-viz-site
Browse files Browse the repository at this point in the history
Update viz site
  • Loading branch information
sampottinger authored Dec 20, 2024
2 parents 8a1ab70 + a2621c2 commit 4d481dc
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 96 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cff-version: '1.1.0'
message: 'Please cite the following works to reference this software.'
abstract: 'Climate change not only threatens agricultural producers but also strains financial institutions. These important food system actors include government entities tasked with both insuring grower livelihoods and supporting response to continued global warming. We use an artificial neural network to predict future maize yields in the U.S. Corn Belt, finding alarming changes to institutional risk exposure within the Federal Crop Insurance Program. Specifically, our machine learning method anticipates more frequent and more severe yield losses that would result in the annual probability of Yield Protection (YP) claims to more than double at mid-century relative to simulations without continued climate change. Furthermore, our dual finding of relatively unchanged average yields paired with decreasing yield stability reveals targeted opportunities to adjust coverage formulas to include variability. This important structural shift may help regulators support grower adaptation to continued climate change by recognizing the value of risk-reducing strategies such as regenerative agriculture. Altogether, paired with open source interactive tools for deeper investigation, our risk profile simulations fill an actionable gap in current understanding, bridging granular historic yield estimation and climate-informed prediction of future insurer-relevant loss. '
abstract: 'Climate change not only threatens agricultural producers but also strains related public agencies and financial institutions. These important food system actors include government entities tasked with insuring grower livelihoods and supporting response to continued global warming. We examine future risk within the U.S. Corn Belt geographic region for one such crucial institution: the U.S. Federal Crop Insurance Program. Specifically, we predict the impacts of climate-driven crop loss at a policy-salient "risk unit" scale. Built through our presented neural network Monte Carlo method, simulations anticipate both more frequent and more severe losses that would result in a costly doubling of the annual probability of maize Yield Protection insurance claims at mid-century. We also provide an open source pipeline and interactive visualization tools to explore these results with configurable statistical treatments. Altogether, we fill an important gap in current understanding for climate adaptation by bridging existing historic yield estimation and climate projection to predict crop loss metrics at policy-relevant granularity.'
authors:

doi: '10.48550/ARXIV:2408.02217'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ A summary of the pipeline is created in `stats.json`. See local package below fo
### Interactive tools
Written in [Sketchingpy](https://sketchingpy.org/), the tools can be executed locally on your computer, in a static context for building the paper, or through a web browser. First, one needs to get data from the pipeline or download prior results:

- **Download prior results**: Retrieve the [latest results](https://ag-adaptation-study.pub/archive/data.zip) and move them into the viz directory (`paper/viz/data`). Simply use wget when in the `paper/viz directory` as so: `wget https://ag-adaptation-study.pub/archive/data.zip; unzip data.zip`.
- **Download prior results**: Retrieve the [latest results](https://ag-adaptation-study.pub/archive/data.zip) and move them into the viz directory (`paper/viz/data`). Simply use wget to gather model outputs when in the `paper/viz directory` as so: `wget https://ag-adaptation-study.pub/archive/data.zip; unzip data.zip`. If using prior sweep results, download full sweep information like so: `cd data; wget http://ag-adaptation-study.pub/data/sweep_ag_all.csv; cd ..`.
- **Use your own results**: Update the output data per instructions regarding local package below.

There are two options for executing the tools:
Expand Down
8 changes: 3 additions & 5 deletions export_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,10 @@ def is_record_in_scope(target, threshold, geohash_sim_size=4, historic=False):
return False

if historic:
if target['series'] != 'historic':
if str(target['series']) != '2010':
return False
else:
if target['series'] == 'historic':
if str(target['series']) == '2010':
return False

if abs(float(target['unitSize'])) <= 1.0001:
Expand Down Expand Up @@ -704,9 +704,7 @@ def requires(self):
"""
return [
HistExportSubTask(geohash_size=4, historic=False),
HistExportSubTask(geohash_size=4, historic=True),
HistExportSubTask(geohash_size=5, historic=False),
HistExportSubTask(geohash_size=5, historic=True)
HistExportSubTask(geohash_size=5, historic=False)
]

def output(self):
Expand Down
6 changes: 3 additions & 3 deletions paper/viz/hist_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def _draw_axis_bottom(self):
self._sketch.set_text_align('center', 'center')

if self._comparison == 'vs historic':
self._sketch.draw_text(0, 0, 'Historic Values (Approx 2007)')
self._sketch.draw_text(0, 0, 'Predicted 2010 Series')
else:
self._sketch.draw_text(0, 0, 'Climate Change Stops')

Expand Down Expand Up @@ -716,7 +716,7 @@ def _draw_top_claims(self, claims):
self._sketch.set_text_font(const.FONT_SRC, 11)

is_catastrophic = self._target_threshold == '75% cov'
max_val = 30 if is_catastrophic else 35
max_val = 35 if is_catastrophic else 45

y = SUB_CHART_HEIGHT - self._get_y(15)
start_x = self._get_x(-100) - 5
Expand Down Expand Up @@ -757,7 +757,7 @@ def _draw_bottom_claims(self, claims):
self._sketch.set_text_font(const.FONT_SRC, 11)

is_catastrophic = self._target_threshold == '75% cov'
max_val = 30 if is_catastrophic else 35
max_val = 35 if is_catastrophic else 45

y = self._get_y(15)
start_x = self._get_x(-100)
Expand Down
8 changes: 4 additions & 4 deletions paper/viz/history_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def _draw_content(self):
std = statistics.stdev(self._values)

if self._use_std:
threshold = -2.1
threshold = -1.5
format_str = '%s%.1f std'
get_delta = lambda x: (x - average) / std
else:
Expand Down Expand Up @@ -597,7 +597,7 @@ def _draw_average(self):

if self._use_std:
std = statistics.stdev(self._values)
with_loss = filter(lambda x: (x - average) / std < -2.1, self._values)
with_loss = filter(lambda x: (x - average) / std < -1.5, self._values)
else:
with_loss = filter(lambda x: (x - average) / average < -0.25, self._values)

Expand Down Expand Up @@ -734,7 +734,7 @@ def step(self, mouse_x_abs, mouse_y_abs, clicked):
self._sketch.draw_text(4, self._height - 16, '0%')

self._sketch.set_text_align('right', 'top')
self._sketch.draw_text(self._width - 4, self._height - 16, '10%')
self._sketch.draw_text(self._width - 4, self._height - 16, '30%')

# Draw top bar
historic_claims = self._data_facade.get_claims(2010, 'historic', self._using_std) * 100
Expand All @@ -755,7 +755,7 @@ def step(self, mouse_x_abs, mouse_y_abs, clicked):
self._sketch.draw_text(2, 64, 'Future: %.1f%% (<-%.2f%s)' % future_str_vals)

self._sketch.set_rect_mode('corner')
get_width = lambda x: x / 10 * (self._width - 8)
get_width = lambda x: x / 30 * (self._width - 8)
self._sketch.draw_rect(4, 41, get_width(historic_claims), 3)
self._sketch.draw_rect(4, 65, get_width(future_claims), 3)

Expand Down
Loading

0 comments on commit 4d481dc

Please sign in to comment.