Getting temperature data

In this example, we will look at temperature data from the worldclim 2 data, crop it for Western Europe, and then change the resolution to aggregate the data. The first step is to get the worldclim layer for temperature (the codes for each layers are in the function documentation):

using SimpleSDMLayers
temperature = SimpleSDMPredictor(WorldClim, BioClim, 1)
SDM predictor → 1080×2160 grid with 808053 Float32-valued cells
  Latitudes	(-89.91666666666667, 89.91666666666667)
  Longitudes	(-179.91666666666666, 179.91666666666666)

Thanks to the integration with Plots and StatsPlots, we can very rapidly visualize these data:

using Plots, StatsPlots
heatmap(temperature, c=:cividis, frame=:box)

Let's also have a look at the density while we're at it:

density(temperature, frame=:zerolines, c=:grey, fill=(0, :grey, 0.2), leg=false)
xaxis!("Temperature", (-50,30))

The next step is to clip the data to the region of interest. This requires a the coordinates of the bounding box as two tuples (for longitude and latitude) – we can also make a quick heatmap to see what the region looks like:

temperature_europe = temperature[left=-11.0, right=31.5, bottom=29.0, top=71.5]
heatmap(temperature_europe, c=:cividis, aspectratio=1, frame=:box)