Attribution-ShareAlike 4.0 (CC BY-SA 4.0)https://creativecommons.org/licenses/by-sa/4.0/
License information was derived automatically
Global cropland extent annual for 2000-2022 based on the Potapov et al. (2021). Cropland defined as: land used for annual and perennial herbaceous crops for human consumption, forage (including hay), and biofuel. Perennial woody crops, permanent pastures, and shifting cultivation are excluded from the definition. The original 30-m resolution data (0/1 values) was interpolated from time-series 2003, 2007, 2011, 2015, 2019 to annual values 2000 to 2022 using linear interpolation. All values shown are in principle fractions 0-100%. The 30-m and 100-m resoluton images (COGs) are too large for Zenodo but you can access them from URLs in the filenames_openlandmap_cropland.txt file. See for example (drop the URL in QGIS):
Disclaimer: linear interpolation has limited accuracy and is basically only used to gap-fill the missing years. The remaining missing values in the maps can be ALL consider to be 0 value for cropland. A more detailed up-to-date cropland map of the world is provided by van Tricht et al., (2023), however only single year (2021) has been mapped at 10-m resolution within the WorldCereal project.
The temporal interpolation was implemented using terra package ii.e. using the following fuction:
library(terra)
y.l = c(2003, 2007, 2011, 2015, 2019)
out.years = 2000:2022
i = parallel::mclapply(y.l, function(x){system(paste0('gdal_translate Global_cropland_', x, '.vrt Global_cropland_', x, '.tif -co TILED=YES -co BIGTIFF=YES -co COMPRESS=DEFLATE -co ZLEVEL=9 -co BLOCKXSIZE=1024 -co BLOCKYSIZE=1024 -co NUM_THREADS=8 -co SPARSE_OK=TRUE -a_nodata 255 -scale 0 1 0 100 -ot Byte'))}, mc.cores = length(y.l))
## land mask at 1 deg (100x100km) ----
x = parallel::mclapply(y.l, function(x){system(paste0("gdal_translate Global_cropland_", x, ".tif Global_cropland_", x, "_1d.tif -tr 1 1 -r average -co BIGTIFF=YES -ot Byte -co NUM_THREADS=10"))}, mc.cores = length(y.l))
## 2 hrs
g1 = terra::rast(paste0("Global_cropland_", y.l, "_1d.tif"))
gs = sum(g1, na.rm=TRUE)
plot(gs)
gs.p <- as.polygons(gs, values = TRUE, extent=FALSE, dissolve=FALSE, na.rm=TRUE)
## Input layers:
r = terra::rast(paste0("Global_cropland_", y.l, ".tif"))
int.mc = function(r, tile, y.l, out.years=2000:2022){
bb = paste(as.vector(ext(tile)), collapse = ".")
if(any(!file.exists(paste0("./tmp/", out.years, "/Global_cropland_", out.years, "_", bb, ".tif")))){
r.t = terra::crop(r, ext(tile))
## each tile is 16M pixels
r.x = as.data.frame(r.t, xy=TRUE, na.rm=FALSE)
rs = rowSums(r.x[,-c(1:2)], na.rm=TRUE)
## if sum is == 0 means no cropland throughout the time-series
sel = which(rs>0)
## extract complete values:
r.x0 = r.x[sel,-c(1:2)]
r.x0[is.na(r.x0)] = 0
## interpolate between values:
t1s = as.data.frame(t(apply(r.x0, 1, function(y){ try( approx(y.l, as.vector(y), xout=out.years, rule=2)$y ) })))
## write to GeoTIFFs
t1s$x <- r.x$x[sel]; t1s$y <- r.x$y[sel]
## convert to RasterLayer:
r.x = rast(t1s[,c("x","y",paste0("V", 1:length(out.years)))], type="xyz", crs="+proj=longlat +datum=WGS84 +no_defs")
for(j in 1:length(out.years)){
writeRaster(r.x[[j]], filename=paste0("./tmp/", out.years[j], "/Global_cropland_", out.years[j], "_", bb, ".tif"), gdal=c("COMPRESS=DEFLATE"), datatype='INT1U', NAflag=0, overwrite=FALSE)
}
}
}
## test it:
#int.mc(r, tile=gs.p[1000], y.l)
## run in parallel ----
## takes 12 hrs... 1TB RAM
i = parallel::mclapply(sample(1:length(gs.p)), function(x){try( int.mc(r, tile=gs.p[x], y.l) )}, mc.cores = 70)
Attribution 4.0 (CC BY 4.0)https://creativecommons.org/licenses/by/4.0/
License information was derived automatically
By integrating multi-source cross-scale inventories and satellite-based datasets, we reconstructed the annual crop density and crop type map (excluding summer idle/fallow, cropland pasture) in the contiguous US at 1km×1km resolution from 1850 to 2021. The annual crop density map depicts the distribution and fraction of cultivated land, while the crop type map displays the corresponding crop type. The developed datasets fill the data gap in lacking of crop type extent and type maps, which can support the environmental assessment and socioeconomic analysis related to agricultural activities. (Supplement to: Shuchao, Ye et al. (2023): Annual time-series 1-km maps of crop area and types in the conterminous US (CropAT-US): cropping diversity changes during 1850-2021.)
Attribution 4.0 (CC BY 4.0)https://creativecommons.org/licenses/by/4.0/
License information was derived automatically
Dataset Abstract:
Sugarcane is an important source of food, biofuel, and farmer income in many countries. At the same time, sugarcane is implicated in many social and environmental challenges, including water scarcity and nutrient pollution. Currently, few of the top sugar-producing countries generate reliable maps of where sugarcane is cultivated. To fill this gap, we introduce a dataset of detailed sugarcane maps for the top 13 producing countries in the world, comprising nearly 90% of global production. Maps were generated for the 2019-2022 period by combining data from the Global Ecosystem Dynamics Investigation (GEDI) and Sentinel-2 (S2). GEDI data were used to provide training data on where tall and short crops were growing each month, while S2 features were used to map tall crops for all cropland pixels each month. Sugarcane was then identified by leveraging the fact that sugar is typically the only tall crop growing for a substantial fraction of time during the study period. Comparisons with field data, pre-existing maps, and official government statistics all indicated high precision and recall of our maps. Agreement with field data at the pixel level exceeded 80% in most countries, and sub-national sugarcane areas from our maps were consistent with government statistics. Exceptions appeared mainly due to problems in underlying cropland masks, or to under-reporting of sugarcane area by governments.
The final maps should be useful in studying the various impacts of sugarcane cultivation and producing maps of related outcomes such as sugarcane yields.
USAGE: Users must mask the provided sugarcane map with the most appropriate crop mask from the ones provided. If none of the provided crop masks are suitable, users can use an external crop mask instead.
Validation results for the sugarcane maps are detailed in Section 4.3 of the paper. For Indonesia and Guatemala, no field-level data or raster datasets were available for validation of our sugarcane maps.
Dataset:
5 bands
b1: Number of tall months
b2: Sugarcane Map: 0 = non-sugarcane, 1 = sugarcane
b3: ESA crop mask: 0 = non-cropland, 1 = cropland
b4: ESRI crop mask: 0 = non-cropland, 1 = cropland
b5: GLAD crop mask: 0 = non-cropland, 1 = cropland
The dataset can be accessed on Google Earth Engine (GEE) at
https://code.earthengine.google.com/?asset=projects/lobell-lab/gedi_sugarcane/maps/imgColl_10m_ESAESRIGLAD
Example GEE script for visualizing and masking the sugarcane maps by country available at:
https://code.earthengine.google.com/545a87ce9bc29f2b5ad180955d974f8c?asset=projects%2fl Bell-lab%2Fgedi_sugarcane%2 Maps%2FimgColl_10m_ESAESRIGLAD
Attribution 4.0 (CC BY 4.0)https://creativecommons.org/licenses/by/4.0/
License information was derived automatically
Map distinguishing 14 classes of agricultural land in Africa. Agricultural land includes arable land, permanent crops and permanent pastures. The map is a classification of the 'Agricultural Land of Africa (verion 2)' dataset. Primary input data source to develop the map was the Copernicus Global Land Service; Land Cover 100m; collection 3; epoch 2019; Globe (https://zenodo.org/record/3939050). In addition, the Agro-ecological zones of Africa (AEZ; version 2009 developed by IFPRI, https://doi.org/10.7910/DVN/HJYYTI) dataset was used. The map was generated by applying agricultural land classification rules to a set of Copernicus Global Land Cover layers (main discrete classification, cover fractions for cropland/forest/herbaceous vegetation/shrubland) and the AEZ layer. The map has a spatial resolution of 100 m.
This raster dataset depicts the average fractional proportion of a gridcell for mixed grains crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
This data set is a subset of a global croplands data set (Ramankutty and Foley 1999a). The subset was created for the study area of the Large Scale Biosphere-Atmosphere Experiment in Amazonia (LBA) in South America (i.e., 10? N to 25? S, 30? to 85? W). The data are in ASCII GRID format at 5-min resolution.
Navin Ramankutty and Jonathan Foley, of the Center for Sustainability and the Global Environment (SAGE) at the University of Wisconsin, developed a global, spatially explicit data set of reconstructed historical croplands from 1700 to 1992. The method for historical reconstruction used a simple algorithm that linked contemporary satellite data and historical cropland inventory data. A spatially explicit croplands data set for 1992 was first derived by calibrating a satellite-derived land cover classification data set against cropland inventory data for 1992. This derived data set was then used within a simple land cover change model, along with historical cropland inventory data, to derive spatially explicit maps of historical croplands. The global data set was restricted to a representation of permanent croplands (i.e., excluding shifting cultivation), which follows the Food and Agriculture Organization (FAO) definition of arable lands and permanent crops. Data values represent fraction of grid cell in croplands.
Data for the LBA study area are available for the years 1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, and 1992. Although the global croplands data set contains data representing croplands since 1700, essentially no croplands were in the LBA study area until 1900. Data from previous years were excluded at the suggestion of the data originator.
More information can be found at ftp://daac.ornl.gov/data/lba/land_use_land_cover_change/historical_croplands/comp/uwcrop_readme.pdf.
LBA was a cooperative international research initiative led by Brazil. NASA was a lead sponsor for several experiments. LBA was designed to create the new knowledge needed to understand the climatological, ecological, biogeochemical, and hydrological functioning of Amazonia; the impact of land use change on these functions; and the interactions between Amazonia and the Earth system. More information about LBA can be found at http://www.daac.ornl.gov/LBA/misc_amazon.html.
Attribution 4.0 (CC BY 4.0)https://creativecommons.org/licenses/by/4.0/
License information was derived automatically
Maps produced by per-pixel integration of cultivated and natural/semi-natural grassland (Parente et al., 2024) and cropland extent (Potapov, et al., 2022) considering fractions of land use inside 1 km2 grid cell. For this, a global map of agricultural production systems (Venier-Cambron, et al., 2024) was used to establish fraction thresholds for livestock supported by:
The annual time series (2000-2022) of integrated maps provided 1 km spatial resolution ranging from 1–100%, with potential land used for livestock production.
This raster dataset depicts the average fractional proportion of a gridcell for cotton crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
This raster dataset depicts the average fractional proportion of a gridcell for agave crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
This raster dataset depicts the average fractional proportion of a gridcell for pimento crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
This raster dataset depicts the average fractional proportion of a gridcell for maize forage crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.EarthStat.org serves geographic data sets with the purpose of solving the grand challenge of feeding a growing global population while reducing agriculture’s impact on the environment. The data sets on EarthStat allow users to map the distribution of crops globally, analyze the impact of climate change on crop yields, understand the impacts of fertilizer and manure use and much more.
This raster dataset depicts the average fractional proportion of a gridcell for barley crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
Attribution 3.0 (CC BY 3.0)https://creativecommons.org/licenses/by/3.0/
License information was derived automatically
This paper provides a method for constructing a new historical global nitrogen fertilizer application map (0.5° × 0.5° resolution) for the period 1961-2010 based on country-specific information from Food and Agriculture Organization statistics (FAOSTAT) and various global datasets. This new map incorporates the fraction of NH+4 (and NONO-3) in N fertilizer inputs by utilizing fertilizer species information in FAOSTAT, in which species can be categorized as NH+4 and/or NO-3-forming N fertilizers. During data processing, we applied a statistical data imputation method for the missing data (19 % of national N fertilizer consumption) in FAOSTAT. The multiple imputation method enabled us to fill gaps in the time-series data using plausible values using covariates information (year, population, GDP, and crop area). After the imputation, we downscaled the national consumption data to a gridded cropland map. Also, we applied the multiple imputation method to the available chemical fertilizer species consumption, allowing for the estimation of the NH+4/NO-3 ratio in national fertilizer consumption. In this study, the synthetic N fertilizer inputs in 2000 showed a general consistency with the existing N fertilizer map (Potter et al., 2010, doi:10.1175/2009EI288.1) in relation to the ranges of N fertilizer inputs. Globally, the estimated N fertilizer inputs based on the sum of filled data increased from 15 Tg-N to 110 Tg-N during 1961-2010. On the other hand, the global NO-3 input started to decline after the late 1980s and the fraction of NO-3 in global N fertilizer decreased consistently from 35 % to 13 % over a 50-year period. NH+4 based fertilizers are dominant in most countries; however, the NH+4/NO-3 ratio in N fertilizer inputs shows clear differences temporally and geographically. This new map can be utilized as an input data to global model studies and bring new insights for the assessment of historical terrestrial N cycling changes.
This raster dataset depicts the average fractional proportion of a gridcell for hazelnut crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
Attribution-NonCommercial-ShareAlike 3.0 (CC BY-NC-SA 3.0)https://creativecommons.org/licenses/by-nc-sa/3.0/
License information was derived automatically
In this sub-theme the suitability of total land and of cropland areas is summarized based on classification of a normalized suitability index SI:
SI = 100 x (90 x VS + 70 x S + 50 x MS + 30 x mS + 15 x VmS + 0 x NS) / 0.9
with values stretching over the interval of 0 to 10000 and where VS, S, …, NS are the shares of area extents of different suitability classes in a 5 arc-minute grid cell (see also sub-theme Suitability Index).
The normalized suitability index has been calculated for 53 crops, by level of inputs/management and separately for rain-fed and irrigated conditions. Results relate to either an entire grid cell or to a fraction of the grid cell indicated by the land cover data as cropland. For the map compilations regarding cropland it is assumed that farmers have used the better part of the suitability distribution in a grid cell.
Results of calculated SI values for each grid cell are grouped into 8 aggregate classes, termed as follows: Aggregate crop suitability is (1) Very high, when SI > 8500; (2) High, when 7000 < SI ≤ 8500; (3) Good, when 5500 < SI ≤ 7000; (4) Medium, when 4000 < SI ≤ 5500; (5) Moderate, when 2500 < SI ≤ 4000; (6) Marginal, when 1000 < SI ≤ 2500; (7) Very marginal, when 0 < SI ≤ 1000; and (8) Not suitable, when SI = 0.
This data set provides annual spatial patterns of cropland, natural pasture, and planted pasture land uses across Amazonia for the period 1940/1950-1995. Two series of 5-minute grid cell historical maps were generated starting from land use classification products for 1995. Annual data are the fraction of natural pasture, planted pasture, and cropland in each 5-min grid cell. The annual maps are provided in two NetCDF (.nc) format file at 5-minute resolution. The AMZ-C.nc file covers the Brazilian portion of Amazon and Tocantins Rivers basins, and is based on the 1995 land use classification of Cardille et al. (2002), generated through the fusion of remote sensing (AVHRR) and agricultural census data. The second file, AMZ-R.nc, covers the entire Legal Amazon region and adjacent areas and is based on the 1995 land use classification by Ramankutty et al. (2008). The land use classification was generated by the fusion of satellite imagery (MODIS and VEGETATION-SPOT) and data from the agricultural census. A historical land-use reconstruction algorithm was used to generate the annual spatial patterns (based on work from Ramunkutty and Foley, 1999).
This raster dataset depicts the average fractional proportion of a gridcell for grass crops (not specified elsewhere) that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
This raster dataset depicts the average fractional proportion of a gridcell for cabbage forage crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
Attribution 4.0 (CC BY 4.0)https://creativecommons.org/licenses/by/4.0/
License information was derived automatically
This archive provides consistent global datasets on harmonized and use, biodiversity intactness index (BII), and biodiversity intactness footprint of agricultural production from 2000 to 2020.Global high-resolution harmonized land use (HHLU) maps reflect land use and vegetation states in seven (07) categories: (1) Primary-minimal use vegetation, (2) Primary vegetation, (3) Secondary vegetation, (4) Cropland, (5) Urban lands, (6) Pasture/Grazing lands, (7) Agroforestry.Land use Fraction (LUF) maps present land use proportions for each aggregated location for land use classes corresponding to HHLU (value range, 0-1). Primary minimal-use vegetation and Primary vegetation are combined into Primary vegetation.Biodiversity Intactness Index (BII) maps simulate terrestrial biodiversity integrity across all land use, ranging from 0 to 1.Biodiversity loss footprint (BII loss) tabular data allocates biodiversity loss footprints induced by agricultural production (crops and livestock), which estimates BII loss over 14 biomes, 193 countries and territories, 154 crops, and 09 livestock categories from 2000 to 2020.
This raster dataset depicts the average fractional proportion of a gridcell for ginger crops that were harvested circa 2000. Croplands cover ~15 million km2 of the planet and provide the bulk of the food and fiber essential to human well-being. Most global land cover datasets from satelites group croplands into just a few categories, thereby excluding information that is critical for answering key questions ranging from biodiversity conservation to food security to biogeochemical cycling. Information about agricultural land use practices like crop selection, yield, and fertilizer use is even more limited.Here we present land use data sets created by combining national, state, and county level census statistics with a recently updated global data set of croplands on a 5 minute by 5 minute (~10km x 10 km) latitude/longitude grid. Temporal resolution: Year 2000- based of average of census data between 1997-2003.
Attribution-ShareAlike 4.0 (CC BY-SA 4.0)https://creativecommons.org/licenses/by-sa/4.0/
License information was derived automatically
Global cropland extent annual for 2000-2022 based on the Potapov et al. (2021). Cropland defined as: land used for annual and perennial herbaceous crops for human consumption, forage (including hay), and biofuel. Perennial woody crops, permanent pastures, and shifting cultivation are excluded from the definition. The original 30-m resolution data (0/1 values) was interpolated from time-series 2003, 2007, 2011, 2015, 2019 to annual values 2000 to 2022 using linear interpolation. All values shown are in principle fractions 0-100%. The 30-m and 100-m resoluton images (COGs) are too large for Zenodo but you can access them from URLs in the filenames_openlandmap_cropland.txt file. See for example (drop the URL in QGIS):
Disclaimer: linear interpolation has limited accuracy and is basically only used to gap-fill the missing years. The remaining missing values in the maps can be ALL consider to be 0 value for cropland. A more detailed up-to-date cropland map of the world is provided by van Tricht et al., (2023), however only single year (2021) has been mapped at 10-m resolution within the WorldCereal project.
The temporal interpolation was implemented using terra package ii.e. using the following fuction:
library(terra)
y.l = c(2003, 2007, 2011, 2015, 2019)
out.years = 2000:2022
i = parallel::mclapply(y.l, function(x){system(paste0('gdal_translate Global_cropland_', x, '.vrt Global_cropland_', x, '.tif -co TILED=YES -co BIGTIFF=YES -co COMPRESS=DEFLATE -co ZLEVEL=9 -co BLOCKXSIZE=1024 -co BLOCKYSIZE=1024 -co NUM_THREADS=8 -co SPARSE_OK=TRUE -a_nodata 255 -scale 0 1 0 100 -ot Byte'))}, mc.cores = length(y.l))
## land mask at 1 deg (100x100km) ----
x = parallel::mclapply(y.l, function(x){system(paste0("gdal_translate Global_cropland_", x, ".tif Global_cropland_", x, "_1d.tif -tr 1 1 -r average -co BIGTIFF=YES -ot Byte -co NUM_THREADS=10"))}, mc.cores = length(y.l))
## 2 hrs
g1 = terra::rast(paste0("Global_cropland_", y.l, "_1d.tif"))
gs = sum(g1, na.rm=TRUE)
plot(gs)
gs.p <- as.polygons(gs, values = TRUE, extent=FALSE, dissolve=FALSE, na.rm=TRUE)
## Input layers:
r = terra::rast(paste0("Global_cropland_", y.l, ".tif"))
int.mc = function(r, tile, y.l, out.years=2000:2022){
bb = paste(as.vector(ext(tile)), collapse = ".")
if(any(!file.exists(paste0("./tmp/", out.years, "/Global_cropland_", out.years, "_", bb, ".tif")))){
r.t = terra::crop(r, ext(tile))
## each tile is 16M pixels
r.x = as.data.frame(r.t, xy=TRUE, na.rm=FALSE)
rs = rowSums(r.x[,-c(1:2)], na.rm=TRUE)
## if sum is == 0 means no cropland throughout the time-series
sel = which(rs>0)
## extract complete values:
r.x0 = r.x[sel,-c(1:2)]
r.x0[is.na(r.x0)] = 0
## interpolate between values:
t1s = as.data.frame(t(apply(r.x0, 1, function(y){ try( approx(y.l, as.vector(y), xout=out.years, rule=2)$y ) })))
## write to GeoTIFFs
t1s$x <- r.x$x[sel]; t1s$y <- r.x$y[sel]
## convert to RasterLayer:
r.x = rast(t1s[,c("x","y",paste0("V", 1:length(out.years)))], type="xyz", crs="+proj=longlat +datum=WGS84 +no_defs")
for(j in 1:length(out.years)){
writeRaster(r.x[[j]], filename=paste0("./tmp/", out.years[j], "/Global_cropland_", out.years[j], "_", bb, ".tif"), gdal=c("COMPRESS=DEFLATE"), datatype='INT1U', NAflag=0, overwrite=FALSE)
}
}
}
## test it:
#int.mc(r, tile=gs.p[1000], y.l)
## run in parallel ----
## takes 12 hrs... 1TB RAM
i = parallel::mclapply(sample(1:length(gs.p)), function(x){try( int.mc(r, tile=gs.p[x], y.l) )}, mc.cores = 70)