Skip to content

jpdarela/Reference_phosphorus_maps_pan-Amazon

Repository files navigation

Reference maps of soil phosphorus for the pan-Amazon region - CODE & DATA

DOI

Darela-Filho, J. P., & Lapola, D. M. (2023). Reference maps of soil phosphorus for the pan-Amazon region: code and data, V3, Repositório de Dados de Pesquisa da Unicamp. https://doi.org/doi:10.25824/redu/FROESE

Introduction

This repository contains code and data employed to generate a set of reference maps of soil phosphorus (P) for the Pan-Amazon region. The primary intent of these maps is to provide reference data for parametrization and benchmark of Land Surface/Terrestrial Ecosystem models.

The maps created are the mean prediction of a set of random forest regression models fitted with available observed in situ data found in scientific literature. The model predictions are generated based on data from geographic datasets that have the same features utilized to fit the models.

Results

The final maps (in netCDF format) from REF 1 (The original experiment) are archived here.

Input data

We employed data from several other datasets as input to the P maps generation. These data may have other licensing than the MIT Licence. The references are listed in the README.

Reproducing the P maps

If you want it is possible to build the P maps archived in the ./RESULTS folder and create similar figures found in REF 1. The created figures are stored in a folder named ./p_figs

Software dependencies

  • python3 - numpy, pandas, matplotlib, cartopy, scikit-learn, netCDF4, cfunits, pyarrow, numba

  • make, geos, proj, udunits2

1 - Create the maps and figures:

Please, note that this program does a high amount of computations when configured to the original/full experiment. To test it and also to make a preliminary analysis of the methods I tweaked the initial number of models generated. In FILE 1 the global variable NMODELS at line 28 can be changed at your will. In the Makefile the files that do de work are organized into the logical sequence of execution (FILE1 to FILE6) and can executed at command.

First, install software dependencies. I suppose that you have a python3 (called python) that you can call from the command line. The same for make. You can change the python executable in the first line of the Makefile.

You can do it in a GNU/linux operating system (tested). In windows you can set up a environment with the required software using conda (anaconda3, tested). Not tested in other OS.

Navigate to the main folder:

$ make pmaps

Done.

The files with the maps are created in the root folder in NETCDF4(HDF5) format (The results of the original experiment are here). CRS=EPSG4326 (WGS84)

The masks generated by the calculation of the dissimilarity index are stored in this folder.

Creating an environment with conda (anaconda3) in windows

Issue the following command on the anaconda3 PS/cmd prompt to create a new virtual environment called pmaps. It will be used to run the code:

(base)C:\> conda create --channel conda-forge -n pmaps make m2-base geos proj udunits2 python numpy pandas matplotlib cartopy scikit-learn netCDF4 cfunits pyarrow numba

At this point close the anaconda prompt and set the environment variable UDUNITS2_XML_PATH to the path of the udunits2.xml file in your system. This file will be in the user folder, under an address like ~/anaconda3/Library/share/udunits/udunits2.xml.

Re-open the anaconda prompt and navigate to the home folder of this README and activate the newly created virtual environment:

(base)C:\> conda activate pmaps

Then you just use make to make the P maps:

(pmaps)C:\> make pmaps

The chosen colormaps are colourblind-friendly. I am thankful to Fabio Crameri for providing the Scientific Colourmaps.

References

1 - Darela-Filho, J. P., Rammig, A., Fleischer, K., Reichert, T., Lugli, L. F., Quesada, C. A., Hurtarte, L. C. C., de Paula, M. D., and Lapola, D. M.: Reference Maps of Soil Phosphorus for the Pan-Amazon Region, Earth Syst Sci Data, 16, 715-729, https://doi.org/10.5194/essd-16-715-2024, 2024.

2 - Crameri F, Shephard GE, Heron PJ. 2020. The misuse of colour in science communication. Nature Communications 11(1): 5444.