Code
Public R and Python packages, installable and documented. Each runs on any dataset in the documented shape — not only mine.
All of these install from GitHub and run on other people’s data — none hard-code my study system. Each does one part of the chain: read the survey archive, build the covariates, fit the model, draw the figure.
remotes::install_github("chross22/taupatch")
Models
Builds monthly habitat suitability models for high-abundance zooplankton patches ("tau-patches"), where a patch is defined by a species-specific abundance threshold. Point-and-click Shiny app or YAML-driven package.
remotes::install_github("chross22/taupatch")
config <- load_config("study.yaml")
run_taupatch_app() # or use the configFits a set of candidate detection functions to line-transect distance data and compares them on the quantities that actually matter for abundance — effective strip half-width and its coefficient of variation — rather than on the Akaike information criterion alone. Includes the gamma key that Distance::ds() does not offer.
remotes::install_github("chross22/dsfit")
sw <- sweep_models(
detections,
model_set(key = c("hn", "hr")),
truncation = 400)Survey data
Reads marine mammal survey data recorded in the North Atlantic Right Whale Consortium (NARWC) database format and puts it into a single, predictable shape, reconciling the column names that different survey programs use for the same thing.
remotes::install_github("chross22/narwcr")
dat <- read_narwc("extract.csv")
narwc_column_mapping(dat)Turns aerial line-transect survey data from the NARWC database into effort segments ready for Distance and dsm — each with a location, an amount of effort, and counts of what was seen along it. Where the survey recorded declination angles, perpendicular distances come out in the shape a detection function wants.
remotes::install_github("chross22/distsamp")
dat <- read_narwc(path)
validate_narwc(dat) # never stops
segs <- segment_survey(dat, 5)Environmental covariates
Fetches ocean and atmosphere data from seven sources — Copernicus Marine, HYCOM, FVCOM, NOAA CEFI, CCMP, NOAA ERDDAP and NASA OB.DAAC — behind one interface and one set of variable names: ask for SST, not thetao, and the catalog finds the product. The join is a general spatiotemporal nearest-feature match, so either side can be sightings, survey stations, tag positions, or another gridded product. It also resamples products onto a common resolution, fills gaps in satellite ocean colour, and supplies seafloor terrain and basin-scale climate indices. Every value keeps a record of the source it came from, because SST from three models is three different numbers.
remotes::install_github("chross22/datamatch")
env <- accessCopernicus(
vars = c("SST", "SSS", "MLD"),
years = 2003:2017, months = 1:12,
bounding_box = bb)
matched <- matchData(sightings, env)The Python counterpart of datamatch, starting with the Copernicus Marine accessor. Variables are requested by the same short catalog names — SST, not thetao — and observations are any pandas DataFrame with coordinate and date columns, recognised by prefix and never guessed. The matching guarantees carry over from the R original: one row out per row in, in the same order; your columns are never overwritten; and every joined value keeps a source column saying which product produced it.
pip install git+https://github.com/chross22/pydatamatch
env = dm.access_copernicus(
variables=["SST", "SSS", "MLD"],
years=range(2003, 2018),
bounding_box=bb)
matched = dm.match_data(obs, env)Computes derived oceanographic covariates from gridded ocean data — spatial and temporal gradients, time-integrated variables, calendar-unit lags, eddy kinetic energy, Lyapunov exponents, and distances to fronts and shore.
remotes::install_github("chross22/derivoce")
grad <- horizontal_gradient(sst)
shore <- distance_to_shore(grid)Visualization
Turns fitted models into manuscript-ready figures. Every effect curve is paired with a rug of the raw data stacked directly above it, so a bend in the curve can be read against how much data actually supports it. GAMs via gratia, everything else via marginaleffects.
remotes::install_github("chross22/fancyfx")
fit <- mgcv::gam(y ~ s(sst), data = d)
plotEffects(fit, d, "sst")Draws the maps a spatial model produces, with the parts a reader needs to navigate one: land, a stated projection so that area means area, and a colour scale chosen for the quantity rather than whichever default fell out. A value and its uncertainty come out as one figure on a shared extent with aligned panels, and a series over time as small multiples on one scale — panels drawn separately do not compare. Takes sf, terra, or a plain data frame with coordinate columns. Sister package to fancyfx, which plots the same models' effects.
remotes::install_github("chross22/fancymaps")
map_pair(pred, uncertainty = "se",
coastline = coastline())Skills
Expertise: R · Python · git · bash / Unix shell · Linux Experience: MATLAB · Java · ArcGIS · R Shiny · Leaflet · SQL Limited experience: JavaScript · HTML · CSS