WorldPop — multi-year population, aggregated (live)¶
Pull Comoros population for 2010 and 2020, then reduce the year stack to a single mean raster with aggregate=.
In [ ]:
Copied!
import tempfile
from earthlens import AggregationConfig
from earthlens.earthlens import EarthLens
d = tempfile.mkdtemp()
paths = EarthLens(
data_source='worldpop',
variables=['pop'],
aoi='COM',
start='2010',
end='2020',
fmt='%Y',
lat_lim=[-12.5, -11.3],
lon_lim=[43.2, 44.6],
path=d,
years=[2010, 2020],
).download(progress_bar=False, aggregate=AggregationConfig(freq='100YS', op='mean'))
print('written:', [p.name for p in paths])
import tempfile
from earthlens import AggregationConfig
from earthlens.earthlens import EarthLens
d = tempfile.mkdtemp()
paths = EarthLens(
data_source='worldpop',
variables=['pop'],
aoi='COM',
start='2010',
end='2020',
fmt='%Y',
lat_lim=[-12.5, -11.3],
lon_lim=[43.2, 44.6],
path=d,
years=[2010, 2020],
).download(progress_bar=False, aggregate=AggregationConfig(freq='100YS', op='mean'))
print('written:', [p.name for p in paths])
aggregate= is forwarded because WorldPop's output kind is mixed; the per-year rasters are reduced into one window raster.