## Main

Improved knowledge of dryland trees, defined here as having a green crown area >3 m2 with an associated shadow (Extended Data Fig. 1), is essential to understand their roles in local livelihoods, economies, ecosystems, the global carbon cycle and the climate system in general. Basic information about the distribution of dryland trees and their density, cover, size, mass and carbon content are not well known2,3,4,5. This knowledge is required for understanding the functional traits of trees in relation to water resources with changes in climate, predicted increase in aridity and the number and duration of drought events30,31. The sources of information used to estimate carbon stocks in drylands include field surveys at plot scale; ecosystem models23; and low-resolution, moderate-resolution and high-resolution satellite images4,5,6,7,8,9,10,11,12,13,14, which are used to infer bulk properties such as averages of tree cover, dry masses and carbon density per unit area at a much coarser spatial scale than individual trees.

Although most emphasis is put on the development of advanced monitoring techniques for forested ecosystems, none of these sources combine wide/total coverage and representation of each individual tree5. Reaching this level of detail is critical for dryland monitoring and management because dryland trees grow isolated and in highly variable size and density. Most current studies producing or using areal averages of tree cover, wood mass or carbon stocks in drylands are either at the very local level12 or the information for drylands is derived from global maps13, which are rarely trained and validated in drylands and often apply the same method on both forests and dryland vegetation6,7,8. Although national tree inventories exist for few dryland countries, the amount of labour required and their uncertainty are high. As a result, all existing assessments on dryland carbon stocks are highly uncertain, very difficult to validate and do not provide the means for a detailed characterization at the level of individual trees14. Furthermore, the contribution of different dry-mass components—wood, foliage and root mass—to the overall carbon stock is unknown at large scales.

At the same time, it remains unknown whether ecosystem models quantify the right amount of carbon and the lack of validation of global models or maps in dry areas fuels narratives of possible underestimation or overestimation of carbon stocks of drylands and their role in accelerating or mitigating climate change12,18. The missing information on trees at the level of individuals is decisive for improved management of woody resources in drylands: to accurately monitor deforestation spurred by clearing of trees for cropping, mining, infrastructure and urban development24. Furthermore, accurate monitoring of the tree resource at the level of individual trees is instrumental for tree-planting initiatives, for reporting the correct number of trees and carbon stocks for national reporting schemes, such as the Paris Agreement, or to have a reliable system that allows payments for environmental services to farmers and villages. Although deforestation and afforestation areas can be accurately mapped using current methods and data in forest ecosystems, no monitoring system exists for trees outside forests and their carbon pools32.

At present, large amounts of funding are being allocated to dryland-restoration activities and the monitoring of success or failure is based on local inventories lacking large-scale assessments of survival rates of planted trees. The Great Green Wall of the Sahara and the Sahel initiative has recently been subject to renewed interest and increased investments33,34,35. This initiative was conceived to address the increasing challenges of desertification and drought, food insecurity and poverty in the wake of climate change. Yet the tracking of projects and their successfulness remains a great challenge, as no monitoring system is in place. Equally important, large-scale monitoring of single trees will create a foundation for establishing improved knowledge on the functional traits of dryland trees, such as survival, growth and mortality, controlled by the complex interplay between biotic and abiotic factors32. Afforestation initiatives should also be rooted in a solid ecological understanding of the local environment to avoid causing water shortages for small-holder farming systems33.

The combined use of very-high-resolution satellite images and artificial intelligence made it possible to identify isolated trees and map their crown area at large scales, covering the western Sahara–Sahel–Sudan areas1. This approach of mapping individual trees has been extended to a 7.5-times-larger area covering the drylands across Africa, from the Atlantic Ocean to the Red Sea from 9.5° N to 24° N latitude between the 0 and 1,000 mm year−1 isohyets, using 326,523 satellite images at a 50-cm spatial resolution, and coupled with machine learning to map 9.9 billion trees (Fig. 1 and Methods). The large-scale mapping of individual tree crowns provides an unprecedented opportunity to apply allometric equations to estimate carbon stocks derived from foliage, wood and root dry masses at local scales to large regions, here close to 10,000,000 km2 (Extended Data Fig. 2). We take this step to assess the woody carbon pool by adding up tree-by-tree values, calculated using allometric equations to predict foliage, wood and root dry masses from crown area multiplied by the average carbon concentration (0.47). These allometric equations were established by destructive sampling of trees from 26, 27 and 5 species, respectively, selected within a rainfall gradient from 150 to 800 mm year−1. Comparisons with allometric equations established in wetter tropical areas ensure applicability of these equations to wetter zones, at least up to 1,000 mm year−1 rainfall19. We estimated the combined uncertainty from the allometric equations and the tree crown detection to be ±19.8%.

The information of carbon stocks of 9.9 billion trees is compared with a set of state-of-the-art TRENDY ecosystem models23 as well as current satellite-observation-based regional carbon stock maps6,7,8,9,10,11. We introduce a publicly available ‘viewer’, which allows farmers, villagers, policymakers and all stakeholders to retrieve the foliage wood and root masses and the corresponding carbon stock of each tree using a mobile device. We expect that this could improve not only the amount of information available but also the reporting and monitoring of trees and their carbon stocks at various scales, from the individual field plot to country scales.

## Carbon stocks at the tree level

We applied a deep-learning-based tree mapping on a large number of satellite images and measured 9,947,310,221 tree crowns: all woody plants with a shadow and a crown area >3 m2 from the hyper-arid (0–150 mm year−1), arid (150–300 mm year−1), semi-arid (300–600 mm year−1) and dry sub-humid (600–1,000 mm year−1) rainfall zones of tropical Africa north of the Equator and south of the Sahara (Fig. 1). The average carbon stock of a single tree is 51 kg C in the hyper-arid, 63 kg C in the arid, 72 kg C in the semi-arid and 98 kg C in the sub-humid zone. The individual tree information was projected to the area by calculating the carbon density in Mg C ha−1, which was on average 0.03 Mg C ha−1 in the hyper-arid, 0.54 Mg C ha−1 in the arid, 1.54 Mg C ha−1 in the semi-arid and 3.73 Mg C ha−1 in the sub-humid zone. Although foliage mass has a small overall fraction of the total dry mass (3%), it is an important variable for quantification of browse potential and serves as a proxy for other ecosystem processes, such as transpiration, photosynthesis and nutrient cycling. The proportion of root mass is on average 15–20% of the total mass.

## Current carbon map and model comparisons

We compared our aboveground carbon-density maps (foliage + wood) derived from individual trees with current state-of-the-art maps (Fig. 2 and Extended Data Fig. 3) available at moderate spatial resolutions of 30–1,000 m. The temporal dynamics were assessed by low-frequency passive microwaves (L-VOD)36,37, which has emerged as a tool for the assessment of carbon stock dynamics at the 25 × 25-km spatial scale (Extended Data Fig. 4). Moreover, we compared carbon-density maps and dynamics with dynamic ecosystem models from the TRENDY database with a 50 × 50-km grid cell size23. None of these maps were designed specifically for drylands; most dynamic ecosystem models and satellite-based models are developed and trained for forest ecosystems and, in the case of the TRENDY models, used meteorological forcings and prescribed vegetation maps that contain further uncertainties for comparative purposes.

Existing carbon-density maps compare differently with our assessment based on individual trees and there is little spatial agreement among the maps (Fig. 2a,b). Notably, although areas of scattered trees having a relatively low carbon density are largely mapped as zero carbon in previous maps except for ref. 9, areas of denser tree cover and some areas typically without trees, such as wetlands, irrigated croplands and desert mountains, have considerably higher values than our assessment. This leads to an overall higher carbon stock of the area compared with our results. Although we do not map herbaceous vegetation in our study, the tree cover we map can be used to disaggregate herbaceous vegetation from trees (Extended Data Fig. 5).

At regional scales, dynamic ecosystem model vegetation carbon shows a considerable variability, but the mean follows our estimates of herbaceous, wood, foliage and root carbon along the rainfall gradient (Fig. 2c). Notably, whereas previous studies assumed that ecosystem models underestimated dryland carbon stocks, our results show overall higher values from the model outputs as compared with the assessment based on individual trees, although large variations between models exist. Only considering aboveground carbon, the example of LPJ-GUESS shows slightly lower values than our assessment up to about 800 mm year−1 rainfall (Fig. 2d).

Both ecosystem models and previous satellite-based carbon maps diverge markedly from our results beyond 700–800 mm year−1 rainfall. All other maps assume a continuous increase beyond this rainfall zone, yet our results reach a plateau at 800 mm year−1 and no further increase in carbon is observed with higher rainfall up to 1,000 mm year−1. We acknowledge that the uncertainty of our results increases with denser canopy cover and that we miss all understory vegetation. However, statistical evaluations of the rainfall–tree density relationship from our data indicate that neither carbon stocks per tree (Fig. 1d) nor tree cover further increased between 800 and 1,000 mm year−1 rainfall (Fig. 3a). Trees with crown area <50 m2 make up 88% of the total number of trees, whereas trees in the semi-arid and sub-humid zones constitute 90% of the total carbon in our study (Fig. 3).

## Application at the tree level

The comparison with dynamic global vegetation models and existing biomass maps shows some similar patterns at coarse scale, yet none of these maps can be used to derive information at the level of individual trees needed to support policymakers and decision-makers. For this reason, we introduce a viewer (Fig. 4), which is built on Mapbox and OpenStreetMap, and can be accessed online by everyone and from anywhere. The viewer includes all 9.9 billion trees as objects, and the wood, foliage and root mass can be accessed individually for each of them. As an example, we show the area of Widou Thiengoly, an area in Senegal in which tree planting for the Great Green Wall has been promoted over the past decades (Fig. 4a). Although previous assessments on the success of tree plantations were based on narratives, visual interpretations or site visits, the viewer provides an unbiased tool for evaluating success and failure of initiatives, as well as quantifying the carbon stocks gained by each planted tree or lost by each removed/dead tree. The example shown in Fig. 4 illustrates that high-density plantations in this arid region reach carbon-density values of about 5 Mg C ha−1 (Fig. 1c), but the survival rate of planted trees has been a long-lasting concern that needs to be carefully monitored to be able to assess the efficacy of Sahelian tree-planting programmes.

Another example shows an agroforestry region in Senegal, north of Khombole that has a relatively high density of trees, which has increased the carbon stocks of the region considerably. The example area shown in Fig. 5 has almost doubled carbon density between 2002 and 2021 (Fig. 5).

## Discussion

Our assessment is a large-scale estimation of wood, foliage and root carbon at the level of individual trees. The finding that global ecosystem models and previous carbon-density maps estimate higher carbon stocks in African drylands compared with our assessment based on 9.9 billion individual trees seems surprising, as current tree-cover maps are not able to correctly account for scattered trees and thus should considerably underestimate the number of trees in these areas1. The explanation for this apparent paradox—higher tree cover but less carbon—is related to the fact that previous models are rarely developed, trained and validated with plots of very sparse tree cover, thus leaving high uncertainty for drylands with scattered trees. Consequently, areas with scattered trees are often represented by zero values (Fig. 6), whereas the carbon density of larger groups of trees may be overestimated in previous assessments, as these areas are wrongly considered as dense forests. In essence, most previous assessments do not accurately map carbon density below 10 Mg C ha−1, if at all, and may overestimate the carbon stocks of dryland ‘forests’. Moreover, if the region is taken as a whole, green crops and herbaceous vegetation affect optical images, whereas steep topography and wetlands/irrigated areas affect the radar backscatter, both predicting higher carbon stocks than our estimations. Although we used allometric equations specifically developed from locally sampled field data19, 95% of the trees we mapped had a crown area <78 m2. This introduces a small uncertainty in carbon values for the 5% of tree crowns >78 m2 in more humid areas, where trees are taller and/or larger.

Nevertheless, the divergence between our results and previous assessments in higher-rainfall zones needs to be further investigated and our maps should be used with caution beyond 800 mm year−1 rainfall. The indirect inclusion of the tree height and the application of the same equation to all tree species are uncertainty factors that will be assessed in future versions of the dataset. Finally, the fact that larger trees shade out smaller trees in areas of dense tree cover makes the method based on individual tree counting less suited to more humid areas.

Herbaceous dry mass can contribute considerably to the annual carbon density. However, most herbaceous plants of the region are annuals that die off each year and do not constitute a residual carbon stock but have a high inter-annual variability. The herbaceous mass used in our study36 shows the seasonal peak value, which drops by about 25% within only a few weeks (Extended Data Figs. 1a and 5). Traditionally, remotely sensed separation of herbaceous vegetation from woody foliage is challenging with both optical and radar satellite data. We overcome this by measuring individual tree crown areas.

The carbon difference between ecosystem models and our study can be explained by different forest fractions assumed by each model (Extended Data Fig. 6). Most of the dynamic global vegetation models do not simulate trees outside forests and woody carbon is usually a sum of predefined forest areas. Differences may also result from a simplistic implementation of disturbances, in particular, fire, grazing and the fact that we did not include belowground herbaceous carbon in our estimates. Still, the results of the dynamic vegetation models are closer to our estimations than previously assumed and the inclusion of our data may improve future modelling results, leading to more realistic forecasts of the impact of climate change on drylands.

Dryland trees are not only a carbon stock but also provide ecosystem services that are valuable to the environment and support local livelihoods, including timber, fuel wood, protection against soil erosion and loss, soil fertilization, shade and nutrition for tree crops15. The benefits of increased tree cover are many and establishing an operational monitoring system for dryland trees is critically needed. The dynamics of growth and mortality of trees outside forests goes undetected by conventional monitoring systems based on satellite imagery with a spatial resolution >10 m. Although our current assessment at the level of individual trees does not yet include a temporal dimension (except for the exemplary case provided in Fig. 5), it is a baseline of the number, mass and carbon stock of trees outside forests at the sub-continental scale. The publicly available viewer makes this information accessible for scientists, policymakers, stakeholders and individual farmers, who can easily quantify woody carbon stocks of a given area, down to the level of a single tree growing in a private yard.

A next step will be adding a temporal dimension to the wall-to-wall mapping we describe and we expect it to be possible from this source of data, at least with decadal time steps. This will facilitate addressing the impact of droughts, restoration and policies at various scales, down to the level of individual trees. High spatial resolution is the key to improved tree inventories in drylands. The ever-increasing availability of satellite images will make continental-scale assessments of carbon pools and dynamics at the individual tree level realistic in near-real time. This will be key to developing robust schemes for dryland management plans needed to achieve the United Nations’ Sustainable Development Goals. Our paper is a step in that process.

## Methods

### Overview

This study establishes a framework for mapping carbon stocks at the level of individual trees at a sub-continental scale in semi-arid sub-Saharan Africa north of the Equator. We used satellite imagery from the early dry season (Extended Data Fig. 1). The deep learning method developed by a previous study1 allowed us to map billions of discrete tree crowns at the 50-cm scale from West Africa to the Red Sea. Then we used allometry to convert tree crown area into tree wood, foliage and root carbon for the 0–1,000 mm year−1 precipitation zone in which our allometry was collected (Extended Data Fig. 2). We introduce a viewer that enables the billions of trees to be viewed at different scales, with information on location, metadata of the Maxar satellite image used, tree crown area and the estimated wood, foliage and root carbon content based on our allometry (Fig. 4). We also make available our output data for the 1,000 mm year−1 precipitation zone southward to 9.5° N latitude with information on location, precipitation, metadata of the Maxar satellite image used, tree crown area, tree wood carbon, tree root carbon and tree leaf carbon.

### Satellite imagery

We used 326,523 Maxar multispectral images from the QuickBird-2, GeoEye-1, WorldView-2 and WorldView-3 satellites collected from 2002 to 2020 from November to March from 9.5° N to 24° N latitude within Universal Transverse Mercator (UTM) zones 28–37 for Africa (Extended Data Table 1a). These images were obtained by NASA through the NextView License from the National Geospatial-Intelligence Agency. Data were assembled over several years with a focus on later years to achieve a relatively recent and complete wall-to-wall coverage.

When using satellite data from different satellites over several years, with varying sun–target–satellite angles, with varying radiometric calibration of satellite spectral bands and different atmospheric compositions through which the surface is imaged, there are two possibilities for using hundreds of thousands of satellite images together quantitatively. One approach, used extensively in NASA’s, NOAA’s and the European Space Agency’s Earth-viewing satellite programmes, is to quantitatively inter-calibrate radiometrically the satellite channels through time; correct these data for time-dependent atmospheric effects such as aerosols, clouds, haze, smoke, dust and other atmospheric constituent effects and then normalize the viewing perspective to the same sun–target–satellite angle38. Another approach is to use the satellite data as collected; assemble training data of trees viewed from different satellites under different sun–target–satellite angles, different times, different atmospheric conditions and use machine learning with high-performance computing to perform the tree mapping at the 50-cm scale. The key to successful machine learning is to account for all the sources of variation within the domain of study in the training data to ensure accurate identification of trees under all circumstances. We included trees viewed substantially off-nadir, trees collected under different aerosol optical thicknesses, trees collected under cirrus cloud conditions, trees viewed in the forward and backward scan directions, trees on sandy soils, trees on clay soils, trees on burn scars, trees in laterite areas and trees in riverine settings. Our training data were collected by one team member and are a carefully selected manual delineation of 89,899 individual trees under a range of atmospheric conditions, viewing perspectives and ecological settings.

All multispectral and panchromatic bands associated with our Maxar images were orthorectified to a common mapping basis. We next pan-sharpened all multispectral bands to the 0.5-m scale with the associated panchromatic band. The absolute locational uncertainty of pixels at the 0.5-m scale from orbit is approximately ±11 m, considering the root-mean-square location errors among the QuickBird-2, GeoEye-1, WorldView-2 and WorldView-3 satellites (Extended Data Table 1). We formed the normalized difference vegetation index (NDVI)39 from every image in the traditional way from the pan-sharpened red and near-infrared bands. We also associated the panchromatic band with the NDVI band and ensured that the panchromatic and NDVI bands were highly co-registered. The NDVI was used to distinguish tree crowns from non-vegetated background because the images were taken from a period when only woody plants were photosynthetically active in this area36. Our training data were labelled on images from the early dry season when only trees have green leaves. Because most semi-arid savannah trees continue to photosynthesize in the early dry season after herbaceous vegetation senesces, green leaf tree crowns are easily mapped because of their higher NDVI values than their senescent herbaceous vegetation surroundings. We substantiate this by analysis of 308 individual trees using NDVI time series with 4-m PlanetScope imagery that emphasized the importance of satellite data from the November, December and January early dry-season months (Extended Data Fig. 1).

We next formed our data into mosaics by applying a set of decision rules, resulting in a collection of 16 × 16-km tiles within each UTM zone from 9.5° N to 24° N latitude for Africa. The initial round of scoring considered percentage cloud cover, sun elevation angle and sensor off-nadir angle: preference was given to imagery that had lower cloud cover, then higher sun elevation angle and finally view angles closest to nadir. In the second round of scoring, selections were assigned priority to favour early dry-season months and off-nadir view angles: preference was given to imagery from November, December and January with off-nadir angle less than ±15°; second to imagery from November to January with off-nadir angle between ±15° and ±30°; third to imagery from February or March with off-nadir angle less than ±15°; and finally to imagery from February or March with off-nadir angle between ±15° and ±30°. Image mosaics were necessary to eliminate multiple counting of trees. We formed mosaics using 94,502 images for tree segmentation, with 94% of these being from November, December and January. Ninety percent of our selected mosaic imagery was within ±15° of nadir, 87% were acquired between 2010 and 2020 and 94% were from the early dry season (Extended Data Fig. 7). A summary of month, year, solar elevation and off-nadir angle by UTM zone can be found in Supplemental Information Fig. 1.

Possible obscuration of the surface by clouds totalled 4.1% of our input mosaic data area and aerosol optical depth >0.6 at 470-nm (ref. 40) areas totalled 3.4% of our input data. However, we mapped 691,477,772 trees in our possible cloud-cover-affected and aerosol-affected areas, indicating that cloud and aerosol effects were lower than these numbers. In addition, 0.9% of our input data did not process. We include a data layer in our viewer for these three conditions.

### Mapping tree crowns with deep learning

We used convolutional neural network models developed by a previous study1. The models were trained with manually delineated and annotated 89,899 individual trees along a north–south gradient from 0 to 1,000 mm year−1 rainfall1. Only features that showed a distinct crown area and associated shadow were included, which excluded small bushes, grass tussocks, rocks and other features that might have green leaves or cast a shadow from our classification. All training data and model training was done in UTM zones 28 and 29. Because tree floristic diversity in the 0–1,000 mm year−1 zone of our study is highly similar from the Atlantic Ocean to the Red Sea across Africa41,42,43, we added no further training data as our study moved further eastward. We used state-of-the-art deep learning to segment trees crowns at the 50-cm scale1. We used two different models based on a U-Net architecture, one for lower-rainfall desert regions with <150 mm year−1 precipitation and one for regions with average annual precipitation >150 mm year−1. Details about the network architecture, training process and hyperparameter choices can be found in ref. 1. Previous evaluation showed that early dry-season images performed better than late dry-season images, which was a limitation of our previous study. We reduced this error by using early dry-season images with only 6% of our area being covered by images from February and March. The models were also designed to separate clumped trees by highlighting spaces between different crowns during the learning process, similar to a strategy for separating touching cells in microscopic imagery22.

### Allometry

Very-high-resolution satellite images and deep learning have achieved mapping of individual trees over large areas1. Each tree is georeferenced in the satellite data and defined by crown area. The challenge was to develop allometric equations for foliage, wood and root dry masses or carbon based on crown area regardless of species. This was met by reanalysing existing Sahelian and Sudanian woody plant data from destructive sampling. Overall, the seasonal maximum foliage, wood and root dry masses were measured on 900, 698 and 26 trees or shrubs from 27, 26 and 5 species, respectively, for which crown area was also measured. Several allometric regression models tested for foliage, wood or root masses are power functions and independent of species. All the regression outputs were inter-compared for fit indicators, by systematic estimates of prediction uncertainty and by root-to-wood ratios and foliage-to-wood ratios over the range of crown areas. This resulted in a set of ordinary least squares log–log equations with crown area as the independent variable. The Sahelian and Sudanian allometry equations were also compared with published allometry equations for tropical trees, primarily from more humid tropics, which are generally based on stem diameter, tree height and wood density. Our allometric predictions are within the range of other allometry predictions, reinforcing the confidence in their use beyond the Sahelian and Sudanian domains into sub-humid savannahs for discrete trees19.

On the basis of ref. 19, we predicted the wood (w), foliage (f) and root (r) dry mass as functions of the crown area (A) of a single tree as:

$$\begin{array}{c}{\text{mass}}_{{\rm{w}}}(A)=3.9448\times {A}^{1.1068}\,({N}_{{\rm{w}}}=698)\\ {\text{mass}}_{{\rm{f}}}(A)=0.2693\times {A}^{0.9441}\,({N}_{{\rm{f}}}=900)\\ {\text{mass}}_{{\rm{r}}}(A)=0.8339\times {A}^{1.1730}\,({N}_{{\rm{r}}}=26)\end{array}$$

The tree mass components of wood, leaves and roots were combined to predict the total mass(A) in kg of a tree from its crown area A in m2:

$$\text{mass}\left(A\right)={\text{mass}}_{{\rm{w}}}\left(A\right)+{\text{mass}}_{{\rm{f}}}\left(A\right)+{\text{mass}}_{{\rm{r}}}\left(A\right)$$

As in ref. 1, a crown area of size A > 200 m2 was split into $${\rm{\lfloor }}A/100{\rm{\rfloor }}$$ areas of size 100 m2 and one area with the remaining m2 if necessary. We converted dry mass to carbon by multiplying with a factor of 0.47 (ref. 44).

### Uncertainty analysis

We evaluated the uncertainty of our tree crown area mapping and carbon estimation in two ways. First, we quantified our tree crown mapping omission and commission errors by inspecting randomly selected areas from UTM zones 28–37, validating that our neural network generalized over UTM zones consistently (Extended Data Fig. 8).

Second, we quantified the relative error of our tree crown area estimation. We consider the uncertainty Δx of a quantity x and the corresponding relative uncertainty δx defined by the absolute and relative error, respectively45. To assess the relative error in crown area estimation resulting from errors by the neural network, we considered external validation data from ref. 1, which were not used in the model-building process. We considered expert-labelled tree crowns as well as the predicted tree crowns from 78 plots of 256 × 256 pixels. The hand-labelled set contained 5,925 trees and the system delineated 5,915 trees. The total hand-labelled tree crown area was 118,327 m2 and the neural network predicted 121,898 m2. This gave a relative error in crown area mapping of δarea = 3.3%. We matched expert-labelled and predicted tree crowns and computed the root-mean-square error (RMSE) per tree, taking overlapping areas and missed trees into account (see Extended Data Fig. 8). We estimated the allometric uncertainty (δallometric) using the data from ref. 19 (see below). The two relative errors δarea and δallometric were combined to an overall uncertainty estimate for the carbon prediction of ±19.8% (see below).

### Omission and commission errors

We evaluated our tree crown mapping accuracy by analysis of 1,028 randomly selected 512 × 256-pixel areas over the 9.5° N to 24° N latitude within UTM zones 28–37. Because the drier 60% of our study area only contains 1% of the 9,947,310,221 trees we mapped in the 0–1,000 mm year−1 rainfall zone, we applied an 80% bias for selecting evaluation areas above the 200 mm year−1 precipitation line46, as >98% of tree identifications were above the 200 mm year−1 precipitation isoline. Identified tree polygons were further categorized into tree crown area classes from 0–15 m2, 15–50 m2, 50–200 m2 and >200 m2, with a total of 50,570 trees evaluated. Although a previous study reported greatest uncertainty in both the smallest and largest area classes1, our more expansive work found the greatest uncertainty in our smallest tree class. We excluded from evaluation any tiles that had annual precipitation46 >1,000 mm year−1 and all areas that were devoid of vegetation, leaving us with 850 areas.

Seven members of our team evaluated the accuracy in terms of commission and omission by tree crown area classes for the 850 areas. Input data provided for every area were the NDVI layer, the panchromatic shadow layer and the neural net mapping results in each of the four crown area classes. Ancillary data available to evaluators included the centre coordinates for comparison with Google Earth data, the Funk et al.46 rainfall, the acquisition date of the area evaluated and the viewing perspective.

We identified areas wrongly classified as tree crowns (commission errors), missed trees (omission errors) and crown areas corresponding to clumped trees (Extended Data Fig. 8). Clumped trees were most common for >200 m2 tree crown area. They were rare in the 3–15 m2 and 15–50 m2 tree classes, which comprise 88% of our tree crowns. In the 850 patches, the number of trees ranged from one tree to 326 trees, with a total of 50,570 trees evaluated and 3,765 errors identified. Overall, the commission and omission error rates were 4.9% and 2.7%, respectively, a net uncertainty of 2.2%.

### Allometric uncertainty estimation

The prediction of tree carbon from the crown area for a single tree based on crown area alone is inherently uncertain47,48. As the allometric equations are based on three different datasets, we compute their uncertainties independently, combine them and put them in relation to the total carbon measured in the three datasets.

The allometric equations were established using an optimal least-squares fit of an affine linear model predicting the logarithmic carbon from the logarithmic tree crown area19. To estimate the uncertainty of the allometric equations, we repeated the fitting using random subsampling. The datasets were randomly split into training data (80%) for fitting the allometric equations and validation data (20%) for assessing the uncertainty. For example, from the root measurements, $$({A}_{1},{y}_{1}),\ldots ,({A}_{{N}_{{\rm{r}}}}\,,{y}_{{N}_{{\rm{r}}}})$$, we compute $${\mu }_{{\rm{r}}}=\frac{1}{{N}_{{\rm{r}}}}\mathop{\sum }\limits_{i=1}^{{N}_{{\rm{r}}}}{y}_{i}$$ and $${\hat{\mu }}_{{\rm{r}}}=\frac{1}{{N}_{{\rm{r}}}}\mathop{\sum }\limits_{i=1}^{{N}_{{\rm{r}}}}{\text{mass}}_{{\rm{r}}}({A}_{i})$$. The corresponding error is $${\varDelta }_{{\rm{r}}}=|{\mu }_{{\rm{r}}}-{\hat{\mu }}_{{\rm{r}}}|$$.

Because the total carbon for a tree with a certain crown area is the sum of the three carbon components, we add the absolute uncertainties assuming independence45.

$${\varDelta }_{{\rm{a}}{\rm{l}}{\rm{l}}{\rm{o}}{\rm{m}}{\rm{e}}{\rm{t}}{\rm{r}}{\rm{i}}{\rm{c}}}\simeq \sqrt{{\varDelta }_{{\rm{f}}}^{2}+{\varDelta }_{{\rm{w}}}^{2}+{\varDelta }_{{\rm{r}}}^{2}}$$

and compute the relative uncertainty as $${\delta }_{\text{allometric}}=\frac{{\varDelta }_{\text{allometric}}}{{\mu }_{\text{mass}}}$$, in which the average mass μmass is given by the sum of the averages for wood (μw), leaves (μf) and root (μr). This process was repeated ten times, resulting in a mean relative uncertainty of

$${\bar{\delta }}_{{\rm{allometric}}}=19.5 \% .$$

### Total carbon uncertainty

We combine the uncertainties from the neural net mapping and our allometric equations, which can be viewed as considering (1 + A)·(1 + B) with A and B being random variables with standard deviations δarea and δallometric. Neglecting higher-order and interaction terms, we combine the two sources of uncertainty to $$\delta \simeq \sqrt{{\delta }_{{\rm{area}}}^{2}+{\bar{\delta }}_{{\rm{allometric}}}^{2}}$$, resulting in an uncertainty in total tree carbon for our study of ±19.8%. See also Extended Data Fig. 9 for the RMSEs of our predicted crown areas calculated on external validation data from ref. 1, binned on the basis of the 50th quantiles of the hand-labelled crown areas and converted also into carbon. Extended Data Fig. 10 is a flow diagram summarizing our methods.

### Our viewer

Visualizing our large tree-mapping dataset in an interactive format was essential for quality-control purposes, exploration of the data and hypothesis creation. Creating a web-based viewer serves the purpose of being the initial point of interaction with our dataset for fellow researchers, local stakeholders or the general public. The visualization of more than 10 billion trees in a web browser required maintaining performance, interactivity and individual metadata for each polygon. Users should be able to zoom in to any area within the dataset to view individual tree polygons and query their statistics while at the same time accurately depicting the overall trends of the dataset at lower zoom levels. The visualization also needed to clearly denote where data were missing or possibly affected by clouds or aerosols. Finally, the extent and origin of the source imagery, its acquisition date and a preview of the imagery needed to be available. To accomplish these goals, a vector-tile-based approach was taken, with the data visualized in a Mapbox GL JS map within a React web application. To create vector tiles covering the entire study area, we developed a data-processing pipeline using high-performance computing resources to transform the data into compatible formats, as well as to package, optimize and combine the vector tiles themselves.

We used two tracks to store and visualize the results of this study on the web: vector polygon data and generalized rasters representing tree crown density. At the native spatial resolution of 50 cm, the map shows the full-resolution tree polygon dataset. At lower-spatial-resolution zoom levels, rasterized representations of tree density are shown. Visualizing generalized rasters in place of vector polygons improves performance substantially. As users zoom in to higher spatial resolutions, the raster layer fades away and is replaced by the full-resolution polygon layer. Once zoomed far enough to resolve individual polygons, users can click to select a polygon to show a map overlay containing various properties of the tree, as well as the date on which the source imagery was acquired and a link to preview the source imagery.

#### Rainfall data

We used the rainfall data of Funk et al. to estimate annual rainfall at 5.6-m grids46. We averaged the available data from 1982 to 2017 and extracted the mean annual rainfall for each mapped tree and bilinearly interpolated it to 100 × 100-m resolution. The rainfall data were also used to classify the study area into mean annual precipitation zones: hyper-arid from 0–150 mm year−1, arid from 150–300 mm year−1, semi-arid from 300–600 mm year−1 and sub-humid from 600–1,000 mm year−1 zones. The rainfall data are found at https://data.chc.ucsb.edu/products/CHIRPS-2.0/africa_monthly/ (ref. 46).