API Python
Documentação detalhada de todos os métodos presentes na biblioteca
Cbers4aAPI
The CBERS4A API class. Query, download or transform data from CBERS-4A STAC API.
| Parameters: |
|
|---|
query(location, initial_date, end_date, cloud, limit, collections)
staticmethod
Query Images from INPE's catalog
| Parameters: |
|
|---|
Notes:
Location:
- Bounding box: location=[-0.5, 1.0, 0.5, -0.5]
- Polygon shape from shapely
- Path and row respectively: location=(225,75)
Initial and end dates:
- Use date object from datetime library: datetime.date(2021,05,25)
- Caution to end date always be bigger than initial date
- e.g. initial_date=datetime.date(2021,08,15)
Cloud coverage:
- Search for scenes less or equal (<=) cloud coverage percentage.
- e.g. cloud=70
- Must be between 0 and 100.
Limit:
- Values greater than 0.
- e.g. limit=500.
Collections:
- Use the collections enum via from cbers4asat import Collections as col
- Available collections from INPE catalog https://www.dgi.inpe.br/catalogo/explore
- Always an array of collections name.
- e.g. [col.AMAZONIA1_WFI_L2_DN] or [col.AMAZONIA1_WFI_L2_DN, col.CBERS4A_WPM_L4_DN] etc.
| Returns: |
|
|---|
Raises: Exception: If any input is invalid.
query_by_id(scene_id, collection)
staticmethod
Search a product by id
| Parameters: |
|
|---|
Returns: dict: Dict with GeoJSON-like format
download(products, bands, threads=cpu_count(), outdir=getcwd(), with_folder=False, with_metadata=False)
Download bands from all given scenes
| Parameters: |
|
|---|
Examples: - download(my_query_result, ['red', 'green'], 3, './downlaods', true) - download(my_query_result, ['red'], outdir='./downloads', with_folder=true) - download(my_query_result, ['blue'], with_metadata=True) Returns: GeoTIFF files
to_geodataframe(products)
staticmethod
Transform products list to a GeoDataFrame
| Parameters: |
|
|---|
Returns: GeoDataFrame of products.
Tools
rgbn_composite(red, green, blue, nir=None, outdir=getcwd(), filename='rgbn_composite.tif')
Stack bands
| Parameters: |
|
|---|
Returns: GeoTIFF file
pansharpening(panchromatic=None, multispectral=None, outdir=getcwd(), filename='pansharp.tif')
Pansharpen multispectral file
| Parameters: |
|
|---|
Returns: GeoTIFF file
clip(raster, mask, outdir=getcwd(), filename='raster_clip.tif', **kwargs)
Clip raster
| Parameters: |
|
|---|
Returns: GeoTIFF file
grid_download(satellite='cbers4a', sensor='mux', outdir=getcwd())
Download path and row grid from CBERS-04A and AMAZONIA1
| Parameters: |
|
|---|
Examples: - grid_download("cbers4a", "mux") - grid_download(satellite="amazonia1", "wfi", outdir="./downloads") Returns: .kmz file
read_geojson(geojson_file)
Read a GeoJSON file into a GeoJSON object.
| Parameters: |
|
|---|
Returns: GeoJson object