diff --git a/data/h3_data_importer/Makefile b/data/h3_data_importer/Makefile index 002b222d0..0b60a80fc 100644 --- a/data/h3_data_importer/Makefile +++ b/data/h3_data_importer/Makefile @@ -25,7 +25,7 @@ WORKDIR_LIVESTOCK_PROCESSED=data/livestock_processed WORKDIR_LIVESTOCK_GHG=data/livestock_ghg WORKDIR_DEFAULT_COMMODITY=data/default_commodity WORKDIR_EARTHSTAT=data/earthstat -WORKDIR_EARTHSTAT=data/cropgrids +WORKDIR_CROPGRIDS=data/cropgrids CHECKSUMS_PATH=data_checksums @@ -68,7 +68,7 @@ download-mapspam-crop-production: cd $(WORKDIR_MAPSPAM_PROD) && sha256sum --check ../../$(CHECKSUMS_PATH)/mapspam_prod convert-mapspam-crop-production: download-mapspam-crop-production - python raster_folder_to_h3_table.py $(WORKDIR_MAPSPAM_PROD) h3_grid_spam2010v2r0_global_prod production spam 2010 --h3-res=6 --thread-count=$(PARALLELIZATION_FACTOR) + python raster_folder_to_h3_table.py $(WORKDIR_MAPSPAM_PROD) h3_grid_spam2010v2r0_global_prod production spam 2020 --h3-res=6 --thread-count=$(PARALLELIZATION_FACTOR) download-mapspam-crop-harvest: mkdir -p $(WORKDIR_MAPSPAM_HA) @@ -76,7 +76,7 @@ download-mapspam-crop-harvest: cd $(WORKDIR_MAPSPAM_HA) && sha256sum --check ../../$(CHECKSUMS_PATH)/mapspam_ha convert-mapspam-crop-harvest: download-mapspam-crop-harvest - python raster_folder_to_h3_table.py $(WORKDIR_MAPSPAM_HA) h3_grid_spam2010v2r0_global_ha harvest_area spam 2010 --h3-res=6 --thread-count=$(PARALLELIZATION_FACTOR) + python raster_folder_to_h3_table.py $(WORKDIR_MAPSPAM_HA) h3_grid_spam2010v2r0_global_ha harvest_area spam 2020 --h3-res=6 --thread-count=$(PARALLELIZATION_FACTOR) # --------------------------------------------- # EARTHSTAT - production and harvest @@ -95,14 +95,15 @@ convert-earthstat: download-earthstat # --------------------------------------------- # CROPGRIDS - production and harvest # --------------------------------------------- + download-cropgrids: mkdir -p $(WORKDIR_CROPGRIDS)/production $(WORKDIR_CROPGRIDS)/harvest - aws s3 sync $(AWS_S3_BUCKET_URL)/processed/earthstat/ $(WORKDIR_CROPGRIDS) - cd $(WORKDIR_CROPGRIDS) && sha256sum --check ../../$(CHECKSUMS_PATH)/earthstat + aws s3 sync $(AWS_S3_BUCKET_URL)/processed/crop-grids/ $(WORKDIR_CROPGRIDS) + #cd $(WORKDIR_CROPGRIDS) && sha256sum --check ../../$(CHECKSUMS_PATH)/earthstat convert-cropgrids: download-cropgrids - python raster_folder_to_h3_table.py $(WORKDIR_CROPGRIDS)/production h3_grid_cropgrids_global_prod production cropgrids 2000 --h3-res=6 --thread-count=$(PARALLELIZATION_FACTOR) - python raster_folder_to_h3_table.py $(WORKDIR_CROPGRIDS)/harvest h3_grid_cropgrids_global_ha harvest_area cropgrids 2000 --h3-res=6 --thread-count=$(PARALLELIZATION_FACTOR) + python raster_folder_to_h3_table.py $(WORKDIR_CROPGRIDS)/crop-grids-production h3_grid_cropgrids_global_prod production cropgrids 2020 --h3-res=6 --thread-count=$(PARALLELIZATION_FACTOR) + python raster_folder_to_h3_table.py $(WORKDIR_CROPGRIDS)/crop-grids-harvest h3_grid_cropgrids_global_ha harvest_area cropgrids 2020 --h3-res=6 --thread-count=$(PARALLELIZATION_FACTOR) ############################################################### # Gridded Livestock of the World (GLW3) - pasture production # diff --git a/data/preprocessing/mapspam/Makefile b/data/preprocessing/mapspam/Makefile index dc8815931..fac697fb5 100644 --- a/data/preprocessing/mapspam/Makefile +++ b/data/preprocessing/mapspam/Makefile @@ -114,6 +114,10 @@ compute-mapspam-crop-production: nodata-production -F $(WORKDIR_MAPSPAM)/spam2020V1r0_global_production/spam2020_v1r0_global_P_CNUT_A.tif \ -G $(WORKDIR_MAPSPAM)/spam2020V1r0_global_production/spam2020_v1r0_global_P_RAPE_A.tif \ --outfile $(WORKDIR_MAPSPAM)/spam2020V1r0_global_production/spam2020_v1r0_global_P_OilpSoybGrouOoilSunfCnutRape_A.tif + gdal_calc.py --calc "A+B" --format GTiff --type Float32 --hideNoData --NoDataValue 0 \ + -A $(WORKDIR_MAPSPAM)/spam2020V1r0_global_production/spam2020_v1r0_global_P_COFF_A.tif \ + -B $(WORKDIR_MAPSPAM)/spam2020V1r0_global_production/spam2020_v1r0_global_P_RCOF_A.tif \ + --outfile $(WORKDIR_MAPSPAM)/spam2020V1r0_global_production/spam2020_v1r0_global_P_CoffRcof_A.tif for file in $(WORKDIR_MAPSPAM)/spam2020V1r0_global_production/spam2020_v1r0_global_P_*.tif; do \ gdal_translate -a_nodata 0 -co COMPRESS=DEFLATE -co PREDICTOR=3 $$file $$file.tmp.tif;\ mv $$file.tmp.tif $$file;\ @@ -211,6 +215,10 @@ compute-mapspam-crop-harvest: nodata-harvest -F $(WORKDIR_MAPSPAM)/spam2020V1r0_global_harvested_area/spam2020_v1r0_global_H_CNUT_A.tif --F_band 1 \ -G $(WORKDIR_MAPSPAM)/spam2020V1r0_global_harvested_area/spam2020_v1r0_global_H_RAPE_A.tif --G_band 1 \ --outfile $(WORKDIR_MAPSPAM)/spam2020V1r0_global_harvested_area/spam2020_v1r0_global_H_OilpSoybGrouOoilSunfCnutRape_A.tif + gdal_calc.py --calc "A+B" --format GTiff --type Float32 --hideNoData --NoDataValue 0 \ + -A $(WORKDIR_MAPSPAM)/spam2020V1r0_global_harvested_area/spam2020_v1r0_global_H_COFF_A.tif \ + -B $(WORKDIR_MAPSPAM)/spam2020V1r0_global_harvested_area/spam2020_v1r0_global_H_RCOF_A.tif \ + --outfile $(WORKDIR_MAPSPAM)/spam2020V1r0_global_harvested_area/spam2020_v1r0_global_H_CoffRcof_A.tif for file in $(WORKDIR_MAPSPAM)/spam2020V1r0_global_harvested_area/spam2020_v1r0_global_H_*.tif; do \ gdal_translate -a_nodata 0 -co COMPRESS=DEFLATE -co PREDICTOR=3 $$file $$file.tmp.tif;\ mv $$file.tmp.tif $$file;\