Retrieval¶
BlackMarbleRetriever
¶
An Earth Engine retriever for NASA's Black Marble NTL product suite.
get_data(product, start_date, end_date, region, bands=None, chunks='auto', scale=None)
¶
Retrieves Black Marble data from Earth Engine into an xarray dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product
|
Literal['VNP46A1', 'VNP46A2', 'NOAA/VIIRS/DNB/ANNUAL_V22']
|
The product name (e.g., 'VNP46A2', 'VNP46A4'). |
required |
start_date
|
str
|
The start date string (e.g., '2021-01-01'). |
required |
end_date
|
str
|
The end date string (e.g., '2025-01-01'). |
required |
region
|
Geometry
|
The spatial bounding area explicitly as an ee.Geometry. |
required |
bands
|
List[str] | None
|
An optional list of specific bands to select. |
None
|
chunks
|
Any
|
Chunk size or scheme for the resulting xarray dataset. Defaults to "auto". |
'auto'
|
scale
|
float | None
|
Spatial resolution in degrees. Defaults to native scale (approx 15 arc-seconds). |
None
|
Returns:
| Type | Description |
|---|---|
Dataset
|
An xarray Dataset containing the requested data. |
bbox_to_geometry(bbox)
¶
Converts a bounding box list or tuple to an Earth Engine Geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox
|
List[float] | Tuple[float, ...]
|
A list or tuple of 4 floats [min_lon, min_lat, max_lon, max_lat]. |
required |
Returns:
| Type | Description |
|---|---|
Geometry
|
An ee.Geometry.BBox object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the bounding box does not contain exactly 4 elements. |
gdf_to_geometry(gdf)
¶
Convert a GeoPandas GeoDataFrame to an Earth Engine Geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gdf
|
GeoDataFrame
|
A GeoDataFrame containing the spatial data to convert. |
required |
Returns:
| Type | Description |
|---|---|
Geometry
|
An ee.Geometry object representing the combined geometries of the dataframe. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the GeoDataFrame is empty. |
geojson_to_gdf(geojson_dict, epsg=4326)
¶
Converts a GeoJSON dictionary into a GeoPandas GeoDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geojson_dict
|
Dict[str, Any]
|
Dictionary representing a GeoJSON FeatureCollection or Feature. |
required |
epsg
|
int
|
The EPSG code for the coordinate reference system. Defaults to 4326. |
4326
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
A GeoDataFrame containing the parsed spatial data. |
geojson_to_geometry(geojson)
¶
Converts a GeoJSON dictionary to an Earth Engine Geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geojson
|
Dict[str, Any]
|
A dictionary representing a GeoJSON FeatureCollection or Polygon. |
required |
Returns:
| Type | Description |
|---|---|
Geometry
|
An ee.Geometry or ee.FeatureCollection geometry object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the GeoJSON format is unrecognized. |
geometry_to_gdf(ee_geom)
¶
Convert an Earth Engine geometry to a GeoDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ee_geom
|
The Earth Engine geometry to convert. |
required |
Returns:
| Type | Description |
|---|---|
|
A GeoDataFrame containing the converted geometry with WGS84 CRS. |