Skip to content
Snippets Groups Projects
Commit e9e194cd authored by Neha Hunka's avatar Neha Hunka
Browse files

Classifying the world into IPCC Table 4.7

parent 7f7612be
No related branches found
No related tags found
No related merge requests found
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -9,6 +9,8 @@ import rasterio
import argparse
import subprocess
#python /projects/biomass_harmonization/country_summaries/IPCC_classes_DPS/IPCC_GEDI_Table4.7.py --tile 00N_130E --output_file /projects/my-private-bucket/Data/IPCC_layers_test/IPCC_Class_TEST_UINT16_again.tif --FOREST_HEIGHT_2000 /projects/my-private-bucket/Data/IPCC_layers_test/2000_00N_130E.tif --FOREST_HEIGHT_2020 /projects/my-private-bucket/Data/IPCC_layers_test/2020_00N_130E.tif --FOREST_GAIN /projects/my-private-bucket/Data/IPCC_layers_test/netgain_00N_130E.tif --FOREST_LOSS /projects/my-private-bucket/Data/IPCC_layers_test/netloss_00N_130E.tif --FOREST_COVER_2000 /projects/my-private-bucket/Data/IPCC_layers_test/Hansen_GFC-2022-v1.10_treecover2000_00N_130E.tif --FOREST_COVER_LOSSYEAR /projects/my-private-bucket/Data/IPCC_layers_test/Hansen_GFC-2022-v1.10_lossyear_00N_130E.tif --PLANTATIONS /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_plantation_type_oilpalm_woodfiber_other_unmasked.tif --IFL_rasters /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_IFL_2000.tif --primary_forest_asia /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_Asia.tif --primary_forest_sa /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_SouthAmerica.tif --primary_forest_africa /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_Africa.tif --EcoCont /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_EcoCont.tif
if __name__ == "__main__":
parse = argparse.ArgumentParser(description="Classifies world into GEZ, Continent and Forest Age classes")
parse.add_argument("--tile", help="Tile", required=True)
......@@ -153,6 +155,6 @@ OLD[PLANTATIONS > 0] = 0
MASK = PRIMARY + YOUNG + OLD
EcoCont = rasterio.open(args.EcoCont).read(1)
kwargs = rasterio.open(args.EcoCont).meta
kwargs.update(dtype=rasterio.int16,count=1,compress='lzw')
EcoCont = (EcoCont*10) + MASK
with rasterio.open(args.output_file, 'w', **kwargs) as dst: dst.write_band(1, EcoCont.astype(rasterio.int16))
\ No newline at end of file
kwargs.update(dtype=rasterio.uint16,count=1,compress='lzw')
EcoCont_WRITE = (EcoCont*10) + MASK
with rasterio.open(args.output_file, 'w', **kwargs) as dst: dst.write_band(1, EcoCont_WRITE.astype(rasterio.uint16))
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -9,6 +9,8 @@ import rasterio
import argparse
import subprocess
#python /projects/biomass_harmonization/country_summaries/IPCC_classes_DPS/IPCC_GEDI_Table4.7.py --tile 00N_130E --output_file /projects/my-private-bucket/Data/IPCC_layers_test/IPCC_Class_TEST_UINT16_again.tif --FOREST_HEIGHT_2000 /projects/my-private-bucket/Data/IPCC_layers_test/2000_00N_130E.tif --FOREST_HEIGHT_2020 /projects/my-private-bucket/Data/IPCC_layers_test/2020_00N_130E.tif --FOREST_GAIN /projects/my-private-bucket/Data/IPCC_layers_test/netgain_00N_130E.tif --FOREST_LOSS /projects/my-private-bucket/Data/IPCC_layers_test/netloss_00N_130E.tif --FOREST_COVER_2000 /projects/my-private-bucket/Data/IPCC_layers_test/Hansen_GFC-2022-v1.10_treecover2000_00N_130E.tif --FOREST_COVER_LOSSYEAR /projects/my-private-bucket/Data/IPCC_layers_test/Hansen_GFC-2022-v1.10_lossyear_00N_130E.tif --PLANTATIONS /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_plantation_type_oilpalm_woodfiber_other_unmasked.tif --IFL_rasters /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_IFL_2000.tif --primary_forest_asia /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_Asia.tif --primary_forest_sa /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_SouthAmerica.tif --primary_forest_africa /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_Africa.tif --EcoCont /projects/my-private-bucket/Data/IPCC_layers_test/00N_130E_EcoCont.tif
if __name__ == "__main__":
parse = argparse.ArgumentParser(description="Classifies world into GEZ, Continent and Forest Age classes")
parse.add_argument("--tile", help="Tile", required=True)
......@@ -153,6 +155,6 @@ OLD[PLANTATIONS > 0] = 0
MASK = PRIMARY + YOUNG + OLD
EcoCont = rasterio.open(args.EcoCont).read(1)
kwargs = rasterio.open(args.EcoCont).meta
kwargs.update(dtype=rasterio.int16,count=1,compress='lzw')
EcoCont = (EcoCont*10) + MASK
with rasterio.open(args.output_file, 'w', **kwargs) as dst: dst.write_band(1, EcoCont.astype(rasterio.int16))
\ No newline at end of file
kwargs.update(dtype=rasterio.uint16,count=1,compress='lzw')
EcoCont_WRITE = (EcoCont*10) + MASK
with rasterio.open(args.output_file, 'w', **kwargs) as dst: dst.write_band(1, EcoCont_WRITE.astype(rasterio.uint16))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment