Recently, I found an easy way to get my hands on weather data for my project locations.
One of my jobs is to survey and relocate sand lizards e.g. from sites where construction work will take place.
But sand lizards are rather picky creatures:
- They do not like it too cold nor too hot
- They do not like it windy
- They do not like rain
It is quite a task to check weather forecasts for the different locations all the time to be able to pick the right time slot for the right location, so I thought about how to use the historic data and the parameters I know from experience to calculate ratings of suitability for my tasks for each time slot of the forecast
I read a whole bunch of articles and watched a lot of videos, but I seem not to be able to transfer those common and simple examples used with cars, stocks and flowers to my problem.
So, firstly: How do I best operationalize boundaries or bonus/malus points for my data?
# A tibble: 6 × 5
datetime temp cloud wind prec
<dttm> <dbl> <int> <dbl> <dbl>
1 2024-05-01 00:00:00 16.9 25 13.8 0
2 2024-05-01 01:00:00 16.2 22 10.9 0
3 2024-05-01 02:00:00 15.3 30 10.9 0
4 2024-05-01 03:00:00 15.7 0 10.8 0
5 2024-05-01 04:00:00 14.8 3 10.1 0
6 2024-05-01 05:00:00 14.3 2 9.8 0
Temperatur (temp):
- Sand lizards are “generally” active above 13°C. But this doesn’t mean you can’t find some at lower temperatures, provided that it is sunny (low cloudiness) and not windy.
- best range of temp is between +-16°C and +-20°C, but then again it depends on the cloudiness and the wind:
- 16°C and 100% cloudiness plus wind might be too cold for them to show up.
- 20°C and 0% cloudiness without any wind might result in much higher surface temperatures, so they do have no need for long sun-bathing
- above 20°C: the cloudier the better and even some wind
- from 25°C on, it gets more and more unlikely to see one, 30°C is definitely a complete show-stopper
Cloudiness (cloud):
- The lower the temperature, the better is low cloudiness.
- The higher the temperature, the better is high cloudiness
Windspeed (wind):
Lets give some raw estimations:
- up to 5 km/h they do not care
- 15 km/h is sometimes still ok when its not to cold nor cloudy
- 20 km/h is too much
Rain (prec):
everything above 0 is bad.
As a result, I would like to have a new column “rating” with an index with my forecast data, so I can see at one glance if it is worth going or not.
Here some data example:
library(openmeteo) # where the weather data comes from
library(lubridate)
library(dplyr)
# some location
lat <- 50.837745
lng <- 9.539631
tz = "Europe/Berlin"
# dates for the query
start_date <- "2024-05-01"
end_date <- "2024-06-25"
# calling the weather data
data <- weather_history(
c(lat,lng),
start_date,
end_date,
hourly = list("temperature_2m","cloudcover","windspeed_10m","precipitation"),
daily = NULL,
response_units = NULL,
model = NULL,
timezone = "Europe/Berlin"
)
# nicer column names
lookup <- c("datetime","temp","cloud", "wind", "prec")
colnames(data) <-lookup
data
DT::datatable(data, options=list(pageLength=50, scrollX=TRUE))
I don’t even know the correct terminology for the things I’m looking for, so please bear with me and give me some pointers.