buildAstroStats: buildAstroStats

View source: R/buildAstroStats.r

buildAstroStatsR Documentation

buildAstroStats

Description

Given a particular trap sequence, calculate the proportion of time spent fishing during nighttime and while the moon was up.

Usage

buildAstroStats(release.visit, visit.df)

Arguments

release.visit

A data frame containing release data obtained from the release-data SQL sequence.

visit.df

A data frame containing visits obtained from the catch-data SQL sequence.

Details

The buildAstronStats function first queries the CAMP database for all relevant visits via the Visits table, as well as the astronomical sun and moon rise and set times, contained within table Dates. The "Not Fishing" data are also obtained, via a query to table TempSumUnmarkedByTrap_Run_Final in the underlying CAMP mdb. Because of this, the catch SQL sequence must be run prior to the same of the efficiency.

The function emulates the calculation of SampleMinutes performed by the catch SQL sequence. This is done in order to calculate denominators for calculation of the proportion of time spent fishing at night and while the moon is up. The SampleMinutes field from TempSumUnmarkedByTrap_Run_Final was not utilized because the astronomical metrics need to calculate fishing with respect to the included fishing instances in the calculation of efficiency. These include fishing instances regardless of the value of the includeCatchID field. The value of SampleMinutes in the TempSumUnmarkedByTrap_Run_Final calculated for catch estimation excludes bad fishing, as identified via the includecatchID field. Therefore, re-estimation of SampleMinutes, based on efficiency concerns, must be performed. These SampleMinutes are called JasonSampleMinutes, so as to differentiate. Values of this variable equals -99 for the first visit of a trapping sequence, and -88 in the case of a time frame greater than the gap in fishing length. Currently, the fishing-gap length is set via global variable fishingGapMinutes, and equals 10080 minutes.

Calculation of astronomical proportions utilized campR functions makeSkinnyTimes and getTimeProp.

Value

A dataframe with one row for all unique batchDates included within min.date and max.date, inclusive. All variables, as provided via varVec, have a non-NA value.

Author(s)

WEST Inc.

See Also

makeSkinnyTimes, getTimeProp

Examples

## Not run: 
df <- buildAstroStats(release.visit=release.visit,
                      visit.df=visit.df)

## End(Not run)

tmcd82070/CAMP_RST documentation built on April 6, 2022, 12:07 a.m.