Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
07a2285
Initial commit of R scripts for processing managed carbon types
EvanRMargiotta Jun 14, 2022
943fe21
Update write_glu_mapping.c
EvanRMargiotta Jun 29, 2022
e2c777b
Updates to input args and read_soil_carbon.c
EvanRMargiotta Aug 10, 2022
b8f8287
Update moirai.h
EvanRMargiotta Aug 15, 2022
0a04ea1
Updated input rasters
EvanRMargiotta Aug 23, 2022
5edece6
Changes to read in and soil carbon processing scripts
EvanRMargiotta Aug 24, 2022
2a94dde
Update get_in_args.c
EvanRMargiotta Aug 24, 2022
d465eda
Updates to read_veg_carbon + some minor changes to other scripts
EvanRMargiotta Aug 29, 2022
a15a3bc
Final commit of c code and diagnostic functions
kanishkan91 Sep 27, 2022
8003000
Latest rasters
kanishkan91 Nov 30, 2022
c3c0ced
Final files
kanishkan91 Nov 30, 2022
a22097a
Updated veg carbon rasters
kanishkan91 Dec 5, 2022
6f21c92
modified: include/moirai.h
PerryMapping Jan 19, 2023
4ac8fa8
carbon boolean draft
PerryMapping Jan 19, 2023
d78c1a2
fix formatting
PerryMapping Jan 19, 2023
3dc387a
Update moirai.h
PerryMapping Jan 19, 2023
17fe6eb
Update moirai_main.c
PerryMapping Jan 19, 2023
6985210
run_carbon
PerryMapping Jan 19, 2023
9542f6c
add carbon
PerryMapping Jan 19, 2023
1ae8d4d
Update moirai_input_basins235.txt
PerryMapping Jan 25, 2023
941696d
Update moirai_main.c
PerryMapping Jan 25, 2023
ba47346
Update moirai_main.c
PerryMapping Jan 25, 2023
dc0e759
Update init_moirai.c
PerryMapping Jan 25, 2023
678fae2
Create set_run_carbon.c
PerryMapping Jan 25, 2023
75170fe
Update moirai.h
PerryMapping Jan 25, 2023
e0d17b8
Update github links in ReadMe
PerryMapping Jan 25, 2023
f836c71
Need to update input file descriptions for carbon
PerryMapping Jan 25, 2023
210c3e7
Comment clarification
PerryMapping Feb 9, 2023
e16cbbc
Add carbon boolean to in_args struct
PerryMapping Feb 9, 2023
b952b3a
Add case for carbon boolean input variable
PerryMapping Feb 9, 2023
d7d876d
Update carbon boolean
PerryMapping Feb 9, 2023
345f621
Carbon function
PerryMapping Feb 9, 2023
89fe213
Update run_carbon.c
PerryMapping Feb 9, 2023
04e7687
Add carbon variable to second example input
PerryMapping Feb 9, 2023
e8ec41b
Update from review
PerryMapping Mar 14, 2023
f7063a1
Update from review
PerryMapping Mar 14, 2023
b68ce24
Update from review
PerryMapping Mar 14, 2023
a562044
Update from review
PerryMapping Mar 14, 2023
7dbf158
Update from review
PerryMapping Mar 14, 2023
25b48da
Update from review
PerryMapping Mar 14, 2023
aaf532d
Update from review
PerryMapping Mar 14, 2023
a8adc7e
Clarification on debugging blocks
PerryMapping Mar 15, 2023
3fabdbd
Fixed typos
PerryMapping Mar 20, 2023
da6ea05
draft for R Demeter
PerryMapping Mar 24, 2023
19c0016
draft python script for R Demeter
PerryMapping Mar 24, 2023
e215362
Rename RDemeter_draft to RDemeter_draft.R
PerryMapping Mar 24, 2023
6a789fe
RDemeter Draft ReadMe
PerryMapping Mar 24, 2023
571e2fc
create folder for r demeter
PerryMapping Mar 24, 2023
9a68ebf
Delete RDemeter_ReadMe_draft.txt
PerryMapping Mar 24, 2023
c0aa238
moved to folder
PerryMapping Mar 24, 2023
a509e52
moved to folder
PerryMapping Mar 24, 2023
993a35c
moved
PerryMapping Mar 24, 2023
97b57fc
moved into folder
PerryMapping Mar 24, 2023
073f1a7
moved to folder
PerryMapping Mar 24, 2023
3dfffb6
draft name
PerryMapping Mar 24, 2023
27e3735
draft name
PerryMapping Mar 24, 2023
e27072f
clarification
PerryMapping Mar 27, 2023
ce3e7f1
Update readme.md
kanishkan91 Jun 11, 2023
69a6849
Udpated aez input file and example outputs
aldivi Jun 23, 2023
91cb636
Merge branch 'mp_carbon_branch' into test_carbon_flag
aldivi Jun 23, 2023
678af4e
Implemented flag to turn carbon processing on or off
aldivi Jun 29, 2023
8be6a37
Update README.md Windows/WSL netcdf notes
PerryMapping Aug 21, 2023
141fc78
Update README.md
kanishkan91 Sep 20, 2023
715a928
Update readme.md
kanishkan91 Sep 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ There are two example input files that can be run without modification (see belo
Only the NetCDF library has to be downloaded and installed by the user, as the five data sets below are now included in the repository through the LFS system. Associated licenses and ownership are included in `…/moirai/docs/third_party_contributions_v31.pdf.docx`.

### C NetCDF library
The user must have the C NetCDF library installed (available at [http://www.unidata.ucar.edu/software/netcdf/](http://www.unidata.ucar.edu/software/netcdf/). The header and library search paths for compiling Moirai LDS must be set accordingly (see above). The version used and tested for Moirai LDS is NetCDF version 4.1.1. An archived version of this library is now available here: [Required Libraries](https://stash.pnnl.gov/projects/JGCRI/repos/moirai/browse/required_libs).
The user must have the C NetCDF library installed (available at [http://www.unidata.ucar.edu/software/netcdf/](http://www.unidata.ucar.edu/software/netcdf/). The header and library search paths for compiling Moirai LDS must be set accordingly (see above). The version used and tested for Moirai LDS is NetCDF version 4.1.1. An archived version of this library is now available here: [Required Libraries](https://stash.pnnl.gov/projects/JGCRI/repos/moirai/browse/required_libs). When installing on a Windows machine, it may help to make sure there are no spaces in the path of the install directory. Additionally for Windows, if an error message such as "Warning! PATH too long installer unable to modify PATH!" occurs during NetCDF install, adding the path manually to the user's environmental variables may fix this. Alternatively, Windows Subsystem for Linux may be utilized for installation following the Linux guidance.

## All input data are included with this distribution
The following data are included in the distribution via the Git LFS system, but instructions for downloading are included below if necessary, and they reside in their own folders as specified by the Moirai input file.
Expand Down Expand Up @@ -143,7 +143,7 @@ The Moirai LDS also generates these files (some of which were previously stored
* **MIRCA_irrHA_ha.csv** = irrigated harvested area, country X GLU X 26 crop classes (hectares)
* **MIRCA_rfdHA_ha.csv** = rainfed harvested area, country X GLU X 26 crop classes (hectares)
* **Land_type_area_ha.csv** = land type area, country X GLU X SAGE vegetation type X HYDE land use type X Suitability and protection category X year (hectares)
* **Ref_veg_carbon_Mg_per_ha.csv** = soil and veg C density for reference vegetation land types, country X GLU X land type X soil (0-30 cm) / above ground vegetation C / below ground vegetation C (Megagrams per hectare) for 6 states (weighted average, median, minimum, maximum, quartile 1 and quartile 3). As the corresponding input data are circa 2010, these output data are based on the 2010 land type area distribution.
* **Ref_veg_carbon_Mg_per_ha.csv** = soil and veg C density for all land and vegetation types, country X GLU X land type X soil (0-30 cm) / above ground vegetation C / below ground vegetation C (Megagrams per hectare) for 6 states (weighted average, median, minimum, maximum, quartile 1 and quartile 3). As the corresponding input data are circa 2010, these output data are based on the 2010 land type area distribution.
* **Water_footprint_m3.csv** = average annual water volume consumed (1996-2005), country X GLU X 18 crop X water type (m<sup>3</sup>), blue = surface and groundwater irrigation, green = rain, gray = needed to dilute pollutant runoff, total = the sum, but is slightly different than summing the individual type outputs due to rounding
* These names and the destination directory are set in the Moirai LDS input file.

Expand Down Expand Up @@ -172,14 +172,14 @@ The Moirai LDS also generates the following associated raster files along with t
* **urban_area_####.bil** = Valid cropland area in km<sup>2</sup> for the land use/cover output raster year specified in the input file.

## Inputs
This section focuses on the inputs listed in the Moirai LDS input file. Of the many inputs to the Moirai LDS, those listed in the Moirai LDS input file are the most important as they include the primary source data in addition to the GLU definition that determines how to aggregate the source data. The extent and resolution of the default raster input data determine the working resolution of the Moirai LDS, which is defined in the Moirai LDS header file (`…/moirai/include/moirai.h`; global extent, 5 arcmin resolution). When substituting input data the user must ensure that the new data are read in and resampled to the working grid. An alternative grid can also be defined in the Moirai LDS header file. Each input has its own read function that can be rewritten to accommodate input dataset substitution. Input raster data sources are listed in Table 1 ([…/moirai/docs/moirai_v31_table_1.pdf](https://github.com/JGCRI/moirai/blob/master/docs/moirai_v31_table1.pdf)) and input text data sources in Table 2 ([…/moirai/docs/moirai_v31_table_2.pdf](https://github.com/JGCRI/moirai/blob/master/docs/moirai_v31_table2.pdf)).
This section focuses on the inputs listed in the Moirai LDS input file. Of the many inputs to the Moirai LDS, those listed in the Moirai LDS input file are the most important as they include the primary source data in addition to the GLU definition that determines how to aggregate the source data. The extent and resolution of the default raster input data determine the working resolution of the Moirai LDS, which is defined in the Moirai LDS header file (`…/moirai/include/moirai.h`; global extent, 5 arcmin resolution). When substituting input data the user must ensure that the new data are read in and resampled to the working grid. An alternative grid can also be defined in the Moirai LDS header file. Each input has its own read function that can be rewritten to accommodate input dataset substitution. Input raster data sources are listed in Table 1 ([…/moirai/docs/moirai_v31_table_1.pdf](https://github.com/JGCRI/moirai/tree/master/docs/moirai_v31_table1.pdf)) and input text data sources in Table 2 ([…/moirai/docs/moirai_v31_table_2.pdf](https://github.com/JGCRI/moirai/tree/master/docs/moirai_v31_table2.pdf)).

### Preparing substitute Geographic Land Unit (GLU) data
The easiest and most common input data substitution will be for the GLU data that determine the final boundaries for data aggregation. This substitution does not require code modification as long as the data are prepared in the same format as the original data. The GLU data are integers that thematically assign each pixel to a single GLU, with ocean assigned the no-data value of -9999. There are separate land area input data that determine which pixels are land pixels, but the substitute GLU data can also include other water bodies with no-data values. The raster file (see "GLU thematic map" below) is a single-band binary file with 4-byte signed integer values, no header, and 5 arcmin resolution. It uses the WGS84 geographic datum with no projection, and the first value in the file is the pixel with upper left corner at -180 degrees longitude and 90 degrees latitude. The values are stored in order of ascending longitude in each descending latitude row, with longitude varying faster. The mapping of the thematic values to names is defined in the GLU text file (see "List of output GLU names" below). This is a comma-separated-value file with two columns and one header line. The first column contains the GLU integer, the second column contains the GLU name, and the header text is not used.

### Moirai LDS input file
(e.g., `…/moirai/input_files/moirai_input_basins235.txt`)
The Moirai LDS input file specifies the input and output paths, the file names of the primary input and output files, and whether additional diagnostic files are output. The output year for production, harvested area, and land rent outputs, is specified, as well as the input year of the required crop data to determine whether or not recalibration is necessary. Similarly, the output USD value year for land rent is specified along with the input USD value year of the FAO price data in order to perform the correct price calibration. The input file code variables are filled based on the order of the uncommented lines in the input file, rather than by keyword (# is the comment character), and there are 76 input values read from the input file. Thus, the following input descriptions follow the order in the input file.
The Moirai LDS input file specifies the input and output paths, the file names of the primary input and output files, and whether additional diagnostic files are output. The output year for production, harvested area, and land rent outputs, is specified, as well as the input year of the required crop data to determine whether or not recalibration is necessary. Similarly, the output USD value year for land rent is specified along with the input USD value year of the FAO price data in order to perform the correct price calibration. The input file code variables are filled based on the order of the uncommented lines in the input file, rather than by keyword (# is the comment character), and there are 131 input values read from the input file. Thus, the following input descriptions follow the order in the input file.

### Flags
* diagnostics: 0 = no, 1 = output diagnostics files
Expand Down Expand Up @@ -238,8 +238,8 @@ The Moirai LDS input file specifies the input and output paths, the file names o
* **SAGE physical cropland area, circa 2000**: Physical cropland area circa 2000, as fraction of cell area (`Cropland2000_5min.nc`)
* These data are used to normalize the SAGE individual crop harvested area values to each grid cell
* Please cite these data when using Moirai: Ramankutty, N., Evan, A. T., Monfreda, C. & Foley, J. A. 2008. Farming the planet: 1. Geographic distribution of global agricultural lands in the year 2000. Global Biogeochem. Cycles, 22, GB1003.
* **Soil carbon density (0-30 cm) rasters (6)** (Please see `…/moirai/ ancillary/carbon_harmonization/readme.md` for details on the same)
* **Vegetation carbon density rasters (12)**(Please see `…/moirai/ ancillary/carbon_harmonization/readme.md` for details on the same)
* **Soil carbon density (0-30 cm) rasters (24)** (Please see `…/moirai/ ancillary/carbon_harmonization/readme.md` for details on the same)
* **Vegetation carbon density rasters (48)**(Please see `…/moirai/ ancillary/carbon_harmonization/readme.md` for details on the same)

### CSV input data (filename without path)
* **Original GTAP LU2.1 land rent data** (`GTAP_value_milUSD.csv`): Please cite these data when using Moirai: Lee, H.-L., Hhertel, T. W., Rose, S., Avetisyan, M. An integrated global land use data base for CGE analysis of climate policy options. Chapter 4, pp. 72-88, in Hertel, T. W., S. Rose and R. Tol (eds.) (2009). Economic Analysis of Land Use in Global Climate Change Policy. Abingdon: Routledge.
Expand Down Expand Up @@ -273,11 +273,14 @@ The Moirai LDS input file specifies the input and output paths, the file names o
* The crop irrigated harvested area output file (`MIRCA_irrHA_ha.csv`)
* The crop rainfed harvested area output file (`MIRCA_rfdHA_ha.csv`)
* The historical land type area output file (`Land_type_area_ha.csv`)
* The reference vegetation type carbon density output file (`Ref_veg_carbon_Mg_per_ha.csv`)
* The carbon density output file (`Ref_veg_carbon_Mg_per_ha.csv`)
* The crop water volume consumption output file (`Water_footprint_m3.csv`)
* The country X GLU mapping output file (`MOIRAI_ctry_GLU.csv`)
* The land type mapping output file (`MOIRAI_land_types.csv`)

### Carbon Flag
* carbon_enabled: Set to 1 to process carbon by land type in moirai. Setting to 0 only produces land accounts.

## Diagnostics
A detailed description of all the diagnostics features is available in: `…/moirai/diagnostics/readme.md`

Expand Down
4 changes: 2 additions & 2 deletions ancillary/carbon_harmonization/Carbon_rasters.zip
Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions ancillary/carbon_harmonization/ManagedCarbonRasterOutputs.zip
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Loading