thinkingmachines / unicef-ai4d-poverty-mapping

UNICEF AI4D Relative Wealth Mapping Project - datasets, models, and scripts for building relative wealth estimation models across Southeast Asia (SEA)
https://thinkingmachines.github.io/unicef-ai4d-poverty-mapping
MIT License
20 stars 8 forks source link

Fix nightlights.py to allow download for 2022 in new version #203

Closed tm-jace-peralta closed 1 year ago

tm-jace-peralta commented 1 year ago

Current code only allows version v21 which only has nightlights data until 2021. The newer version v22 has 2022 data but follows a slightly different url pattern

I changed nightlights.py to get this v22 2022 data by adding the new version's url download format in this variable and also added some conditional statements for the code to choose the new url format when year=2022 is provided.

URLFORM = {
    "annual_v21": "{ntlights_base_url}/{product}/{version}/{year}/VNL_{version}_npp_{year}{year_suffix}_{coverage}_{vcmcfg}_{process_suffix}.{viirs_data_type}.dat.tif.gz",
    "annual_v22": "{ntlights_base_url}/{product}/{version}/{year}/VNL_{version}_npp-j01_{year}{year_suffix}_{coverage}_{vcmcfg}_{process_suffix}.{viirs_data_type}.dat.tif.gz",
    "annual_v2": "{ntlights_base_url}/{product}/{version}0/{year}/VNL_{version}_npp_{year}{year_suffix}_{coverage}_{vcmcfg}_{process_suffix}.{viirs_data_type}.dat.tif.gz",
}