Skip to content

Commit

Permalink
Merge pull request #53 from wri/develop
Browse files Browse the repository at this point in the history
Model v1.3.2 Update
  • Loading branch information
melrose-wri authored Apr 16, 2024
2 parents eb9a055 + 21ddcf9 commit 18ac969
Show file tree
Hide file tree
Showing 10 changed files with 598 additions and 302 deletions.
79 changes: 43 additions & 36 deletions constants_and_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
######## ########

# Model version
version = '1.3.1'
version = '1.3.2'
version_filename = version.replace('.', '_')


Expand Down Expand Up @@ -44,7 +44,7 @@
### Constants

# Number of years of tree cover loss. If input loss raster is changed, this must be changed, too.
loss_years = 22
loss_years = 23

# Number of years in tree cover gain. If input cover gain raster is changed, this must be changed, too.
gain_years = 20
Expand Down Expand Up @@ -153,7 +153,7 @@
### Model extent
######
pattern_model_extent = 'model_extent'
model_extent_dir = os.path.join(s3_base_dir, 'model_extent/standard/20231114/')
model_extent_dir = os.path.join(s3_base_dir, 'model_extent/standard/20240308/')

######
### Biomass tiles
Expand Down Expand Up @@ -205,9 +205,9 @@
gain_spreadsheet = 'gain_rate_continent_ecozone_age_20230821.xlsx'
gain_spreadsheet_dir = os.path.join(s3_base_dir, 'removal_rate_tables/')

# Annual Hansen loss tiles (2001-2022)
pattern_loss = 'GFW2022'
loss_dir = 's3://gfw2-data/forest_change/hansen_2022/'
# Annual Hansen loss tiles (2001-2023)
pattern_loss = 'GFW2023'
loss_dir = 's3://gfw2-data/forest_change/hansen_2023/'

# Hansen removals tiles based on canopy height (2000-2020)
# From https://www.frontiersin.org/articles/10.3389/frsen.2022.856903/full
Expand Down Expand Up @@ -333,13 +333,13 @@

# Drivers of tree cover loss
drivers_raw_dir = os.path.join(s3_base_dir, 'other_emissions_inputs/tree_cover_loss_drivers/raw/')
pattern_drivers_raw = 'TCL_DD_2022_20230407_wgs84_setnodata.tif'
pattern_drivers_raw = 'Goode_FinalClassification_2023_wgs84_v20240402.tif'
pattern_drivers = 'tree_cover_loss_driver_processed'
drivers_processed_dir = os.path.join(s3_base_dir, 'other_emissions_inputs/tree_cover_loss_drivers/processed/drivers_2022/20230407/')
drivers_processed_dir = os.path.join(s3_base_dir, 'other_emissions_inputs/tree_cover_loss_drivers/processed/drivers_2023/20240402/')

# Tree cover loss from fires
TCLF_raw_dir = 's3://gfw-data-lake/umd_tree_cover_loss_from_fires/v20230315/raw/'
TCLF_processed_dir = os.path.join(s3_base_dir, 'other_emissions_inputs/tree_cover_loss_fires/20230315/processed/')
TCLF_raw_dir = 's3://gfw2-data/forest_change/hansen_2023_fire/'
TCLF_processed_dir = os.path.join(s3_base_dir, 'other_emissions_inputs/tree_cover_loss_fires/20240304/processed/')
pattern_TCLF_processed = 'tree_cover_loss_fire_processed'


Expand Down Expand Up @@ -402,7 +402,8 @@

# Age categories over entire model extent, as a precursor to assigning IPCC default removal rates
pattern_age_cat_IPCC = 'forest_age_category_IPCC__1_young_2_mid_3_old'
age_cat_IPCC_dir = os.path.join(s3_base_dir, 'forest_age_category_IPCC/standard/20231114/')
age_cat_IPCC_dir = os.path.join(s3_base_dir, 'forest_age_category_IPCC/standard/20240308/')



### US-specific removal precursors
Expand Down Expand Up @@ -464,31 +465,34 @@

# Annual aboveground biomass removals rate using IPCC default removal rates
pattern_annual_gain_AGB_IPCC_defaults = 'annual_removal_factor_AGB_Mg_ha_IPCC_defaults_all_ages'
annual_gain_AGB_IPCC_defaults_dir = os.path.join(s3_base_dir, 'annual_removal_factor_AGB_IPCC_defaults_all_ages/standard/20231114/')
annual_gain_AGB_IPCC_defaults_dir = os.path.join(s3_base_dir, 'annual_removal_factor_AGB_IPCC_defaults_all_ages/standard/20240308/')

# Annual aboveground biomass removals rate using IPCC default removal rates
pattern_annual_gain_BGB_IPCC_defaults = 'annual_removal_factor_BGB_Mg_ha_IPCC_defaults_all_ages'
annual_gain_BGB_IPCC_defaults_dir = os.path.join(s3_base_dir, 'annual_removal_factor_BGB_IPCC_defaults_all_ages/standard/20231114/')
annual_gain_BGB_IPCC_defaults_dir = os.path.join(s3_base_dir, 'annual_removal_factor_BGB_IPCC_defaults_all_ages/standard/20240308/')


### Annual composite removal factor

# Annual aboveground removals rate for all forest types
pattern_annual_gain_AGC_all_types = 'annual_removal_factor_AGC_Mg_ha_all_forest_types'
annual_gain_AGC_all_types_dir = os.path.join(s3_base_dir, 'annual_removal_factor_AGC_all_forest_types/standard/20231114/')
annual_gain_AGC_all_types_dir = os.path.join(s3_base_dir, 'annual_removal_factor_AGC_all_forest_types/standard/20240308/')

# Annual belowground removals rate for all forest types
pattern_annual_gain_BGC_all_types = 'annual_removal_factor_BGC_Mg_ha_all_forest_types'
annual_gain_BGC_all_types_dir = os.path.join(s3_base_dir, 'annual_removal_factor_BGC_all_forest_types/standard/20231114/')
annual_gain_BGC_all_types_dir = os.path.join(s3_base_dir, 'annual_removal_factor_BGC_all_forest_types/standard/20240308/')

# Annual aboveground+belowground removals rate for all forest types
pattern_annual_gain_AGC_BGC_all_types = 'annual_removal_factor_AGC_BGC_Mg_ha_all_forest_types'
annual_gain_AGC_BGC_all_types_dir = os.path.join(s3_base_dir, 'annual_removal_factor_AGC_BGC_all_forest_types/standard/20231114/')
annual_gain_AGC_BGC_all_types_dir = os.path.join(s3_base_dir, 'annual_removal_factor_AGC_BGC_all_forest_types/standard/20240308/')


### Removal forest types (sources)

# Forest type used in removals model
pattern_removal_forest_type = 'removal_forest_type'
removal_forest_type_dir = os.path.join(s3_base_dir, 'removal_forest_type/standard/20231114/')
removal_forest_type_dir = os.path.join(s3_base_dir, 'removal_forest_type/standard/20240308/')


# Removal model forest type codes
mangrove_rank = 6
Expand All @@ -503,26 +507,27 @@

# Number of removals years for all forest types
pattern_gain_year_count = 'gain_year_count_all_forest_types'
gain_year_count_dir = os.path.join(s3_base_dir, 'gain_year_count_all_forest_types/standard/20231114/')
gain_year_count_dir = os.path.join(s3_base_dir, 'gain_year_count_all_forest_types/standard/20240308/')



### Cumulative gross carbon dioxide removals

# Gross aboveground removals for all forest types
pattern_cumul_gain_AGCO2_all_types = f'gross_removals_AGCO2_Mg_ha_all_forest_types_2001_{loss_years}'
cumul_gain_AGCO2_all_types_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_all_forest_types/standard/per_hectare/20231114/')
cumul_gain_AGCO2_all_types_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_all_forest_types/standard/per_hectare/20240308/')

# Gross belowground removals for all forest types
pattern_cumul_gain_BGCO2_all_types = f'gross_removals_BGCO2_Mg_ha_all_forest_types_2001_{loss_years}'
cumul_gain_BGCO2_all_types_dir = os.path.join(s3_base_dir, 'gross_removals_BGCO2_all_forest_types/standard/per_hectare/20231114/')
cumul_gain_BGCO2_all_types_dir = os.path.join(s3_base_dir, 'gross_removals_BGCO2_all_forest_types/standard/per_hectare/20240308/')

# Gross aboveground and belowground removals for all forest types in all pixels
pattern_cumul_gain_AGCO2_BGCO2_all_types = f'gross_removals_AGCO2_BGCO2_Mg_ha_all_forest_types_2001_{loss_years}'
cumul_gain_AGCO2_BGCO2_all_types_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_BGCO2_all_forest_types/standard/full_extent/per_hectare/20231114/')
cumul_gain_AGCO2_BGCO2_all_types_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_BGCO2_all_forest_types/standard/full_extent/per_hectare/20240308/')

# Gross aboveground and belowground removals for all forest types in pixels within forest extent
pattern_cumul_gain_AGCO2_BGCO2_all_types_forest_extent = f'gross_removals_AGCO2_BGCO2_Mg_ha_all_forest_types_forest_extent_2001_{loss_years}'
cumul_gain_AGCO2_BGCO2_all_types_forest_extent_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_BGCO2_all_forest_types/standard/forest_extent/per_hectare/20231114/')
cumul_gain_AGCO2_BGCO2_all_types_forest_extent_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_BGCO2_all_forest_types/standard/forest_extent/per_hectare/20240308/')


######
Expand Down Expand Up @@ -558,7 +563,8 @@
## Carbon emitted_pools in loss year

# Date to include in the output directory for all emissions year carbon emitted_pools
emis_pool_run_date = '20231114'
emis_pool_run_date = '20240308'


# Aboveground carbon in the year of emission for all forest types in loss pixels
pattern_AGC_emis_year = "Mg_AGC_ha_emis_year"
Expand Down Expand Up @@ -640,7 +646,7 @@
### Emissions from biomass and soil (all carbon emitted_pools)

# Date to include in the output directory
emis_run_date_biomass_soil = '20231114'
emis_run_date_biomass_soil = '20240402'

# pattern_gross_emis_commod_biomass_soil = f'gross_emis_commodity_Mg_CO2e_ha_biomass_soil_2001_{loss_years}'
pattern_gross_emis_commod_biomass_soil = f'gross_emis_commodity_Mg_CO2e_ha_biomass_soil_2001_{loss_years}'
Expand Down Expand Up @@ -679,7 +685,8 @@
### Emissions from soil only

# Date to include in the output directory
emis_run_date_soil_only = '20231114'
emis_run_date_soil_only = '20240402'


pattern_gross_emis_commod_soil_only = f'gross_emis_commodity_Mg_CO2e_ha_soil_only_2001_{loss_years}'
gross_emis_commod_soil_only_dir = f'{s3_base_dir}gross_emissions/commodities/soil_only/standard/{emis_run_date_soil_only}/'
Expand Down Expand Up @@ -717,39 +724,39 @@

# Net emissions for all forest types and all carbon emitted_pools in all pixels
pattern_net_flux = f'net_flux_Mg_CO2e_ha_biomass_soil_2001_{loss_years}'
net_flux_dir = os.path.join(s3_base_dir, 'net_flux_all_forest_types_all_drivers/biomass_soil/standard/full_extent/per_hectare/20231114/')
net_flux_dir = os.path.join(s3_base_dir, 'net_flux_all_forest_types_all_drivers/biomass_soil/standard/full_extent/per_hectare/20240402/')

# Net emissions for all forest types and all carbon emitted_pools in forest extent
pattern_net_flux_forest_extent = f'net_flux_Mg_CO2e_ha_biomass_soil_forest_extent_2001_{loss_years}'
net_flux_forest_extent_dir = os.path.join(s3_base_dir, 'net_flux_all_forest_types_all_drivers/biomass_soil/standard/forest_extent/per_hectare/20231114/')
net_flux_forest_extent_dir = os.path.join(s3_base_dir, 'net_flux_all_forest_types_all_drivers/biomass_soil/standard/forest_extent/per_hectare/20240402/')


### Per pixel model outputs
######

# Gross removals per pixel in all pixels
pattern_cumul_gain_AGCO2_BGCO2_all_types_per_pixel_full_extent = f'gross_removals_AGCO2_BGCO2_Mg_pixel_all_forest_types_full_extent_2001_{loss_years}'
cumul_gain_AGCO2_BGCO2_all_types_per_pixel_full_extent_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_BGCO2_all_forest_types/standard/full_extent/per_pixel/20231114/')
cumul_gain_AGCO2_BGCO2_all_types_per_pixel_full_extent_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_BGCO2_all_forest_types/standard/full_extent/per_pixel/20240308/')

# Gross removals per pixel in forest extent
pattern_cumul_gain_AGCO2_BGCO2_all_types_per_pixel_forest_extent = f'gross_removals_AGCO2_BGCO2_Mg_pixel_all_forest_types_forest_extent_2001_{loss_years}'
cumul_gain_AGCO2_BGCO2_all_types_per_pixel_forest_extent_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_BGCO2_all_forest_types/standard/forest_extent/per_pixel/20231114/')
cumul_gain_AGCO2_BGCO2_all_types_per_pixel_forest_extent_dir = os.path.join(s3_base_dir, 'gross_removals_AGCO2_BGCO2_all_forest_types/standard/forest_extent/per_pixel/20240308/')

# Gross emissions per pixel in all pixels
pattern_gross_emis_all_gases_all_drivers_biomass_soil_per_pixel_full_extent = f'gross_emis_all_gases_all_drivers_Mg_CO2e_pixel_biomass_soil_full_extent_2001_{loss_years}'
gross_emis_all_gases_all_drivers_biomass_soil_per_pixel_full_extent_dir = os.path.join(s3_base_dir, 'gross_emissions/all_drivers/all_gases/biomass_soil/standard/full_extent/per_pixel/20231114/')
gross_emis_all_gases_all_drivers_biomass_soil_per_pixel_full_extent_dir = os.path.join(s3_base_dir, 'gross_emissions/all_drivers/all_gases/biomass_soil/standard/full_extent/per_pixel/20240402/')

# Gross emissions per pixel in forest extent
pattern_gross_emis_all_gases_all_drivers_biomass_soil_per_pixel_forest_extent = f'gross_emis_all_gases_all_drivers_Mg_CO2e_pixel_biomass_soil_forest_extent_2001_{loss_years}'
gross_emis_all_gases_all_drivers_biomass_soil_per_pixel_forest_extent_dir = os.path.join(s3_base_dir, 'gross_emissions/all_drivers/all_gases/biomass_soil/standard/forest_extent/per_pixel/20231114/')
gross_emis_all_gases_all_drivers_biomass_soil_per_pixel_forest_extent_dir = os.path.join(s3_base_dir, 'gross_emissions/all_drivers/all_gases/biomass_soil/standard/forest_extent/per_pixel/20240402/')

# Net flux per pixel in all pixels
pattern_net_flux_per_pixel_full_extent = f'net_flux_Mg_CO2e_pixel_biomass_soil_full_extent_2001_{loss_years}'
net_flux_per_pixel_full_extent_dir = os.path.join(s3_base_dir, 'net_flux_all_forest_types_all_drivers/biomass_soil/standard/full_extent/per_pixel/20231114/')
net_flux_per_pixel_full_extent_dir = os.path.join(s3_base_dir, 'net_flux_all_forest_types_all_drivers/biomass_soil/standard/full_extent/per_pixel/20240402/')

# Net flux per pixel in forest extent
pattern_net_flux_per_pixel_forest_extent = f'net_flux_Mg_CO2e_pixel_biomass_soil_forest_extent_2001_{loss_years}'
net_flux_per_pixel_forest_extent_dir = os.path.join(s3_base_dir, 'net_flux_all_forest_types_all_drivers/biomass_soil/standard/forest_extent/per_pixel/20231114/')
net_flux_per_pixel_forest_extent_dir = os.path.join(s3_base_dir, 'net_flux_all_forest_types_all_drivers/biomass_soil/standard/forest_extent/per_pixel/20240402/')


### 4x4 km aggregation tiles for mapping
Expand All @@ -759,7 +766,7 @@
pattern_aggreg_sensit_perc_diff = f'net_flux_0_04deg_modelv{version_filename}_perc_diff_std'
pattern_aggreg_sensit_sign_change = f'net_flux_0_04deg_modelv{version_filename}_sign_change_std'

output_aggreg_dir = os.path.join(s3_base_dir, '0_04deg_output_aggregation/biomass_soil/standard/20231114/')
output_aggreg_dir = os.path.join(s3_base_dir, '0_04deg_output_aggregation/biomass_soil/standard/20240402/')



Expand Down Expand Up @@ -800,11 +807,11 @@

# Standard deviation for annual aboveground biomass removal factors using IPCC default removal rates
pattern_stdev_annual_gain_AGB_IPCC_defaults = 'annual_removal_factor_stdev_AGB_Mg_ha_IPCC_defaults_all_ages'
stdev_annual_gain_AGB_IPCC_defaults_dir = os.path.join(s3_base_dir, 'stdev_annual_removal_factor_AGB_IPCC_defaults_all_ages/standard/20231114/')
stdev_annual_gain_AGB_IPCC_defaults_dir = os.path.join(s3_base_dir, 'stdev_annual_removal_factor_AGB_IPCC_defaults_all_ages/standard/20240308/')

# Standard deviation for aboveground and belowground removal factors for all forest types
pattern_stdev_annual_gain_AGC_all_types = 'annual_removal_factor_stdev_AGC_Mg_ha_all_forest_types'
stdev_annual_gain_AGC_all_types_dir = os.path.join(s3_base_dir, 'stdev_annual_removal_factor_AGC_all_forest_types/standard/20231114/')
stdev_annual_gain_AGC_all_types_dir = os.path.join(s3_base_dir, 'stdev_annual_removal_factor_AGC_all_forest_types/standard/20240308/')


# Raw mineral soil C file site
Expand Down
Loading

0 comments on commit 18ac969

Please sign in to comment.