Skip to main content

Georeferenced Rasters of Nighttime Lights from NASA Black Marble data

Project description

BlackMarblePy

PyPI version docs downloads GitHub Repo stars activity License: MIT

BlackMarblePy is a Python package that provides a simple way to use nighttime lights data from NASA's Black Marble project. Black Marble is a NASA Earth Science Data Systems (ESDS) project that provides a product suite of daily, monthly and yearly global nighttime lights. This package automates the process of downloading all relevant tiles from the NASA LAADS DAAC to cover a region of interest, converting the raw files (in HDF5 format), to georeferenced rasters, and mosaicing rasters together when needed.

Features

  • Download daily, monthly, and yearly nighttime lights data for user-specified region of interest and time.
  • Parallel downloading for faster data retrieval and automatic retry mechanism for handling network errors.
  • Access NASA Black Marble as a Xarray Dataset
    • Integrated data visualization with customization options
      • Choose between various plot types, including bar charts, line graphs, and heatmaps.
      • Customize plot appearance with color palettes, axes labels, titles, and legends.
      • Save visualizations as high-resolution images for presentations or reports.
    • Perform time series analysis on nighttime lights data.
      • Calculate zonal statistics like mean and sum.
      • Plot time series of nighttime lights data.

Installation

BlackMarblePy is available on PyPI as blackmarblepy and can installed using pip:

pip install blackmarblepy

Usage

Before downloading and extracting Black Marble data, define the NASA LAADS archive bearer token, and define a region of interest (i.e., gdf as a geopandas.GeoDataFrame).

from blackmarble.raster import bm_raster

# Raster stack of daily data
date_range = pd.date_range("2022-01-01", "2022-03-31", freq="D")

# Retrieve VNP46A2 for date range into a Xarray Dataset
daily = bm_raster(
    gdf,
    product_id="VNP46A2",
    date_range=date_range,
    bearer=bearer,
)

For more detailed information and examples, please refer to the documentation.

Contributing

Contributions are welcome! If you'd like to contribute, please follow our contribution guidelines.

Contributors

Gabriel Stefanini Vicente ORCID logo
Robert Marty ORCID logo

Citation

When using BlackMarblePy, your support is much appreciated! Please consider using the following citation or download bibliography.bib:

@misc{blackmarblepy,
  title = {{BlackMarblePy: Georeferenced Rasters and Statistics of Nighttime Lights from NASA Black Marble}},
  author = {Gabriel {Stefanini Vicente} and Robert Marty},
  year = {2023},
  note = {{BlackMarblePy} v0.2.2},
  url = {https://worldbank.github.io/blackmarblepy},
}

{cite:empty}blackmarblepy

:filter: docname in docnames
:style: plain

License

This project is open-source - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blackmarblepy-0.2.2.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blackmarblepy-0.2.2-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file blackmarblepy-0.2.2.tar.gz.

File metadata

  • Download URL: blackmarblepy-0.2.2.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for blackmarblepy-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3806f5e2d1edd5c16dbf59377629c31d2ae27e0cdea8b097f05632e17b91e495
MD5 e2760616d59dcc107f969b6d3ff1a917
BLAKE2b-256 a5a70c75129d4d7ac9be397b553e2b0a2d645b989e302da1cba238c6001c85d9

See more details on using hashes here.

File details

Details for the file blackmarblepy-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: blackmarblepy-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for blackmarblepy-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fae5580fb2ab84a6430d3d062e5b175f85e437fb89ecdc3c26d2e6553297e5e4
MD5 b8f2fe94141aa6fe3ab2cf3265c17e40
BLAKE2b-256 94bb5e26a18e7ef064a326a35949a74decfcbd4ab339b5e4ab41850633579207

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page