1 Extract image data at an AOI
In [1]:
Copied!
# import earth engine and intialise high volume end-point
import ee
# ee.Authenticate() # you may need to authenticate
ee.Initialize(opt_url='https://earthengine-highvolume.googleapis.com')
# import earth engine and intialise high volume end-point
import ee
# ee.Authenticate() # you may need to authenticate
ee.Initialize(opt_url='https://earthengine-highvolume.googleapis.com')
In [3]:
Copied!
import os
import sys
import glob
import csv
import geedim
import geemap
from geeml.utils import eeprint, getCountry
from geeml.extract import extractor
import os
import sys
import glob
import csv
import geedim
import geemap
from geeml.utils import eeprint, getCountry
from geeml.extract import extractor
In [4]:
Copied!
%load_ext watermark
%watermark
%watermark --iversions
%load_ext watermark
%watermark
%watermark --iversions
Last updated: 2022-06-29T15:56:50.037466+02:00 Python implementation: CPython Python version : 3.9.12 IPython version : 8.4.0 Compiler : MSC v.1929 64 bit (AMD64) OS : Windows Release : 10 Machine : AMD64 Processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel CPU cores : 12 Architecture: 64bit geemap: 0.13.4 ee : 0.2 sys : 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:17:03) [MSC v.1929 64 bit (AMD64)] geedim: 1.2.0 csv : 1.0
Extract NASADEM for AOI (Kenya)¶
In [6]:
Copied!
#import datasets from GEE
# A multiband image
nasadem = ee.Image("NASA/NASADEM_HGT/001")
# Get Kenya administrative boundary using a point in Kenya
poi = ee.Geometry.Point([37.857884,-0.002197])
kenya = getCountry(poi)
# Set download directory
dd = r'D:\Scratch'
#import datasets from GEE
# A multiband image
nasadem = ee.Image("NASA/NASADEM_HGT/001")
# Get Kenya administrative boundary using a point in Kenya
poi = ee.Geometry.Point([37.857884,-0.002197])
kenya = getCountry(poi)
# Set download directory
dd = r'D:\Scratch'
In [9]:
Copied!
AOIExtractor = extractor(nasadem, aoi= kenya, dd=dd, scale =100)
AOIExtractor.extractAoi()
AOIExtractor = extractor(nasadem, aoi= kenya, dd=dd, scale =100)
AOIExtractor.extractAoi()
Consider adjusting `region`, `scale` and/or `dtype` to reduce the X.tif download size (raw: 1.16 GB).
X.tif: | | 0.00/1.16G (raw) [ 0.0%] in 00:00 (et…
There is no STAC entry for: None
Extract data at randomly generated points within an AOI (Kenya)¶
In [7]:
Copied!
# Extract data at random points
target = ee.FeatureCollection.randomPoints(kenya, 10000, 123, 5)
# Initialise Extractor
randomPointExtractor = extractor(nasadem, target = target, aoi= kenya, dd=dd, scale =100)
randomPointExtractor.extractPoints(batchSize= 10000)
# Extract data at random points
target = ee.FeatureCollection.randomPoints(kenya, 10000, 123, 5)
# Initialise Extractor
randomPointExtractor = extractor(nasadem, target = target, aoi= kenya, dd=dd, scale =100)
randomPointExtractor.extractPoints(batchSize= 10000)
Extracting data for task 1 with 10000 point(s)