gfwapiclient.resources.fourwings.resources

Global Fishing Watch (GFW) API Python Client - 4Wings Report API Resource.

Module Contents

Classes

FourWingsResource

4Wings data API resource.

Data

API

gfwapiclient.resources.fourwings.resources.__all__ = ['FourWingsResource']
class gfwapiclient.resources.fourwings.resources.FourWingsResource(*, http_client: gfwapiclient.http.client.HTTPClient)

Bases: gfwapiclient.http.resources.BaseResource

4Wings data API resource.

This resource provides methods to interact with the 4Wings API, specifically for generating reports.

Initialization

Initialize a new BaseResource.

Args:
http_client (HTTPClient):

The HTTP client to send requests.

async create_report(*, spatial_resolution: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportSpatialResolution, str]] = None, group_by: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportGroupBy, str]] = None, temporal_resolution: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportTemporalResolution, str]] = None, datasets: Optional[Union[List[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportDataset], List[str]]] = None, filters: Optional[List[str]] = None, start_date: Optional[Union[datetime.date, str]] = None, end_date: Optional[Union[datetime.date, str]] = None, spatial_aggregation: Optional[bool] = None, geojson: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsGeometry, Dict[str, Any]]] = None, region: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportRegion, Dict[str, Any]]] = None, **kwargs: Dict[str, Any]) gfwapiclient.resources.fourwings.report.models.response.FourWingsReportResult

Create 4Wings report for a specified region.

Generates a report from the 4Wings API based on the provided parameters.

Args:
spatial_resolution (Optional[Union[FourWingsReportSpatialResolution, str]]):

Spatial resolution of the report. Defaults to HIGH. Allowed values: HIGH, LOW. Example: “LOW”.

group_by (Optional[Union[FourWingsReportGroupBy, str]]):

Grouping criteria for the report. Allowed values: VESSEL_ID, FLAG, GEARTYPE, FLAGANDGEARTYPE, MMSI. Example: “FLAG”.

temporal_resolution (Optional[Union[FourWingsReportTemporalResolution, str]]):

Temporal resolution of the report. Defaults to HOURLY Allowed values: HOURLY, DAILY, MONTHLY, YEARLY, ENTIRE. Example: “MONTHLY”.

datasets (Optional[Union[List[FourWingsReportDataset], List[str]]]):

Datasets to include in the report. Defaults to public-global-fishing-effort:latest. Allowed values: public-global-fishing-effort:latest, public-global-sar-presence:latest. Example: [“public-global-fishing-effort:latest”].

filters (Optional[List[str]]):

Filters to apply to the report. Example: [“flag in (‘ESP’, ‘FRA’)].

start_date (Optional[Union[datetime.date, str]]):

Start date for the report. Used to build date_range. Example: datetime.date(2021, 1, 1) or “2021-01-01”.

end_date (Optional[Union[datetime.date, str]]):

End date for the report. Used to build date_range. Example: datetime.date(2021, 1, 15) or “2021-01-15”.

spatial_aggregation (Optional[bool]):

Whether to spatially aggregate the report. Example: True.

geojson (Optional[Union[FourWingsGeometry, Dict[str, Any]]]):

GeoJSON geometry to filter the report. Example: {“type”: “Polygon”, “coordinates”: […]}.

region (Optional[Union[FourWingsReportRegion, Dict[str, Any]]]):

Region information to filter the report. Example: {“dataset”: “public-eez-areas”, “id”: “5690”}.

**kwargs (Dict[str, Any]):

Additional keyword arguments.

Returns:
FourWingsReportResult:

The generated 4Wings report.

Raises:
GFWAPIClientError:

If the API request fails.

RequestParamsValidationError:

If the request parameters are invalid.

RequestBodyValidationError:

If the request body is invalid.

_prepare_create_report_request_body(*, geojson: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsGeometry, Dict[str, Any]]] = None, region: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportRegion, Dict[str, Any]]] = None) gfwapiclient.resources.fourwings.report.models.request.FourWingsReportBody

Prepare request body for the 4Wings report endpoint.

_prepare_create_report_request_params(*, spatial_resolution: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportSpatialResolution, str]] = None, group_by: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportGroupBy, str]] = None, temporal_resolution: Optional[Union[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportTemporalResolution, str]] = None, datasets: Optional[Union[List[gfwapiclient.resources.fourwings.report.models.request.FourWingsReportDataset], List[str]]] = None, filters: Optional[List[str]] = None, start_date: Optional[Union[datetime.date, str]] = None, end_date: Optional[Union[datetime.date, str]] = None, spatial_aggregation: Optional[bool] = None) gfwapiclient.resources.fourwings.report.models.request.FourWingsReportParams

Prepare request parameters for the 4Wings report endpoint.

_prepare_create_report_date_range_request_param(*, start_date: Optional[Union[datetime.date, str]] = None, end_date: Optional[Union[datetime.date, str]] = None) Optional[str]

Prepare and return date_range request parameter.