Night Lights

utilities for caching and downloading night time lights datasets from Earth Observation Group (EOG)


source

get_eog_access_token

 get_eog_access_token (username, password, save_token=False,
                       save_path='~/.eog_creds/eog_access_token',
                       set_env=True, env_token_var='EOG_ACCESS_TOKEN')

source

clear_eog_access_token

 clear_eog_access_token (save_file='~/.eog_creds/eog_access_token',
                         env_var='EOG_ACCESS_TOKEN', clear_file=True,
                         clear_env=True)

source

setup_eog_auth_headers

 setup_eog_auth_headers (headers, access_token, env_var, creds_file)

source

download_url

 download_url (url, dest=None, access_token=None, headers=None,
               timeout=None, show_progress=True, chunksize=1048576,
               env_var='EOG_ACCESS_TOKEN',
               creds_file='~/.eog_creds/eog_access_token')

Download url to dest and show progress


source

unzip_eog_gzip

 unzip_eog_gzip (gz_file, dest=None, delete_src=False)

source

clip_raster

 clip_raster (input_raster_file, dest, bounds, buffer=None)

source

make_url

 make_url (year, viirs_data_type='average',
           ntlights_base_url='https://eogdata.mines.edu/nighttime_light',
           version='v21', product='annual', coverage='global',
           process_suffix='c202205302300', vcmcfg='vcmslcfg')

source

make_clip_hash

 make_clip_hash (year, bounds, viirs_data_type='average', version='v21',
                 product='annual', coverage='global',
                 process_suffix='c202205302300', vcmcfg='vcmslcfg')

source

generate_clipped_raster

 generate_clipped_raster (year, bounds, dest, viirs_data_type='average',
                          version='v21', product='annual',
                          coverage='global',
                          cache_dir='~/.cache/geowrangler/nightlights',
                          process_suffix='c202205302300',
                          vcmcfg='vcmslcfg')

source

generate_clipped_metadata

 generate_clipped_metadata (year, bounds, viirs_data_type, version,
                            product, coverage, clip_cache_dir,
                            process_suffix, vcmcfg)

source

get_clipped_raster

 get_clipped_raster (year, bounds, viirs_data_type='average',
                     version='v21', product='annual', coverage='global',
                     cache_dir='~/.cache/geowrangler/nightlights',
                     process_suffix='c202205302300', vcmcfg='vcmslcfg')