<jupyter_start><jupyter_text>Title: Hansen v1.7 Global Forest Change DescriptionResults from time-series analysis of Landsat images in characterizing global forest extent and change from 2000 through 2019. For additional information about these results, please see the associated journal article (Hansen et al., Science 2013). FLINTThis dataset has been checked and is suitable for use in FLINT. Please adhere to individual dataset licence conditions and citations. Processed data can be accessed here: [Land Sector Datasets](https://datasets.mojaglobal.workers.dev/) https://datasets.mojaglobal.workers.dev/ FormatExtent: Global coverage (excludes Greenland and oceans) -180.0,-90.0 : 180.0,90.0 Resolution: Raster 10 degree tiles 0.00025-degree ~30m resolutionFile type: geotiff (.tif)Cordinate system: EPSG:4326 (WGS84)Temporal Resolution: 2000-2019Size: 30+GB Original sourcehttp://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.7.html LicenceThis work is licensed under a Creative Commons Attribution 4.0 International License. You are free to copy and redistribute the material in any medium or format, and to transform and build upon the material for any purpose, even commercially. You must give appropriate credit, provide a link to the license, and indicate if changes were made. CitationUse the following credit when these data are displayed: "Source: Hansen/UMD/Google/USGS/NASA" Use the following credit when these data are cited: <NAME>., <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>. 2013. “High-Resolution Global Maps of 21st-Century Forest Cover Change.” Science 342 (15 November): 850–53. Data available on-line from: http://earthenginepartners.appspot.com/science-2013-global-forest. Original formatGlobal coverage, tiled 10x10 degrees tiles, geotiff (.tif)cell size 0.00025 degree, resolution 40000 x 40000 PixelsCordinate system EPSG: 4326 (WGS84) MetadataFull metadata can be viewed here http://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.7.htmlDataset names: treecover2000, loss, gain, datamask, first and lastTree canopy cover for year 2000 (treecover2000) - Tree cover in the year 2000, defined as canopy closure for all vegetation taller than 5m in height. Encoded as a percentage per output grid cell, in the range 0–100. Global forest cover gain 2000–2012 (gain) Forest gain during the period 2000–2012, defined as the inverse of loss, or a non-forest to forest change entirely within the study period. Encoded as either 1 (gain) or 0 (no gain). Year of gross forest cover loss event (lossyear) Forest loss during the period 2000–2019, defined as a stand-replacement disturbance, or a change from a forest to non-forest state. Encoded as either 0 (no loss) or else a value in the range 1–17, representing loss detected primarily in the year 2001–2019, respectively. Data mask (datamask) Three values representing areas of no data (0), mapped land surface (1), and permanent water bodies (2).Circa year 2000 Landsat 7 cloud-free image composite (first) Reference multispectral imagery from the first available year, typically 2000. If no cloud-free observations were available for year 2000, imagery was taken from the closest year with cloud-free data, within the range 1999–2012. Circa year 2019 Landsat cloud-free image composite (last) Reference multispectral imagery from the last available year, typically 2019. If no cloud-free observations were available for year 2019, imagery was taken from the closest year with cloud-free data, within the range 2010–2015. NotesTiles may contain no data if over the ocean, please see see datamask to mask waterbodies etc. Updates are intended so please check back at the original source(http://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.7.html). ProcessingDataset is FLINT ready in native form. Code is provided below to bulk download tiles for global coverage, or you can head to the original source to download select tiles.<jupyter_code>#Bulk download tiles
#Text URLS treecover2000.txt, loss.txt, gain.txt, datamask.txt, first.txt, last.txt
#Python 3
import urllib.request
import os.path

#change this path to txt file URLS treecover2000.txt, loss.txt, gain.txt, datamask.txt, first.txt, last.txt from http://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.7.html
enterpath = r"D:\unfccc\Done\hansen\treecover2000.txt"

#text file containing urls for download downloaded from https://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.7.html (see download instructions)
links = open(enterpath, 'r')

#directory to save tifs into (insert your own folder path)
folder = r"C:\Users\LennyJenny\Documents\ArcGIS\world\UNFCCC\downloads\HANSEN"

#open and download links in bulk
for link in links:
    link = link.strip()
    name = link.rsplit('/', 1)[-1]
    filename = os.path.join(folder, name)
    if not os.path.isfile(filename):
        print('Downloading: '+ filename)
    try:
        urllib.request.urlretrieve(link, filename)
        
    except Exception as inst:
        print(inst)
        print('  Encountered unknown error. Continuing.')
print('done')
#Use this code to batch resample tiles to a different raster resolution - change resolution in degrees at -tr and input and outfolder paths
#gdal via OSgeo4w shell
for /R C:\inputfolder\tifs %f IN (*.tif) do gdalwarp.exe -co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9  -t_srs EPSG:4326 -tr 0.0005 0.0005 -r near -multi -tap -of GTiff %f C:\output/%~nf.tif/<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08152367390530438, 'fraction_numerical': 0.04752580989676041, 'mean_word_length': 4.847034339229968, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '644685', 'license': 'BSD-Source-Code', 'n_tokens_mistral': 1798, 'n_tokens_neox': 1535, 'n_words': 683, 'path': 'Data/LandCover/Hansen v1.7 Global Forest Change.ipynb', 'repo_name': 'moja-global/Land-Sector-Datasets', 'size': '5705'}