|
@@ -0,0 +1,494 @@
|
|
|
+function specifications = fao_total_specifications_2023(sourcename)
|
|
|
+% fao_specifications just creates a structure containing all informations
|
|
|
+% needed to parse the fao files...
|
|
|
+%
|
|
|
+% INPUT PARAMETERS: None
|
|
|
+%
|
|
|
+% RETURN PARAMETERS:
|
|
|
+% specifications: a structure with many constants needed to parse the
|
|
|
+% input xls files for the program read_bulkplus_sheet.
|
|
|
+% specifications contains two fields, 'keystruct', and 'mapstruct'.
|
|
|
+% - specifications.keystruct - is a structure of sheet fieldnames (e.g.
|
|
|
+% 'sheet_category'), where the value is a cellstr of the labels that
|
|
|
+% should be used to assign the value. The list is taken in the order it
|
|
|
+% is listed.
|
|
|
+% - specifications.mapstruct - is a structure that maps column headers (or other
|
|
|
+% inputs, such as $filename or $sheetname for the filename or sheetname,
|
|
|
+% respectively) to the values to be assigned to sheet fields.
|
|
|
+% mapstruct.names contains the list of headers names, where the index of
|
|
|
+% each header corresponds to the field 'var[index]'. mapstruct.varX
|
|
|
+% contains the field 'value', as well as fields for each sheet
|
|
|
+% fieldname (e.g. sheet_category) that gets mappings from this
|
|
|
+% parameter source. the field 'value' can have three types of values:
|
|
|
+% - a cellstr of possible values in the input file. In this case,
|
|
|
+% cellstrs of the same length are given for the sheet fieldnames, which
|
|
|
+% provide the values to map too.
|
|
|
+% - the string 'echo'. In this case, the value in the input file is fed
|
|
|
+% to a function, the name of which is given in the sheet fieldname
|
|
|
+% fields. if the function is an empty string, then the value in the
|
|
|
+% input file is simply fed directly.
|
|
|
+% - the string 'split'. In this case, the value in the input file for
|
|
|
+% this column is a year, such that before this year the data is to have
|
|
|
+% one designation, and after and including this year, it is to have a
|
|
|
+% different designation. (this is used for the IMF WEO data). The
|
|
|
+% designations are provided in the sheet fieldname field.
|
|
|
+%
|
|
|
+%
|
|
|
+% GLOBALS:
|
|
|
+% CONSTANTS: A structure containing string and numeric constants, which are
|
|
|
+% used in the PRIMAP functions. These are configurations like
|
|
|
+% scaling factors, but also fieldnames for the database and
|
|
|
+% mapping vectors etc.
|
|
|
+%
|
|
|
+% NOTES:
|
|
|
+%
|
|
|
+% (c) Written by Kathleen Markmann and the PRIMAP - PIK team, June 2012.
|
|
|
+% This file is shared under a "Attribution-NonCommercial-ShareAlike 3.0"
|
|
|
+% licence, which means that you must give credit to the author, are not
|
|
|
+% allowed to use it for commercial purposes and you may share your
|
|
|
+% derivatives of this work only under a similar licence. Other than that,
|
|
|
+% you are free to copy, display, use, modify the code. The details of this
|
|
|
+% licence are given at: http://creativecommons.org/licenses/by-nc-sa/3.0/
|
|
|
+%
|
|
|
+% version: 150602 JG - based on fao_specifications
|
|
|
+% version: 201001 JG - adpated for FAO 2020A
|
|
|
+
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+
|
|
|
+global CONSTANTS
|
|
|
+if isempty(CONSTANTS)
|
|
|
+ error('Empty global variable! Please initialise with the drive_set_paths_and_globals... function!')
|
|
|
+end
|
|
|
+
|
|
|
+%please insert the download date?!
|
|
|
+date = 'Jan 2023'; % for FAO2019A
|
|
|
+%sourcename='FAO2018';
|
|
|
+
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%% sheet management %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+
|
|
|
+% INPUT NAMES OF EXCEL SHEETS TO READ IN. IF NOT SPECIFIED, ALL SHEETS ARE
|
|
|
+% READ IN
|
|
|
+%specifications.sheetsToRead = {...
|
|
|
+%};
|
|
|
+
|
|
|
+% INPUT NAMES OF EXCEL SHEETS TO NOT READ IN. IF SHEET IS ENCOUNTERED THAT
|
|
|
+% IS NOT LISTED IN THE SHEETSTOREAD OR SHEETSTOIGNORE, A WARNING IS GIVEN
|
|
|
+%specifications.sheetsToIgnore = {...
|
|
|
+%};
|
|
|
+
|
|
|
+% data in csv-format?
|
|
|
+specifications.isCSV = true;
|
|
|
+specifications.CSVdelimiter = ',';
|
|
|
+specifications.CSVQuotesToRemove = '';
|
|
|
+
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%% READING SHEETS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+% SPECIFY IF DATA IS EXTRA LONG AND NEEDS TO BE READ IN BLOCKS
|
|
|
+% IF BlockSize and dataBottomRightCorner IS NOT FIELD, DEFAULT IS TO READ IN ALL DATA AT ONCE
|
|
|
+specifications.blockSize = 10000;
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+% SPECIFY IF LABEL IS ONLY ONE COLUMN. DEFAULT IS FALSE. IF TRUE, THEN
|
|
|
+% COLUMN NAMES DO NOT NEED TO BE SPECIFIED. LABELS ASSUMED TO BE IN FIRST
|
|
|
+% COLUMN
|
|
|
+specifications.singleLabel = false;
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+% SPECIFY COLUMN INDEX WHERE ANNUAL DATA STARTS
|
|
|
+%%%% TEMP %%%%
|
|
|
+specifications.colStartOfYear = 9;
|
|
|
+%temporarily because index has been written in files by mistake
|
|
|
+%%%% TEMP %%%%
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+% SPECIFY ROW INDEX WHERE THE HEADER IS FOUND. IF NOT GIVEN, DEFAULT IS 1.
|
|
|
+% CAN BE MULTIPLE ROWS. IN THIS CASE, ALL ROWS LISTED ARE CONCATENATED WITH
|
|
|
+% NO SPACES BETWEEN EACH ROW.
|
|
|
+specifications.rowOfHeader = 1;
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+% SPECIFY ROW INDEX WHERE DATA STARTS. DEFAULT IS ROW AFTER HEADER
|
|
|
+specifications.rowOfData = 2;
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+% HEADER VALUE THAT INDICATES THE END OF DATA. DATA IS
|
|
|
+% ASSUMED TO END BEFORE THIS. IF NOT GIVEN, DEFAULT IS NaN
|
|
|
+%specifications.nonDataKeyword = '2014F';
|
|
|
+%each of these specification columns has to be defined in the following...
|
|
|
+%the way is the same for all of them: first you define the name for the
|
|
|
+%column than you define the mapping
|
|
|
+%always the bulk name and in the same order the according PRIMAPDB names
|
|
|
+
|
|
|
+
|
|
|
+%specifications.yearColIgnore = '\d*F';
|
|
|
+%specifications.yearColTransform = '\d*'; %this is used to match a string
|
|
|
+% which is then taken as the year
|
|
|
+
|
|
|
+% DEFINE KEYSTRUCT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+% FOR EVERY SHEET KEY THAT IS TO BE DEFINED FROM THE INPUT FILE, PROVIDE
|
|
|
+% THE SHEET KEY NAME AS A FIELD, AND THEN LIST THE COLUMN HEADERS (OR
|
|
|
+% $filename or $sheetname FOR THE FILENAME OR EXCEL SHEETNAME,
|
|
|
+% RESPECTIVELY) IN THE SUBFIELD colName. IF SINGLE COLUMN MODE IS DEFINED,
|
|
|
+% THEN USE $label.
|
|
|
+
|
|
|
+specifications.keystruct.(CONSTANTS.nameOfSheetEntity).colName = {'Element'};
|
|
|
+specifications.keystruct.(CONSTANTS.nameOfCountryVector).colName = {'Area Code'};
|
|
|
+specifications.keystruct.(CONSTANTS.nameOfSheetCategory).colName = {'Item'};
|
|
|
+specifications.keystruct.(CONSTANTS.nameOfSheetType).colName = {'Element'};
|
|
|
+specifications.keystruct.(CONSTANTS.nameOfSheetUnit).colName = {'Unit', 'Element', 'Variable'}; % {'Unit'};
|
|
|
+
|
|
|
+%% TODO
|
|
|
+% we need an new FAO specification because the new emission data does not really fit into the old categories
|
|
|
+% we now have the following
|
|
|
+% * Emissions on agricultural land
|
|
|
+% = Farm-gate emissions + Fires in humid tropical forests + Net Forest conversion + Fires in organic soils
|
|
|
+% * Farm-gate emissions (1)
|
|
|
+% = Enteric Fermentation (1A) + Manure Management (1B) + Rice Cultivation (1C) + Synthetic Fertilizers (1D)
|
|
|
+% + Manure applied to Soils (1E) + Manure left on Pasture (1F) + Crop Residues (1G) + Burning - Crop residues (1J)
|
|
|
+% + Drained organic soils (1H, CO2 and N2O) + On-farm energy use (1K)
|
|
|
+% * FORESTLAND = Forestland + Forest fires
|
|
|
+% * LAND USE CHANGE = Fires in humid tropical forests + Net Forest conversion + Fires in organic soils
|
|
|
+% (FORESTLAND and LAND USE CHANGE are not available in the csv files, but named on the
|
|
|
+% "FAOSTAT Domain Emissions Totals. Metadata" document)
|
|
|
+
|
|
|
+
|
|
|
+% IPCC type categories
|
|
|
+% AFOLU = IPCC Agriculture + LULUCF
|
|
|
+% IPCC Agriculture = Farm-gate emissions - On-farm energy use - Drained organic soils (CO2)
|
|
|
+% LULUCF = LAND USE CHANGE + FORESTLAND + Drained organic soils (CO2)
|
|
|
+% or LULUCF = Fires in humid tropical forests + Net Forest conversion + Fires in organic soils
|
|
|
+% + Forestland + Forest fires
|
|
|
+
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MAPPING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+
|
|
|
+% LISTS MAPPING BETWEEN VALUES IN THE INPUT FILE AND VALUES FOR THE
|
|
|
+% DATATABLES. THE COLUMN HEADERS (OR $filename or $sheetname FOR THE
|
|
|
+% FILENAME OR EXCEL SHEETNAME, RESPECTIVELY) ARE LISTED IN FIELD name.
|
|
|
+% STANDARD INPUT FOR var[i].value IS TO PROVIDE A CELLSTR OF ALL VALUES
|
|
|
+% FROM THE COLUMN LISTED IN name{i} THAT ARE TO BE ASSIGNED. VALUES TO BE
|
|
|
+% IGNORED CAN BE LISTED IN FIELD var[i].valuesToIgnore, TO REDUCE WARNING
|
|
|
+% MESSAGES. THE SHEET KEYS TO MAP TO ARE LISTED AS FIELDS UNDER var[i],
|
|
|
+% WITH THE VALUE IN THE STANDARD CASE BEING A CELLSTR WITH THE SAME LENGTH
|
|
|
+% AS THE FIELD value, THAT PROVIDES THE VALUES TO BE USED IN THE
|
|
|
+% DATATABLES.
|
|
|
+% ALTERNATE INPUTS FOR FIELD value ARE THE STRINGS 'echo' OR
|
|
|
+% 'split'. 'echo' PASSES THE INPUT VALUE TO THE FUNCTION LISTED UNDER THE
|
|
|
+% SHEET KEY FIELD, AND ASSIGNS THE OUTPUT TO THE SHEET KEY. 'split' ASSUMES
|
|
|
+% THAT THE INPUT VALUES IS A YEAR. THE DATA WILL BE SPLIT INTO TWO
|
|
|
+% DATATABLES AT THAT YEAR, WITH THAT YEAR BEING A PART OF THE SECOND
|
|
|
+% DATATABLE. THE FIRST TABLE WILL GET THE FIRST ELEMENT ASSIGNED TO SHEET
|
|
|
+% KEY FIELD, AND THE SECOND TABLE WILL GET THE SECOND ELEMENT.
|
|
|
+
|
|
|
+%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% entity, category and unit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+i = 1;
|
|
|
+specifications.mapstruct.name{i} = 'Element';
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).value = { ...
|
|
|
+ 'Emissions (CH4)', 'Emissions (N2O)', 'Emissions (CO2)', ...
|
|
|
+ 'Emissions (CO2eq) (AR5)', 'Direct emissions (N2O)', 'Indirect emissions (N2O)', ...
|
|
|
+ 'Emissions (CO2eq) from F-gases (AR5)',
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).(CONSTANTS.nameOfSheetEntity) = { ...
|
|
|
+ 'CH4', 'N2O', 'CO2', ...
|
|
|
+ 'KYOTOGHGAR5', 'N2O', 'N2O', ...
|
|
|
+ 'FGASESAR5', ...
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).(CONSTANTS.nameOfSheetUnit) = { ...
|
|
|
+ '', '', '', ...
|
|
|
+ 'CO2eq', '', '', ...
|
|
|
+ 'CO2eq', ...
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).(CONSTANTS.nameOfSheetType) = { ...
|
|
|
+ 'NET', 'NET', 'NET', ...
|
|
|
+ 'NET', 'DIR', 'IND', ...
|
|
|
+ 'NET', ...
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).valueToIgnore = { ...
|
|
|
+ 'Emissions (CO2eq) from N2O (AR5)', ...
|
|
|
+ 'Emissions (CO2eq) from CH4 (AR5)', ...
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% region %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+i = 2;
|
|
|
+specifications.mapstruct.name{i} = 'Area Code';
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).value = { ...
|
|
|
+ '1', '2', '3', '4', '5', ...
|
|
|
+ '6', '7', '8', '9', '10', ...
|
|
|
+ '11', '12', '13', '14', '15', ...
|
|
|
+ '16', '17', '18', '19', '20', ...
|
|
|
+ '21', '22', '23', '24', '25', ... % 5
|
|
|
+ '26', '27', '28', '29', '30', ...
|
|
|
+ '31', '32', '33', '35', '36', ...
|
|
|
+ '37', '38', '39', '40', '41', ...
|
|
|
+ '42', '43', '44', '45', '46', ...
|
|
|
+ '47', '48', '49', '50', '51', ... % 10
|
|
|
+ '52', '53', '54', '55', '56', ...
|
|
|
+ '57', '58', '59', '60', '61', ...
|
|
|
+ '62', '63', '64', '65', '66', ...
|
|
|
+ '67', '68', '69', '70', '71', ...
|
|
|
+ '72', '73', '74', '75', '77', ... % 15
|
|
|
+ '78', '79', '80', '81', '82', ...
|
|
|
+ '83', '84', '85', '86', '87', ...
|
|
|
+ '88', '89', '90', '91', '92', ...
|
|
|
+ '93', '94', '95', '96', '97', ...
|
|
|
+ '98', '99', '100', '101', '102', ... % 20
|
|
|
+ '103', '104', '105', '106', '107', ...
|
|
|
+ '108', '109', '110', '111', '112', ...
|
|
|
+ '113', '114', '115', '116', '117', ...
|
|
|
+ '118', '119', '120', '121', '122', ...
|
|
|
+ '123', '124', '125', '126', '127', ... % 25
|
|
|
+ '128', '129', '130', '131', '132', ...
|
|
|
+ '133', '134', '135', '136', '137', ...
|
|
|
+ '138', '139', '140', '141', '142', ...
|
|
|
+ '143', '144', '145', '146', '147', ...
|
|
|
+ '148', '149', '150', '151', '153', ... %30
|
|
|
+ '154', '155', '156', '157', '158', ...
|
|
|
+ '159', '160', '161', '162', '163', ...
|
|
|
+ '164', '165', '166', '167', '168', ...
|
|
|
+ '169', '170', '171', '172', '173', ...
|
|
|
+ '174', '175', '176', '177', '178', ... %35
|
|
|
+ '179', '180', '181', '182', '183', ...
|
|
|
+ '184', '185', '186', '187', '188', ...
|
|
|
+ '189', '190', '191', '192', '193', ...
|
|
|
+ '194', '195', '196', '197', '198', ...
|
|
|
+ '199', '200', '201', '202', '203', ... % 40
|
|
|
+ '205', '206', '207', '208', '209', ...
|
|
|
+ '210', '211', '212', '213', '214', ...
|
|
|
+ '215', '216', '217', '218', '219', ...
|
|
|
+ '220', '221', '222', '223', '224', ...
|
|
|
+ '225', '226', '227', '228', '229', ... % 45
|
|
|
+ '230', '231', '232', '233', '234', ...
|
|
|
+ '235', '236', '237', '238', '239', ...
|
|
|
+ '240', '242', '243', '244', '248', ...
|
|
|
+ '249', '250', '251', '255', '256', ...
|
|
|
+ '258', '259', '260', '264', '270', ... % 50
|
|
|
+ '271', '272', '273', '274', '275', ...
|
|
|
+ '276', '277', '278', '279', '280', ...
|
|
|
+ '281', '282', '283', '284', '299', ...
|
|
|
+
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).(CONSTANTS.nameOfCountryVector) = { ...
|
|
|
+ 'ARM', 'AFG', 'ALB', 'DZA', 'ASM', ...
|
|
|
+ 'AND', 'AGO', 'ATG', 'ARG', 'AUS', ...
|
|
|
+ 'AUT', 'BHS', 'BHR', 'BRB', 'BELLUX', ...
|
|
|
+ 'BGD', 'BMU', 'BTN', 'BOL', 'BWA', ...
|
|
|
+ 'BRA', 'ABW', 'BLZ', 'IOT', 'SLB', ... % 5
|
|
|
+ 'BRN', 'BGR', 'MMR', 'BDI', 'ATA', ...
|
|
|
+ 'BVT', 'CMR', 'CAN', 'CPV', 'CYM', ...
|
|
|
+ 'CAF', 'LKA', 'TCD', 'CHL', 'CHN', ...
|
|
|
+ 'CXR', 'CCK', 'COL', 'COM', 'COG', ...
|
|
|
+ 'COK', 'CRI', 'CUB', 'CYP', 'CZESVK', ... % 10
|
|
|
+ 'AZE', 'BEN', 'DNK', 'DMA', 'DOM', ...
|
|
|
+ 'BLR', 'ECU', 'EGY', 'SLV', 'GNQ', ...
|
|
|
+ 'ETHERI', 'EST', 'FRO', 'FLK', 'FJI', ...
|
|
|
+ 'FIN', 'FRA', 'GUF', 'PYF', 'ATF', ...
|
|
|
+ 'DJI', 'GEO', 'GAB', 'GMB', 'F77', ... % 15
|
|
|
+ 'F78', 'DEU', 'BIH', 'GHA', 'GIB', ... %F77,78 is GDR and BRD but no data in FAOSTAT
|
|
|
+ 'KIR', 'GRC', 'GRL', 'GRD', 'GLP', ...
|
|
|
+ 'GUM', 'GTM', 'GIN', 'GUY', 'HMD', ...
|
|
|
+ 'HTI', 'VAT', 'HND', 'HKG', 'HUN', ...
|
|
|
+ 'HRV', 'ISL', 'IND', 'IDN', 'IRN', ... % 20
|
|
|
+ 'IRQ', 'IRL', 'ISR', 'ITA', 'CIV', ...
|
|
|
+ 'KAZ', 'JAM', 'JPN', 'JTN', 'JOR', ... % not sure what JTN is
|
|
|
+ 'KGZ', 'KEN', 'KHM', 'PRK', 'KOR', ...
|
|
|
+ 'KWT', 'LVA', 'LAO', 'LBN', 'LSO', ...
|
|
|
+ 'LBR', 'LBY', 'LIE', 'LTU', 'MHL', ... % 25
|
|
|
+ 'MAC', 'MDG', 'MWI', 'MYS', 'MDV', ...
|
|
|
+ 'MLI', 'MLT', 'MTQ', 'MRT', 'MUS', ...
|
|
|
+ 'MEX', 'MID', 'MCO', 'MNG', 'MSR', ... % MID unknown
|
|
|
+ 'MAR', 'MOZ', 'FSM', 'MDA', 'NAM', ...
|
|
|
+ 'NRU', 'NPL', 'NLD', 'ANT', 'NCL', ... % 30
|
|
|
+ 'MKD', 'VUT', 'NZL', 'NIC', 'NER', ...
|
|
|
+ 'NGA', 'NIU', 'NFK', 'NOR', 'MNP', ...
|
|
|
+ 'TTPI', 'PAK', 'PAN', 'CZE', 'PNG', ...
|
|
|
+ 'PRY', 'PER', 'PHL', 'PCN', 'POL', ...
|
|
|
+ 'PRT', 'GNB', 'TLS', 'PRI', 'ERI', ... % 35
|
|
|
+ 'QAT', 'PLW', 'ZWE', 'REU', 'ROU', ...
|
|
|
+ 'RWA', 'RUS', 'SRBMNE', 'SHN', 'KNA', ...
|
|
|
+ 'LCA', 'SPM', 'VCT', 'SMR', 'STP', ...
|
|
|
+ 'SAU', 'SEN', 'SYC', 'SLE', 'SVN', ...
|
|
|
+ 'SVK', 'SGP', 'SOM', 'ZAF', 'ESP', ... % 40
|
|
|
+ 'ESH', 'SDNSSD', 'SUR', 'TJK', 'SWZ', ...
|
|
|
+ 'SWE', 'CHE', 'SYR', 'TKM', 'TWN', ...
|
|
|
+ 'TZA', 'THA', 'TGO', 'TKL', 'TON', ...
|
|
|
+ 'TTO', 'OMN', 'TUN', 'TUR', 'TCA', ...
|
|
|
+ 'ARE', 'UGA', 'TUV', 'FSU', 'GBR', ... % 45
|
|
|
+ 'UKR', 'USA', 'UMI', 'BFA', 'URY', ...
|
|
|
+ 'UZB', 'VEN', 'VNM', 'ETH', 'VGB', ...
|
|
|
+ 'VIR', 'WAK', 'WLF', 'WSM', 'YUG', ... % WAK unknown
|
|
|
+ 'YEM', 'COD', 'ZMB', 'BEL', 'LUX', ...
|
|
|
+ 'AIA', 'CHI', 'SJM', 'IMN', 'MYT', ... % 50
|
|
|
+ 'SGS', 'SRB', 'MNE', 'GGY', 'UVK', ... % UVK unknown
|
|
|
+ 'SDN', 'SSD', 'BES', 'CUW', 'SXM', ...
|
|
|
+ 'MAF', 'BLM', 'JEY', 'ALA', 'PSE', ...
|
|
|
+
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).valueToIgnore = { ...
|
|
|
+ '5000', '5100', '5101', '5102', '5103', ...
|
|
|
+ '5104', '5105', '5200', '5203', '5204', ...
|
|
|
+ '5206', '5207', '5300', '5301', '5302', ...
|
|
|
+ '5303', '5304', '5305', '5400', '5401', ...
|
|
|
+ '5402', '5403', '5404', '5500', '5501', ...
|
|
|
+ '5502', '5503', '5504', '5707', '5801', ...
|
|
|
+ '5802', '5803', '5815', '5817', '5848', ...
|
|
|
+ '5849', '5873', 'F246', 'F247', 'F609', 'F614', ...
|
|
|
+ 'F616', 'F617', 'F618', 'F619', 'F620', ...
|
|
|
+ 'F621', 'F622', '351', ... %351 is China but we have it split up here
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+i = 3;
|
|
|
+specifications.mapstruct.name{i} = 'Item';
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).value = { ...
|
|
|
+ 'LULUCF', 'IPCC Agriculture', ...
|
|
|
+ 'Enteric Fermentation', 'Manure Management', 'Synthetic Fertilizers', ...
|
|
|
+ 'Manure applied to Soils', 'Manure left on Pasture', 'Crop Residues', ...
|
|
|
+ 'Burning - Crop residues', 'Net Forest conversion', 'Forestland', ...
|
|
|
+ 'Savanna fires', 'AFOLU', ...
|
|
|
+ 'Rice Cultivation', 'Agricultural Soils', ...
|
|
|
+ 'All sectors with LULUCF', 'All sectors without LULUCF', 'Energy', ...
|
|
|
+ 'IPPU', 'Other', 'Waste', ...
|
|
|
+ 'Drained organic soils', 'Drained organic soils (N2O)', 'Drained organic soils (CO2)', ...
|
|
|
+ %'Forest fires', ... %5
|
|
|
+ %'Fires in organic soils', 'On-farm energy use', 'Emissions on agricultural land', ...
|
|
|
+ %'Farm-gate emissions', 'Fires in humid tropical forests',
|
|
|
+ %'Agri-food systems',
|
|
|
+ %'Farm gate', 'Fertilizers Manufacturing',
|
|
|
+ %'Food Household Consumption', 'Food Packaging',
|
|
|
+ %'Food Processing', 'Food Retail',
|
|
|
+ %'Food Transport', 'Food systems waste disposal',
|
|
|
+ % 'Land Use change', 'On-farm electricity use',
|
|
|
+ % 'Pre- and post- production',
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).(CONSTANTS.nameOfSheetCategory) = { ...
|
|
|
+ 'IPCMLULUCF', 'IPCMAG', ...
|
|
|
+ 'IPC3A1', 'IPC3A2', 'IPC3C4A', ...
|
|
|
+ 'IPC3C4B', 'IPC3C4C', 'IPC3C4D', ...
|
|
|
+ 'IPC3C1B', 'IPCMNFC', 'IPC3B1', ...
|
|
|
+ 'IPC3C1C', 'IPC3', ...
|
|
|
+ 'IPC3C7', 'IPCM3C45AG', ...
|
|
|
+ 'IPC0', 'IPCM0EL', 'IPC1', ...
|
|
|
+ 'IPC2', 'IPC5', 'IPC4', ...
|
|
|
+ 'IPCM3C45DOS', 'IPCM3C45DOSN2O', 'IPCM3C45DOSCO2', ...
|
|
|
+ %'MFF', ... %5
|
|
|
+ %'2D3', '1K', 'MAL', ...
|
|
|
+ %'MFG', '2D1',
|
|
|
+ %'1H', 'M1HAG', 'M1HLU', ...
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).valueToIgnore = { ...
|
|
|
+ 'Forest fires', ... %5
|
|
|
+ 'Fires in organic soils', 'On-farm energy use', 'Emissions on agricultural land', ...
|
|
|
+ 'Farm-gate emissions', 'Fires in humid tropical forests', ...
|
|
|
+ 'Agri-food systems', 'Farm gate', 'Fertilizers Manufacturing', ...
|
|
|
+ 'Food Household Consumption', 'Food Packaging', ...
|
|
|
+ 'Food Processing', 'Food Retail', ...
|
|
|
+ 'Food Transport', 'Food systems waste disposal', ...
|
|
|
+ 'Land Use change', 'On-farm electricity use', ...
|
|
|
+ 'Pre- and post- production', ...
|
|
|
+ 'Agrifood Systems Waste Disposal', 'Agrifood systems', ... % below new in 2024A
|
|
|
+ 'Pesticides Manufacturing', 'Pre- and Post- Production', ...
|
|
|
+ 'Emissions from crops', 'Emissions from livestock', ... don't fit IPCC categories
|
|
|
+ };
|
|
|
+
|
|
|
+% general caveats in mapping: does not distinguish between direct and
|
|
|
+% indirect. All mapped to direct IPCC cats (3.C.4)
|
|
|
+% it's unclear where drained organic soils should be mapped to. It's
|
|
|
+% included in Agricultural soils and thus implicitly mapped to M.3.C.45AG
|
|
|
+
|
|
|
+% TODO make new FAO terminology
|
|
|
+% FAO sector hierarchy (total domain)
|
|
|
+% IPCC Agriculture (CH4, N2O) X
|
|
|
+% * Enteric fermentation (CH4 only) X
|
|
|
+% * Manure Management X
|
|
|
+% * Burning - crop residues X
|
|
|
+% * Savanna fires X
|
|
|
+% * Rice cultivation (CH4 only) X
|
|
|
+% * Agricultural soils (N2O only) X
|
|
|
+% * Synthetic Fertilizers X
|
|
|
+% * Manure applied to soils X
|
|
|
+% * Manure left on Pasture X
|
|
|
+% * Crop Residues X
|
|
|
+% * Drained organic soils (N2O)
|
|
|
+
|
|
|
+% not in IPCC Agriculture hierarchy
|
|
|
+% Drained organic soils (CO2)
|
|
|
+% Net Forest conversion
|
|
|
+% Fires in humid tropical forests
|
|
|
+% Fires in organic soils
|
|
|
+% Forest fires
|
|
|
+% Forestland
|
|
|
+% On-farm energy use
|
|
|
+
|
|
|
+
|
|
|
+% agg
|
|
|
+% Agricultural Soils
|
|
|
+% IPCC Agriculture
|
|
|
+% LULUCF
|
|
|
+% AFOLU
|
|
|
+% Emissions on agricultural land
|
|
|
+% Farm-gate emissions
|
|
|
+% Land Use change
|
|
|
+
|
|
|
+
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+i = 4;
|
|
|
+specifications.mapstruct.name{i} = 'Unit';
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).value = { ...
|
|
|
+ 'Gigagrams', 'gigagrams', 'tonnes', 'Kg', 'Head', ...
|
|
|
+ 'kilotonnes', 'kt', ...
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).(CONSTANTS.nameOfSheetUnit) = { ...
|
|
|
+ 'Gg', 'Gg', 't', 'Kg', 'Heads', ...
|
|
|
+ 'kt', 'kt', ...
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).valueToIgnore = { ...
|
|
|
+ 'g N20/kg dry matter', 'g CH4/kg dry matter', 'Ha', ...
|
|
|
+ 'Kg of nutrients', 'kg N2O-N/kg N', 'million kWh', ...
|
|
|
+ 'Terajoule', 'Kg/TJ', 'Kg CH4/head', ...
|
|
|
+ 'kg N2O-N/kg N', ...
|
|
|
+ };
|
|
|
+
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+i = 5;
|
|
|
+specifications.mapstruct.name{i} = 'Variable';
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).value = { ...
|
|
|
+ 'Value', ...
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).(CONSTANTS.nameOfSheetUnit) = { ...
|
|
|
+ '', ...
|
|
|
+ };
|
|
|
+specifications.mapstruct.(['var' num2str(i)]).valueToIgnore = { ...
|
|
|
+ 'Flag', 'Note', 'FAO Source', 'Source Code', ...
|
|
|
+ 'Domain', 'Flag Description', 'Domain Code', ...
|
|
|
+ 'Source', 'Area Code (M49)', ...
|
|
|
+ };
|
|
|
+
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%% default table %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
+%since we want to build up datatables we need a default table which gets
|
|
|
+%parametrised according to the row which we are parsing
|
|
|
+
|
|
|
+%specify default datatable (all necessary fields...)
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetCode) = '';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetCategory) = '';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetCategoryName) = '';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetEntity) = '';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetType) = '';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetClass) = 'TOTAL';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetDescr) = '';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetNote) = 'Read in by JG';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetSource) = sourcename;
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetFirstdatarow) = 0;
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetUnit) = '';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetScenario) = 'HISTORY';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetDatatype) = 'CountryYearMatrix';
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfCountryVector) = {};
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfDataField) = [];
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfYearVector) = [];
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetSubsource) = {};
|
|
|
+specifications.patternTable.(CONSTANTS.nameOfSheetTablekind) = CONSTANTS.defaultForSheetTablekind;
|
|
|
+
|
|
|
+end %function bp_specifications
|