fweather API
- fweather.fweather_data_cube.data_cube(stac_url, collection, start_date, end_date, tile=None, bbox=None, freq=None, bands=None, geom=None)[source]
Create a virtual data cubes using SpatioTemporal Asset Catalog (STAC).
- Parameters:
stac_url (str) – URL endpoint of the STAC API to query.
collection (str) – STAC collection identifier to retrieve data from.
start_date (str) – Start date for temporal filtering in ‘YYYY-MM-DD’ format.
end_date (str) – End date for temporal filtering in ‘YYYY-MM-DD’ format.
bbox (str/list, optional) – Bounding box coordinates for spatial filtering. Can be a string of comma-separated values or a list [minx, miny, maxx, maxy]. Defaults to None.
bands (list) – List of spectral band identifiers to include. Defaults to None.
geom (str/dict, optional) – GeoJSON geometry for spatial filtering. Defaults to None.
Example
>>> prec_merge_cube = data_cube( ... stac_url=stac_url, ... collection="prec_merge_daily-1", ... start_date="2024-01-01", ... end_date="2024-12-31", ... bbox="-47.2797,-17.0725,-45.4779,-15.4485", ... bands=["merge_daily"] ... )
- fweather.fweather_get_timeseries.get_timeseries(stac_url, collection, start_date, end_date, band, geom)[source]
Retrieve time series data for a specific band at given geographic locations.
- Parameters:
stac_url (str) – URL endpoint of the STAC API to query.
collection (str) – STAC collection identifier to retrieve data from.
start_date (str) – Start date for temporal filtering in ‘YYYY-MM-DD’ format.
end_date (str) – End date for temporal filtering in ‘YYYY-MM-DD’ format.
band (str) – Spectral band identifier for which to retrieve time series data.
geom (list) – List of point geometries as dictionaries with ‘coordinates’ key, where each dictionary contains coordinates as [longitude, latitude].
Example
>>> ts = get_timeseries( ... stac_url=stac_url, ... collection="samet_daily-1", ... start_date="2024-01-01", ... end_date="2024-12-31", ... band="tmean", ... geom=[dict(coordinates=[-11.739, -45.753])], ... )
- fweather.fweather_collection_get_list.collection_get_list(stac, datacube)[source]
Query a STAC catalog and retrieve asset URLs for specified bands within a spatiotemporal extent.
- Parameters:
stac (object) – An initialized STAC client connection to the catalog API.
datacube (dict) – Dictionary containing query parameters with the following keys: collection (str): STAC collection identifier to search within. bbox (list/tuple): Bounding box coordinates [minx, miny, maxx, maxy] for spatial filtering. start_date (str): Start date for temporal filtering in ‘YYYY-MM-DD’ format. end_date (str): End date for temporal filtering in ‘YYYY-MM-DD’ format. bands (list): List of band identifiers to retrieve asset URLs for.
- Returns:
- A dictionary where each key is a band identifier and the value is a list
of asset URLs (hrefs) for that band across all matching scenes.
- Return type:
dict
- fweather.fweather_utils.get_all_bands_configs()[source]
Get all cloud configurations.
- Returns:
Dictionary of all cloud configurations
- fweather.fweather_core.geometry_collides_with_bbox(geometry, input_bbox)[source]
Check if a Shapely geometry collides with a bounding box.
- Parameters:
geometry – A Shapely geometry object (Polygon, LineString, Point, etc.)
input_bbox – A tuple in (minx, miny, maxx, maxy) format
- Returns:
True if the geometry intersects with the bbox, False otherwise
- Return type:
bool
- fweather.fweather_load_xarray.load_xarray(filename, decode_times=False)[source]
Load an xarray dataset or data array from a file, with optional time decoding.
- Parameters:
filename (str) – Path to the input file to load.
decode_times (bool, optional) – Whether to decode time variables in the dataset. Set to False for performance when time decoding is not needed. Defaults to False.
- Returns:
Loaded xarray object. Returns a DataArray if the file was originally saved as a DataArray with the ‘_xarray_type’ attribute, otherwise returns a Dataset.
- Return type:
xarray.Dataset