.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/modules/plot_reforest_ALC_4_5.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_modules_plot_reforest_ALC_4_5.py: ============================================== Reforest half of UK's ALC 4 and 5 pasture land ============================================== This example demonstrates how to combine different land data arrays using the ``land`` accessor and how to use the carbon sequestration model to compute additional carbon sequestration from reforested land. Two datasets are imported from the agrifoodpy_data package - ALC: Agricultural Land Classification data, which assigns a grade to UK's land in terms of its suitability for agricultural use. - LC: CEH UK Land Classification map, which indicates the type of land use and assigns and value to the dominant use on each pixel Both have the same pixel scale and are defined over the same spatial grid. .. GENERATED FROM PYTHON SOURCE LINES 18-42 .. code-block:: Python import numpy as np import xarray as xr from agrifoodpy_data.land import UKCEH_LC_1000 as LC, NaturalEngland_ALC_1000 as ALC from agrifoodpy.land.land import LandDataArray from agrifoodpy.land.model import land_sequestration import agrifoodpy.food from matplotlib import pyplot as plt land_use = LC.copy(deep=True) land_use = land_use["dominant_aggregate"] ALC = ALC.grade f, axes = plt.subplots(1, 2, sharey=True) plt.subplots_adjust(wspace=0) land_use.land.plot(ax=axes[0]) ALC.land.plot(ax=axes[1]) plt.show() .. image-sg:: /examples/modules/images/sphx_glr_plot_reforest_ALC_4_5_001.png :alt: plot reforest ALC 4 5 :srcset: /examples/modules/images/sphx_glr_plot_reforest_ALC_4_5_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 43-46 We obtain the total area of land being used for pasture on low grade agricultural land. Pasture identifier is 1 Then we use the carbon sequestration model to reforest half of this fraction .. GENERATED FROM PYTHON SOURCE LINES 46-76 .. code-block:: Python # Align the two land maps to compute overlap areas ALC, land_use = xr.align(ALC, land_use) total_area_england = ALC.land.area_by_type().sum() pasture_4_5 = land_use.land.area_overlap(ALC, values_left=1, values_right=[4,5]).sum() # Maximum sequestration [t CO2e / yr] broadleaf_max_seq = 5.7 coniferous_max_seq = 14 broadleaf_fraction = 0.5 seq_forest = broadleaf_max_seq * (broadleaf_fraction) + \ coniferous_max_seq * (1-broadleaf_fraction) # We can now compute the additional carbon sequestration from reforesting co2e_seq = land_sequestration( land_da=land_use, use_id=[1,2], max_seq=seq_forest, fraction=[0.0, pasture_4_5/total_area_england*0.5], years = np.arange(2020,2070), growth_timescale=25 ) ax = co2e_seq.fbs.plot_years() ax.set_ylabel("[t CO2 / yr]") ax.set_xlabel("Year") plt.show() .. image-sg:: /examples/modules/images/sphx_glr_plot_reforest_ALC_4_5_002.png :alt: plot reforest ALC 4 5 :srcset: /examples/modules/images/sphx_glr_plot_reforest_ALC_4_5_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.326 seconds) .. _sphx_glr_download_examples_modules_plot_reforest_ALC_4_5.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_reforest_ALC_4_5.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_reforest_ALC_4_5.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_reforest_ALC_4_5.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_