Package: blackmarblepy
BlackMarblePyBlackMarblePyis a Python package that provides a simple way to use nighttime lights data from NASA's Black Marble project.Black Marbleis aNASA Earth Science Data Systems (ESDS)project that provides a product suite of daily, monthly and yearly globalnighttime lights. This package automates the process of downloading all relevant tiles from theNASA LAADS DAACto cover a region of interest, converting the raw files (in HDF5 format), to georeferenced rasters, and mosaicing rasters together when needed.FeaturesDownload 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 DatasetIntegrated data visualization with customization optionsChoose 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.InstallationBlackMarblePyis available onPyPIasblackmarblepyand can installed usingpip:From PyPIpipinstallblackmarblepyFrom SourceClone or download this repository to your local machine. Then, navigate to the root directory of the repository:gitclonehttps://github.com/worldbank/blackmarblepy.gitcdblackmarblepyCreate a virtual environment (optional but recommended):python3-mvenvvenvsourcevenv/bin/activate# On Windows, use `venv\Scripts\activate`Install the package with dependencies:pipinstall.Install the packagein editablemode with dependencies:pipinstall-e.The-eflag stands for "editable," meaning changes to the source code will immediately affect the installed package.this is a fdsBuilding Documentation LocallyTo build the documentation locally, after (1) and (2) above, please follow these steps:Install the package with documentation dependencies:pipinstall-e.[docs]Build the documentation:msphinx-builddocs_build/html-bhtmlThe generated documentation will be available in the_build/htmldirectory. Open theindex.htmlfile in a web browser to view it.UsageBefore downloading and extracting Black Marble data, define theNASA LAADS archivebearertoken, and define a region of interest (i.e.,gdfas ageopandas.GeoDataFrame).fromblackmarble.rasterimportbm_raster# Retrieve VNP46A2 for date range into a Xarray Datasetdaily=bm_raster(gdf,product_id="VNP46A2",date_range=pd.date_range("2022-01-01","2022-03-31",freq="D"),bearer=bearer,)For more detailed information and examples, please refer to thedocumentation.ContributingWe welcome contributions to improve this documentation. If you find errors, have suggestions, or want to add new content, please follow ourcontribution guidelines.Feedback and IssuesIf you have any feedback, encounter issues, or want to suggest improvements, pleaseopen an issue.ContributorsGabriel Stefanini VicenteRobert MartyCitationWhen usingBlackMarblePy, your support is much appreciated! Please consider using the following citation or downloadbibliography.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.3},url={https://worldbank.github.io/blackmarblepy},}{cite:empty}blackmarblepy:filter: docname in docnames
:style: plainLicenseThis projects is licensed under theMozilal Public License- see theLICENSEfile for details.