{"id":19399846,"url":"https://github.com/worldbank/blackmarblepy","last_synced_at":"2025-04-09T23:16:36.830Z","repository":{"id":205004682,"uuid":"710225696","full_name":"worldbank/blackmarblepy","owner":"worldbank","description":"Georeferenced Rasters and Statistics of Nightlights from NASA Black Marble","archived":false,"fork":false,"pushed_at":"2025-04-07T18:11:41.000Z","size":25618,"stargazers_count":42,"open_issues_count":19,"forks_count":12,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-09T23:16:33.555Z","etag":null,"topics":["blackmarble","datapartnership","nasa","nasa-data","nasa-earth-data","nightlights","nighttime-lights","raster-data","viirs","worldbank","zonal-statistics"],"latest_commit_sha":null,"homepage":"https://worldbank.github.io/blackmarblepy/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/worldbank.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-26T09:17:26.000Z","updated_at":"2025-03-19T10:23:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"5ff65221-7f1a-4ae3-91b2-5624a94754db","html_url":"https://github.com/worldbank/blackmarblepy","commit_stats":{"total_commits":135,"total_committers":6,"mean_commits":22.5,"dds":0.5111111111111111,"last_synced_commit":"ff9c83f191b35ed87574555f823bdddaeb70f71d"},"previous_names":["worldbank/blackmarblepy"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fblackmarblepy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fblackmarblepy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fblackmarblepy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fblackmarblepy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/worldbank","download_url":"https://codeload.github.com/worldbank/blackmarblepy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125593,"owners_count":21051771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blackmarble","datapartnership","nasa","nasa-data","nasa-earth-data","nightlights","nighttime-lights","raster-data","viirs","worldbank","zonal-statistics"],"created_at":"2024-11-10T11:11:52.226Z","updated_at":"2025-04-09T23:16:36.806Z","avatar_url":"https://github.com/worldbank.png","language":"Jupyter Notebook","funding_links":[],"categories":["Sustainable Development"],"sub_categories":["Environmental Satellites"],"readme":"# BlackMarblePy\n\n[![License: MPL 2.0](https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)\n[![PyPI version](https://badge.fury.io/py/blackmarblepy.svg)](https://badge.fury.io/py/blackmarblepy)\n[![docs](https://github.com/worldbank/blackmarblepy/actions/workflows/gh-pages.yml/badge.svg)](https://github.com/worldbank/blackmarblepy/actions/workflows/gh-pages.yml)\n[![tests](https://github.com/worldbank/blackmarblepy/actions/workflows/tests.yml/badge.svg)](https://github.com/worldbank/blackmarblepy/actions/workflows/tests.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/worldbank/blackmarblepy/main.svg)](https://results.pre-commit.ci/latest/github/worldbank/blackmarblepy/main)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10667907.svg)](https://zenodo.org/doi/10.5281/zenodo.10667907)\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/worldbank/blackmarblepy/blob/main/notebooks/blackmarblepy.ipynb)\n[![Downloads](https://static.pepy.tech/badge/blackmarblepy)](https://pepy.tech/project/blackmarblepy)\n[![GitHub Repo stars](https://img.shields.io/github/stars/worldbank/blackmarblepy)](https://github.com/worldbank/blackmarblepy)\n\n**BlackMarblePy** is a Python package that provides a simple way to use nighttime lights data from NASA's Black Marble project. [Black Marble](https://blackmarble.gsfc.nasa.gov) is a [NASA Earth Science Data Systems (ESDS)](https://www.earthdata.nasa.gov) project that provides a product suite of daily, monthly and yearly global [nighttime lights](https://www.earthdata.nasa.gov/learn/backgrounders/nighttime-lights). This package automates the process of downloading all relevant tiles from the [NASA LAADS DAAC](https://www.earthdata.nasa.gov/eosdis/daacs/laads) to cover a region of interest, converting the raw files (in HDF5 format), to georeferenced rasters, and mosaicking rasters together when needed.\n\n## Features\n\n- Download *daily*, *monthly*, and *yearly* nighttime lights data for user-specified **region of interest** and **time**.\n- Parallel downloading for faster data retrieval and automatic retry mechanism for handling network errors.\n- Access [NASA Black Marble](https://blackmarble.gsfc.nasa.gov) as a [xarray.Dataset](https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html)\n  - Integrated data visualization with customization options\n    - Choose between various plot types, including bar charts, line graphs, and heatmaps.\n    - Customize plot appearance with color palettes, axes labels, titles, and legends.\n    - Save visualizations as high-resolution images for presentations or reports.\n  - Perform time series analysis on nighttime lights data.\n    - Calculate zonal statistics like mean and sum.\n    - Plot time series of nighttime lights data.\n\n## Documentation\n\nThe [**BlackMarblePy**](https://pypi.org/project/blackmarblepy) library allows you to interact with and manipulate data from NASA's Black Marble, which provides global nighttime lights data. Below is a guide on how to use the key functionalities of the library.\n\n### Installation\n\n**BlackMarblePy** is available on [PyPI](https://pypi.org) as [blackmarblepy](https://pypi.org/project/blackmarblepy) and can installed using `pip`:\n\n#### From PyPI\n\n```shell\npip install blackmarblepy\n```\n\n#### From Source\n\n1. Clone or download this repository to your local machine. Then, navigate to the root directory of the repository:\n\n    ```shell\n    git clone https://github.com/worldbank/blackmarblepy.git\n    cd blackmarblepy\n    ```\n\n2. Create a virtual environment (optional but recommended):\n\n    ```shell\n    python3 -m venv venv\n    source venv/bin/activate  # On Windows, use `venv\\Scripts\\activate`\n    ```\n\n3. Install the package with dependencies:\n\n    ```shell\n    pip install .\n    ```\n\n    Install the package **in editable** mode with dependencies:\n\n    ```shell\n    pip install -e .\n    ```\n\n    The `-e` flag stands for \"editable,\" meaning changes to the source code will immediately affect the installed package.\n\n#### Building Documentation Locally\n\nTo build the documentation locally, after (1) and (2) above, please follow these steps:\n\n- Install the package with documentation dependencies:\n\n  ```shell\n    pip install -e .[docs]\n  ```\n\n- Build the documentation:\n\n  ```shell\n    sphinx-build docs _build/html -b html\n  ```\n\nThe generated documentation will be available in the `_build/html` directory. Open the `index.html` file in a web browser to view it.\n\n### Usage\n\nBefore downloading and extracting Black Marble data, define the [NASA LAADS archive](https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/5000/VNP46A3/) `bearer` token, and define a region of interest (i.e., `gdf` as a [`geopandas.GeoDataFrame`](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.html)).\n\n```python\nfrom blackmarble.raster import bm_raster\n\n# Retrieve VNP46A2 for date range into a Xarray Dataset\ndaily = bm_raster(\n    gdf,\n    product_id=\"VNP46A2\",\n    date_range=pd.date_range(\"2022-01-01\", \"2022-03-31\", freq=\"D\"),\n    bearer=bearer,\n)\n```\n\nFor more detailed information and examples, please refer to the [examples](https://worldbank.github.io/blackmarblepy/notebooks/blackmarblepy.html).\n\n### Full API Reference\n\nFor a full reference of all available functions and their parameters, please refer to the [official documentation](api/blackmarble.rst).\n\n## Contributing\n\nWe welcome contributions to improve this documentation. If you find errors, have suggestions, or want to add new content, please follow our [contribution guidelines](CONTRIBUTING.md).\n\n### Feedback and Issues\n\nIf you have any feedback, encounter issues, or want to suggest improvements, please [open an issue](https://github.com/worldbank/blackmarblepy/issues).\n\n### Versioning\n\n[![CalVer](https://img.shields.io/badge/calver-YY.0M.MICRO-22bfda.svg)](https://calver.org)\n\nThis project follows the [CALVER](https://calver.org) (Calendar Versioning) scheme for versioning. If you have any questions or need more information about our versioning approach, feel free to ask.\n\n### Contributors\n\nThis project follows the [all-contributors](https://allcontributors.org) specification.\nContributions of any kind are welcome!\n\n\u003ca href=\"https://orcid.org/0000-0001-6530-3780\"\u003e\nGabriel Stefanini Vicente\n\u003cimg alt=\"ORCID logo\" src=\"https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png\" width=\"16\" height=\"16\" /\u003e\n\u003c/a\u003e\n\u003cbr\u003e\n\u003ca href=\"https://orcid.org/0000-0002-3164-3813\"\u003e\nRobert Marty\n\u003cimg alt=\"ORCID logo\" src=\"https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png\" width=\"16\" height=\"16\" /\u003e\n\u003c/a\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## Citation\n\nWhen using **BlackMarblePy**, your support is much appreciated! Please consider using the following citation or download [bibliography.bib](https://raw.githubusercontent.com/worldbank/blackmarblepy/main/docs/bibliography.bib):\n\n```bibtex\n@misc{blackmarblepy,\n  title = {{BlackMarblePy: Georeferenced Rasters and Statistics of Nighttime Lights from NASA Black Marble}},\n  author = {Gabriel {Stefanini Vicente} and Robert Marty},\n  year = {2023},\n  howpublished = {\\url{https://worldbank.github.io/blackmarblepy}},\n  doi = {10.5281/zenodo.10667907},\n  url = {https://worldbank.github.io/blackmarblepy},\n}\n```\n\n{cite:empty}`blackmarblepy`\n\n```{bibliography}\n:filter: docname in docnames\n:style: plain\n```\n\n## License\n\nThis projects is licensed under the [**Mozilla Public License**](https://opensource.org/license/mpl-2-0/) - see the **LICENSE** file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldbank%2Fblackmarblepy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworldbank%2Fblackmarblepy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldbank%2Fblackmarblepy/lists"}