LightPollution Visualization đĄÂ¶
This notebook aims to explore light pollution data over periods of time to explore how it is growing over the years. Additionally, this notebook aims to export the data such that it can be visualized in a geographical atlas [1].
Author: Timothy Do
References¶
[1] P. Cinzano, F. Falchi, and C. D. Elvidge, âThe first World Atlas of the artificial night sky brightnessâ, Monthly Notices of the Royal Astronomical Society, vol. 328, no. 3, pp. 689â707, 12 2001.
[2] C. D. Elvidge, K. E. Baugh, M. Zhizhin, and F.-C. Hsu, âWhy VIIRS data are superior to DMSP for mapping nighttime lights,â Asia-Pacific Advanced Network 35, vol. 35, p. 62, 2013.
[3] D. J. Lorenz, "Light Pollution Atlas 2022," [Online]. Available: https://djlorenz.github.io/astronomy/lp2022/
Dependencies¶
IN_COLAB = True
try:
import google.colab
except:
IN_COLAB = False
print(f'In CoLab: {IN_COLAB}')
In CoLab: False
if(IN_COLAB):
!curl https://raw.githubusercontent.com/dotimothy/astronomy/main/requirements.txt -o ./requirements.txt
!pip install -r requirements.txt
else:
!pip install -r ../requirements.txt
Requirement already satisfied: opencv-python in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 2)) (4.10.0.84) Requirement already satisfied: pillow in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 3)) (10.4.0) Requirement already satisfied: exifread in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 4)) (3.0.0) Requirement already satisfied: matplotlib in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 5)) (3.9.2) Requirement already satisfied: numpy in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 6)) (1.26.4) Requirement already satisfied: rawpy in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 7)) (0.24.0) Requirement already satisfied: tqdm in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 8)) (4.66.5) Requirement already satisfied: jupyter in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 9)) (1.0.0) Requirement already satisfied: torch in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 10)) (2.4.0+cu118) Requirement already satisfied: h5py in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 11)) (3.10.0) Requirement already satisfied: pandas in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 12)) (2.2.2) Requirement already satisfied: xarray in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 13)) (2024.11.0) Requirement already satisfied: earthaccess in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from -r ../requirements.txt (line 14)) (0.12.0) Requirement already satisfied: contourpy>=1.0.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->-r ../requirements.txt (line 5)) (1.2.1) Requirement already satisfied: cycler>=0.10 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->-r ../requirements.txt (line 5)) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->-r ../requirements.txt (line 5)) (4.53.1) Requirement already satisfied: kiwisolver>=1.3.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->-r ../requirements.txt (line 5)) (1.4.5) Requirement already satisfied: packaging>=20.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->-r ../requirements.txt (line 5)) (24.1) Requirement already satisfied: pyparsing>=2.3.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->-r ../requirements.txt (line 5)) (3.1.2) Requirement already satisfied: python-dateutil>=2.7 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from matplotlib->-r ../requirements.txt (line 5)) (2.9.0.post0) Requirement already satisfied: colorama in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from tqdm->-r ../requirements.txt (line 8)) (0.4.6) Requirement already satisfied: notebook in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter->-r ../requirements.txt (line 9)) (7.0.7) Requirement already satisfied: qtconsole in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter->-r ../requirements.txt (line 9)) (5.5.1) Requirement already satisfied: jupyter-console in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter->-r ../requirements.txt (line 9)) (6.6.3) Requirement already satisfied: nbconvert in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter->-r ../requirements.txt (line 9)) (7.14.2) Requirement already satisfied: ipykernel in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter->-r ../requirements.txt (line 9)) (6.29.0) Requirement already satisfied: ipywidgets in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter->-r ../requirements.txt (line 9)) (8.1.1) Requirement already satisfied: filelock in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from torch->-r ../requirements.txt (line 10)) (3.9.0) Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from torch->-r ../requirements.txt (line 10)) (4.12.2) Requirement already satisfied: sympy in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from torch->-r ../requirements.txt (line 10)) (1.12) Requirement already satisfied: networkx in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from torch->-r ../requirements.txt (line 10)) (2.8.8) Requirement already satisfied: jinja2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from torch->-r ../requirements.txt (line 10)) (3.1.2) Requirement already satisfied: fsspec in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from torch->-r ../requirements.txt (line 10)) (2024.12.0) Requirement already satisfied: pytz>=2020.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from pandas->-r ../requirements.txt (line 12)) (2022.7.1) Requirement already satisfied: tzdata>=2022.7 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from pandas->-r ../requirements.txt (line 12)) (2023.4) Requirement already satisfied: importlib-resources>=6.3.2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from earthaccess->-r ../requirements.txt (line 14)) (6.4.0) Requirement already satisfied: multimethod>=1.8 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from earthaccess->-r ../requirements.txt (line 14)) (2.0) Requirement already satisfied: pqdm>=0.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from earthaccess->-r ../requirements.txt (line 14)) (0.2.0) Requirement already satisfied: python-cmr>=0.10.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from earthaccess->-r ../requirements.txt (line 14)) (0.13.0) Requirement already satisfied: requests>=2.26 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from earthaccess->-r ../requirements.txt (line 14)) (2.32.3) Requirement already satisfied: s3fs>=2022.11 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from earthaccess->-r ../requirements.txt (line 14)) (2024.12.0) Requirement already satisfied: tinynetrc>=1.3.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from earthaccess->-r ../requirements.txt (line 14)) (1.3.1) Requirement already satisfied: bounded-pool-executor in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from pqdm>=0.1->earthaccess->-r ../requirements.txt (line 14)) (0.0.3) Requirement already satisfied: six>=1.5 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from python-dateutil>=2.7->matplotlib->-r ../requirements.txt (line 5)) (1.16.0) Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from requests>=2.26->earthaccess->-r ../requirements.txt (line 14)) (2.1.1) Requirement already satisfied: idna<4,>=2.5 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from requests>=2.26->earthaccess->-r ../requirements.txt (line 14)) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from requests>=2.26->earthaccess->-r ../requirements.txt (line 14)) (1.26.19) Requirement already satisfied: certifi>=2017.4.17 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from requests>=2.26->earthaccess->-r ../requirements.txt (line 14)) (2022.12.7) Requirement already satisfied: aiobotocore<3.0.0,>=2.5.4 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (2.16.1) Requirement already satisfied: aiohttp!=4.0.0a0,!=4.0.0a1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (3.9.5) Requirement already satisfied: comm>=0.1.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (0.2.1) Requirement already satisfied: debugpy>=1.6.5 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (1.8.0) Requirement already satisfied: ipython>=7.23.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (8.20.0) Requirement already satisfied: jupyter-client>=6.1.12 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (8.6.0) Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (5.7.1) Requirement already satisfied: matplotlib-inline>=0.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (0.1.7) Requirement already satisfied: nest-asyncio in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (1.6.0) Requirement already satisfied: psutil in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (6.0.0) Requirement already satisfied: pyzmq>=24 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (25.1.2) Requirement already satisfied: tornado>=6.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (6.4) Requirement already satisfied: traitlets>=5.4.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipykernel->jupyter->-r ../requirements.txt (line 9)) (5.14.1) Requirement already satisfied: widgetsnbextension~=4.0.9 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipywidgets->jupyter->-r ../requirements.txt (line 9)) (4.0.9) Requirement already satisfied: jupyterlab-widgets~=3.0.9 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipywidgets->jupyter->-r ../requirements.txt (line 9)) (3.0.9) Requirement already satisfied: MarkupSafe>=2.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jinja2->torch->-r ../requirements.txt (line 10)) (2.1.3) Requirement already satisfied: prompt-toolkit>=3.0.30 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-console->jupyter->-r ../requirements.txt (line 9)) (3.0.43) Requirement already satisfied: pygments in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-console->jupyter->-r ../requirements.txt (line 9)) (2.17.2) Requirement already satisfied: beautifulsoup4 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (4.12.3) Requirement already satisfied: bleach!=5.0.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (5.0.1) Requirement already satisfied: defusedxml in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (0.7.1) Requirement already satisfied: jupyterlab-pygments in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (0.3.0) Requirement already satisfied: mistune<4,>=2.0.3 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (3.0.2) Requirement already satisfied: nbclient>=0.5.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (0.9.0) Requirement already satisfied: nbformat>=5.7 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (5.9.2) Requirement already satisfied: pandocfilters>=1.4.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (1.5.1) Requirement already satisfied: tinycss2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbconvert->jupyter->-r ../requirements.txt (line 9)) (1.2.1) Requirement already satisfied: jupyter-server<3,>=2.4.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from notebook->jupyter->-r ../requirements.txt (line 9)) (2.12.5) Requirement already satisfied: jupyterlab-server<3,>=2.22.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from notebook->jupyter->-r ../requirements.txt (line 9)) (2.25.2) Requirement already satisfied: jupyterlab<5,>=4.0.2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from notebook->jupyter->-r ../requirements.txt (line 9)) (4.0.11) Requirement already satisfied: notebook-shim<0.3,>=0.2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from notebook->jupyter->-r ../requirements.txt (line 9)) (0.2.3) Requirement already satisfied: qtpy>=2.4.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from qtconsole->jupyter->-r ../requirements.txt (line 9)) (2.4.1) Requirement already satisfied: mpmath>=0.19 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from sympy->torch->-r ../requirements.txt (line 10)) (1.3.0) Requirement already satisfied: botocore<1.35.89,>=1.35.74 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from aiobotocore<3.0.0,>=2.5.4->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (1.35.88) Requirement already satisfied: wrapt<2.0.0,>=1.10.10 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from aiobotocore<3.0.0,>=2.5.4->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (1.14.1) Requirement already satisfied: aioitertools<1.0.0,>=0.5.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from aiobotocore<3.0.0,>=2.5.4->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (0.12.0) Requirement already satisfied: aiosignal>=1.1.2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (1.3.1) Requirement already satisfied: attrs>=17.3.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (23.2.0) Requirement already satisfied: frozenlist>=1.1.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (1.4.1) Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (6.0.5) Requirement already satisfied: yarl<2.0,>=1.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (1.9.4) Requirement already satisfied: webencodings in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from bleach!=5.0.0->nbconvert->jupyter->-r ../requirements.txt (line 9)) (0.5.1) Requirement already satisfied: decorator in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipython>=7.23.1->ipykernel->jupyter->-r ../requirements.txt (line 9)) (4.4.2) Requirement already satisfied: jedi>=0.16 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipython>=7.23.1->ipykernel->jupyter->-r ../requirements.txt (line 9)) (0.19.1) Requirement already satisfied: stack-data in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from ipython>=7.23.1->ipykernel->jupyter->-r ../requirements.txt (line 9)) (0.6.3) Requirement already satisfied: platformdirs>=2.5 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel->jupyter->-r ../requirements.txt (line 9)) (4.1.0) Requirement already satisfied: pywin32>=300 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel->jupyter->-r ../requirements.txt (line 9)) (306) Requirement already satisfied: anyio>=3.1.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (4.2.0) Requirement already satisfied: argon2-cffi in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (23.1.0) Requirement already satisfied: jupyter-events>=0.9.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (0.9.0) Requirement already satisfied: jupyter-server-terminals in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (0.5.2) Requirement already satisfied: overrides in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (7.7.0) Requirement already satisfied: prometheus-client in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (0.19.0) Requirement already satisfied: pywinpty in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (2.0.12) Requirement already satisfied: send2trash>=1.8.2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (1.8.2) Requirement already satisfied: terminado>=0.8.3 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (0.18.0) Requirement already satisfied: websocket-client in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (1.7.0) Requirement already satisfied: async-lru>=1.0.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyterlab<5,>=4.0.2->notebook->jupyter->-r ../requirements.txt (line 9)) (2.0.4) Requirement already satisfied: jupyter-lsp>=2.0.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyterlab<5,>=4.0.2->notebook->jupyter->-r ../requirements.txt (line 9)) (2.2.2) Requirement already satisfied: babel>=2.10 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyterlab-server<3,>=2.22.1->notebook->jupyter->-r ../requirements.txt (line 9)) (2.14.0) Requirement already satisfied: json5>=0.9.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyterlab-server<3,>=2.22.1->notebook->jupyter->-r ../requirements.txt (line 9)) (0.9.14) Requirement already satisfied: jsonschema>=4.18.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyterlab-server<3,>=2.22.1->notebook->jupyter->-r ../requirements.txt (line 9)) (4.23.0) Requirement already satisfied: fastjsonschema in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from nbformat>=5.7->nbconvert->jupyter->-r ../requirements.txt (line 9)) (2.19.1) Requirement already satisfied: wcwidth in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from prompt-toolkit>=3.0.30->jupyter-console->jupyter->-r ../requirements.txt (line 9)) (0.2.13) Requirement already satisfied: soupsieve>1.2 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from beautifulsoup4->nbconvert->jupyter->-r ../requirements.txt (line 9)) (2.5) Requirement already satisfied: sniffio>=1.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (1.3.0) Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from botocore<1.35.89,>=1.35.74->aiobotocore<3.0.0,>=2.5.4->s3fs>=2022.11->earthaccess->-r ../requirements.txt (line 14)) (1.0.1) Requirement already satisfied: parso<0.9.0,>=0.8.3 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel->jupyter->-r ../requirements.txt (line 9)) (0.8.3) Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook->jupyter->-r ../requirements.txt (line 9)) (2023.12.1) Requirement already satisfied: referencing>=0.28.4 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook->jupyter->-r ../requirements.txt (line 9)) (0.32.1) Requirement already satisfied: rpds-py>=0.7.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook->jupyter->-r ../requirements.txt (line 9)) (0.17.1) Requirement already satisfied: python-json-logger>=2.0.4 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (2.0.4) Requirement already satisfied: pyyaml>=5.3 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (6.0.2) Requirement already satisfied: rfc3339-validator in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (0.1.4) Requirement already satisfied: rfc3986-validator>=0.1.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (0.1.1) Requirement already satisfied: argon2-cffi-bindings in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from argon2-cffi->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (21.2.0) Requirement already satisfied: executing>=1.2.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyter->-r ../requirements.txt (line 9)) (2.0.1) Requirement already satisfied: asttokens>=2.1.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyter->-r ../requirements.txt (line 9)) (2.4.1) Requirement already satisfied: pure-eval in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyter->-r ../requirements.txt (line 9)) (0.2.2) Requirement already satisfied: fqdn in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (1.5.1) Requirement already satisfied: isoduration in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (20.11.0) Requirement already satisfied: jsonpointer>1.13 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (2.4) Requirement already satisfied: uri-template in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (1.3.0) Requirement already satisfied: webcolors>=24.6.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (24.6.0) Requirement already satisfied: cffi>=1.0.1 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (1.16.0) Requirement already satisfied: pycparser in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (2.22) Requirement already satisfied: arrow>=0.15.0 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (1.3.0) Requirement already satisfied: types-python-dateutil>=2.8.10 in c:\users\timothy do\appdata\local\programs\python\python311\lib\site-packages (from arrow>=0.15.0->isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook->jupyter->-r ../requirements.txt (line 9)) (2.8.19.20240106)
[notice] A new release of pip is available: 24.2 -> 24.3.1 [notice] To update, run: python.exe -m pip install --upgrade pip
# Dependencies
import os
import numpy as np
import matplotlib.pyplot as plt
import cv2 as cv
from tqdm import tqdm
import earthaccess
import h5py
# Helper Functions
def normalize(array):
return (array - array.min())/(array.max()-array.min())
Downloading the Data¶
For processing the light pollution data, we will be using NASA VIIRS DNB. Before proceeding, make sure you have a NASA Earthdata account.
# Creating Directory to Store the Data
dataDir = '../data/lightpollution'
os.makedirs(dataDir,exist_ok=True)
In the earthdata library, you need to log into your NASA Earthdata account.
# Authenticate with your Earthdata Login credentials
logged_in = False
auth = None
attempts = 0
while(not(logged_in)):
attempts += 1
auth = earthaccess.login()
logged_in = auth.authenticated
if(not(logged_in)): print('Login Failed. Try Again.')
if(attempts == 3): break
print(f'Earthdata Logged In: {logged_in}')
Earthdata Logged In: True
results = earthaccess.search_data(
short_name='VNP46A1',
temporal=('2024-12-20','2024-12-20'),
count=1
)
h5files = earthaccess.download(results, dataDir)
QUEUEING TASKS | : 0%| | 0/1 [00:00<?, ?it/s]
PROCESSING TASKS | : 0%| | 0/1 [00:00<?, ?it/s]
COLLECTING RESULTS | : 0%| | 0/1 [00:00<?, ?it/s]
testFile = h5files[0]
with h5py.File(testFile,'r') as f:
print(f['HDFEOS']['GRIDS']['VNP_Grid_DNB']['Data Fields'].keys())
dnb = f['HDFEOS']['GRIDS']['VNP_Grid_DNB']['Data Fields']['DNB_At_Sensor_Radiance_500m'][:].astype(np.float32)
print(f'Radiance Shape: {dnb.shape}')
print(f'Radiance Data Type: {dnb.dtype}')
<KeysViewHDF5 ['BrightnessTemperature_M12', 'BrightnessTemperature_M13', 'BrightnessTemperature_M15', 'BrightnessTemperature_M16', 'DNB_At_Sensor_Radiance_500m', 'Glint_Angle', 'Granule', 'Lunar_Azimuth', 'Lunar_Zenith', 'Moon_Illumination_Fraction', 'Moon_Phase_Angle', 'QF_Cloud_Mask', 'QF_DNB', 'QF_VIIRS_M10', 'QF_VIIRS_M11', 'QF_VIIRS_M12', 'QF_VIIRS_M13', 'QF_VIIRS_M15', 'QF_VIIRS_M16', 'Radiance_M10', 'Radiance_M11', 'Sensor_Azimuth', 'Sensor_Zenith', 'Solar_Azimuth', 'Solar_Zenith', 'UTC_Time']> Radiance Shape: (2400, 2400) Radiance Data Type: float32
plt.figure(figsize=(15,10))
plt.imshow(normalize(dnb),cmap='jet')
plt.title('Radiance')
plt.axis('off')
plt.show()