# Temperature

## Background and Motivation

All rates and ages depend on temperature; all AmP parameters are expressed at the reference temperature of 20 °C. The body temperature of aquatic ectotherms is (almost) equal to the water temperature, but that of terrestrial ones depend on a large number of factors. Endotherms regulate their body temperature after birth at species-specific levels, but that of neonates can deviate substantially; the temperature in bird Eggs typically follows a trajectory. Temperature is stored as auxilliary data in the mydata file, and used for calculating model predictions.Correcting for temperature using the Arrhenius temperature correction model amounts to a simple transformation of ages and rates by multiplying or dividing by temperature correction factor (c_T). What is important to keep in mind though is that metabolic rates depend on temperature in a non linear way. If the temperature was fluctuating rather than constant, the mean temperature has a non-straight-forward relationship with the mean c_T.

Some data sets (field or laboratory) acquire non-constant (fluctuating) temperatures. One is tempted to calculate the mean value of temperatures (T_mean) and then correct the metabolic rates with the c_T for that (T_mean) temperature. The problem arises, however, when the experienced (fluctuating) temperatures had a larger effect in low or high part of the range, which is often the case.

The presented procedure shows how to:

- Obtain environmental temperature values if temperatures are not reported but the geographic location is known;
- Use the temperature values in combination with the Arrhenius temperature correction model
- Obtain and use c_T as a function of time.

The final result is either a (single) temperature (for zero-variate data) or a vector of temperatures (for Uni-variate data) that are taking into account species-specific metabolic traits, and are thus more appropriate in the context of energetic modeling.

## Method

### Environmental temperature as a function of time

If you do not have data about environmental temperature associated with your dataset, you can use one of these options.- Option 1: Specify time-temperature as a series of knots for a first-order spline function are parameters and estimate these knots from your data.
- Option 2: Use R package link RNCEP: global weather and climate data at your fingertips to make a query and download environmental temperature data. for a given geographic location and a specific timeframe.
- Option 3: Use R to query a global microclimate dataset. These estimates are for the middle day of each month, based on long-term average macroclimates.
- Option 4: If working with a terrestrial ectotherm, you can improve accuracy of your temperature data (obtained via any of the previous steps) by simulating behavior of the species of interest with the NicheMapR microclimate model.

### Defining parameters of the Arrhenius temperature correction model

- Option 1: Use data on (developmental, metabolic, or other) rates at several different temperatures to estimate parameters of the Arrhenius temperature correction model (T_ref, T_A, T_AL, T_AH, T_L, T_H).
- Option 2: Find the Arrhenius parameters for your species in literature, and input them directly into your script.

### c_T as a function of time and using the back-calculated temperature

Using the temperature correction model, calculate the temperature correction (c_T) for each temperature point obtained in Step 1.For associating a temperature with a zero-variate data (e.g. age at puberty at a given food level) calculate the mean of all c_T values. Then convert the obtained mean(c_T) to the equivalent temperature using again the Arrhenius parameters. The back-calculated temperature is the 'constant temperature equivalent'.

For obtaining temperatures for specific time points in Uni-variate data, you will need to interpolate using the pairs of time-c_T values you have obtained in previous steps. It is possible to save either the c_T values or back calculated temperature values as a .csv file. This can then be called in the mydata file and stored in the auxData structure.