Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate covariates #89

Open
ethanplunkett opened this issue May 11, 2023 · 0 comments
Open

Calculate covariates #89

ethanplunkett opened this issue May 11, 2023 · 0 comments

Comments

@ethanplunkett
Copy link
Contributor

calc_covariate()

calc_covariate() summarizes the conditions a Bird would have experienced prior to an observation. It uses BirdFlow models to calculate covariates for use in other models from a spatial dataset, observation location, observation date, and a covariate (or initial) date that is earlier than the observation date. The function would then calculate a probably distribution at the covariate date by calling predict() back in time, and then average a raster covariate dataset using weights from that distribution.
calc_covariate(bf, obs_x, obs_y, obs_date, cov_date, covariate)
Arguments:
bf - a BirdFlow model
obs_x, obs_y, location of one or more observations for which the covariates are to calculated.
obs_date The date (probably only one allowed) of the observations.
cov_date The date (prior to obs_date) for which the covariates are to be calculated
covariate - spatial dataset (a terra::spatrast) containing the covariate data for the cov_date.

Note: it would probably be nice to allow obs_date to vary and maybe replace cov_date with lag (in weeks) such that you could easily calculate covariates for observations that vary in time based on a constant lag. That would require that covariate also cover multiple points in time and might get logistically challenging. A function that worked with a predetermined dataset could hide those complications from the user (see below).

calc_climate_covariate()

This would be a variant on calc_covariate() tailored to specific datasets. It would calculate the spatial extent and times for which it needs covariate data and then download that data from an API and use it to calculate the covariates. The dataset selection should be driven by a use case and doesn't need to be climate related. Using the climate example it might look like:
calc_climate_covariate(bf, obs_x, obs_y, obs_date, lag, covariates)
Arguments
bf - a BirdFlow model
obs_x, obs_y, location of one or more observations for which the covariates are to calculated.
obs_date The dates associated with the observations.
lag The lag (in weeks) prior to obs_date for which the covariates will be calculated.
covariates - names of covariates from a list of datasets the function can handle.

Covariate spatial data sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant