birdflow-science / BirdFlowR

BirdFlow R Package
https://birdflow-science.github.io/BirdFlowR/
MIT License
10 stars 2 forks source link

Bird flux #123

Open ethanplunkett opened 12 months ago

ethanplunkett commented 12 months ago

Currently all our modelling is based on stopping locations. However, with big movements many birds may pass over cells without stopping. To answer the question how many birds pass through a cell (or approximation of one) in a given week we would sum the density of not just the birds that stop or start from that cell but also any birds that, in that week's movement, pass through the cell.

To approximate this we'd first build a n x n x n array where n is n_active() the first dimension is the starting location index, the second dimension is the ending location index, and the third dimensions is touched locations. Cell values would be TRUE if the location indicated by the third dimension is on the path between the first and second dimension. "Touching" would be defined here as the cell center being within 1/2 the cell width of the line. This is equivalent to drawing a circle within each square cell that touches the four sides and seeing if the line touches or crosses through that circle.

We could then, for any given timestep, determine the total density that enters, leaves, or passes through each cell: the bird flux.

We could also calculate a density weighted average vector for all the birds that pass through the cell. I think we'd want to include stationary birds in this calculation too.

slager commented 12 months ago

How would flux estimates work for species where many tracks cross the ocean? For some bird species, ocean crossings and/or non-straight-line migration trajectories are the norm, so being able to calculate fluxes across our grid seems tricky at best.

dsheldon commented 12 months ago

I suggest having a parameter that allows the circle radius (around the center point of the cell) to be different from the grid cell size and then dividing by the length and time units so the measurement has units

birds / km / hr

This matches with the standard "migration traffic rate (MTR)" used in radar analysis. This will help decouple the measurement from the grid dimensions and give a measurement that can be thought of as a pointwise measurement of traffic near a location.

ethanplunkett commented 12 months ago

It's dependent on the assumption that migration between stops is linear so will be less accurate when that assumption isn't met but I still think it would be useful.

Good point @slager that birds cross cells that aren't active in our model, output should probably be for all cells in the extent not just active cells, so the logical array"s third dimension would be nrow(bf) x ncol(bf). For efficiency it could be trimmed down to the subset of cells that are crossed with a mask made just for that purpose.

ethanplunkett commented 12 months ago

@dsheldon that seems reasonable but requires a total population estimate to convert between density and number of birds. We don't currently have that in the species information.

dsheldon commented 12 months ago

We can keep the numerator in units of fraction of the population, then let users convert if they want to hazard a guess at the total population. This is consistent with radar work, where the density is proportional to the number of birds through difficult-to-estimate constants.

ethanplunkett commented 4 months ago

Figure out how to summarize direction too. Perhaps in directional bins, perhaps as a mean and SD.

ethanplunkett commented 4 months ago

Use great circle distances and spherical coordinates.

ethanplunkett commented 4 months ago

@dsheldon Do you think we should count arriving birds, departing birds, and birds passing overhead? I see arguments for:

  1. Only count the birds passing overhead as (maybe) this is what Radar is most likely to pick up on.
  2. Count passing overhead and one of the other two as counting both arriving and departing double counts those birds.
  3. Count arriving, departing, and passing overhead as that's the sum total of movement at the given point for the transition.

As I've implemented it the user can input points or if they don't all cells in the BirdFlow raster extent that are active OR fall between active cells are used as the points. Thus with the defaults behavior the points fall on the center of BirdFlow cells. When the user submits arbitrary points (say radar station locations) then it is less clear what (1) and (2) mean, but we could look up the cells that the points fall within and exclude them in the betweenness array.

For now I'm proceeding with (3) but it's easy to change.

ethanplunkett commented 4 months ago

Preliminary non-directional flux (maybe "net migration" is a better term for this?):

image

For American Woodcock based on BirdFlowModels::amewoo

dsheldon commented 4 months ago

Regarding your previous question: I support counting birds that arrive or depart in addition to passing over, as they would appear airborne in the circle of specified radius.

I would not count birds that start and end in a cell that intersects with the circle, as the mostly likely situation is that those birds are not migrating.

ethanplunkett commented 3 months ago

Note #176 includes non-directional flux only.

ethanplunkett commented 3 months ago

Flux to do: