Analysis Tasks¶
ecoscope.platform.tasks.analysis ¶
Classes¶
TimeDensityReturnGDFSchema ¶
Functions:¶
aggregate_over_rows ¶
aggregate_over_rows(df: AnyDataFrame, agg_ops: Annotated[AggOperations, Field(description='The parameters that define how to calculate summary statistics.')], output_column: Annotated[str, Field(description='The output column name.')], columns: Annotated[list[str], Field(description='The list of columns.')]) -> AnyDataFrame
Source code in ecoscope/platform/tasks/analysis/_summary.py
apply_arithmetic_operation ¶
apply_arithmetic_operation(a: Annotated[float | int, Field(description='The first number')], b: Annotated[float | int, Field(description='The second number')], operation: Annotated[Operations, Field(description='The arithmetic operation to apply')]) -> Annotated[float | int, Field(description='The result of the arithmetic operation')]
Source code in ecoscope/platform/tasks/analysis/_aggregation.py
apply_arithmetic_operation_over_rows ¶
apply_arithmetic_operation_over_rows(df: AnyDataFrame, column_a: Annotated[str, Field(description='The first column name')], column_b: Annotated[str, Field(description='The second column name')], output_column: Annotated[str, Field(description='The output column name')], operation: Annotated[Operations, Field(description='The arithmetic operation to apply')]) -> AnyDataFrame
Source code in ecoscope/platform/tasks/analysis/_aggregation.py
calculate_elliptical_time_density ¶
calculate_elliptical_time_density(trajectory_gdf: TrajectoryAnnotation, auto_scale_or_custom_cell_size: AutoScaleOrCustomAnnotation = None, crs: CrsAnnotation = 'EPSG:3857', nodata_value: NoDataAnnotation = 'nan', band_count: BandCountAnnotation = 1, max_speed_factor: MaxSpeedFactorAnnotation = 1.05, expansion_factor: ExpansionFactorAnnotation = 1.3, percentiles: EtdPercentileAnnotation = None) -> DataFrame[TimeDensityReturnGDFSchema]
Source code in ecoscope/platform/tasks/analysis/_time_density.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
calculate_feature_density ¶
calculate_feature_density(geodataframe: Annotated[AnyGeoDataFrame, Field(description='The feature data to count or sum per grid cell.', exclude=True)], meshgrid: Annotated[AnyGeoDataFrame, Field(description='The grid cells used to aggregate the feature data.', exclude=True)], geometry_type: Annotated[Literal['point', 'line'], Field(description='The geometry type of the provided geodataframe')], sum_column: Annotated[str | SkipJsonSchema[None], Field(description='Sum values in this column per grid cell, rather than counting rows')] = None) -> AnyGeoDataFrame
Count features or sum column values per grid cell.
Source code in ecoscope/platform/tasks/analysis/_calculate_feature_density.py
calculate_linear_time_density ¶
calculate_linear_time_density(trajectory_gdf: TrajectoryAnnotation, meshgrid: MeshGridAnnotation, percentiles: LtdPercentileAnnotation = None) -> AnyGeoDataFrame
Source code in ecoscope/platform/tasks/analysis/_time_density.py
create_meshgrid ¶
create_meshgrid(aoi: AoiAnnotation, auto_scale_or_custom_cell_size: AutoScaleOrCustomAnnotation = None, crs: CrsAnnotation = 'EPSG:3857', intersecting_only: IntersectingOnlyAnnotation = False) -> AnyGeoDataFrame
Create a grid from the provided area of interest.
Source code in ecoscope/platform/tasks/analysis/_create_meshgrid.py
dataframe_column_first_unique ¶
dataframe_column_first_unique(df: AnyDataFrame, column_name: ColumnName) -> Annotated[int, Field(description='The first unique value in the column')]
dataframe_column_max ¶
dataframe_column_max(df: AnyDataFrame, column_name: ColumnName) -> Annotated[float, Field(description='The max of the column')]
dataframe_column_mean ¶
dataframe_column_mean(df: AnyDataFrame, column_name: ColumnName) -> Annotated[float, Field(description='The mean of the column')]
dataframe_column_min ¶
dataframe_column_min(df: AnyDataFrame, column_name: ColumnName) -> Annotated[float, Field(description='The min of the column')]
dataframe_column_nunique ¶
dataframe_column_nunique(df: AnyDataFrame, column_name: ColumnName) -> Annotated[int, Field(description='The number of unique values in the column')]
dataframe_column_percentile ¶
dataframe_column_percentile(df: AnyDataFrame, column_name: ColumnName, percentile: float) -> Annotated[int, Field(description='The percentile to calculate (e.g., 50 for median, 90 for 90th percentile).')]
Source code in ecoscope/platform/tasks/analysis/_aggregation.py
dataframe_column_sum ¶
dataframe_column_sum(df: AnyDataFrame, column_name: ColumnName) -> Annotated[float, Field(description='The sum of the column')]
dataframe_count ¶
dataframe_count(df: AnyDataFrame) -> Annotated[int, Field(description='The number of rows in the DataFrame')]
get_night_day_ratio ¶
get_night_day_ratio(df: AnyGeoDataFrame) -> Annotated[float, Field(description='Night/Day ratio')]
Source code in ecoscope/platform/tasks/analysis/_aggregation.py
summarize_df ¶
summarize_df(df: AnyDataFrame, summary_params: Annotated[list[SummaryParam], Field(description='The parameters that define how to calculate summary statistics.')], groupby_cols: Annotated[list[str] | SkipJsonSchema[None], Field(default=None, description='The columns to group by. If None, the summary is calculated for the entire DataFrame.')] = None, reset_index: Annotated[bool | SkipJsonSchema[None], AdvancedField(default=False, description='Whether to reset the dataframe index after summarizing.')] = False) -> Annotated[AnyDataFrame, Field(description='Summary Table')]