Skip to content

Commit

Permalink
First draft of case study 6 and its output
Browse files Browse the repository at this point in the history
  • Loading branch information
jingmiao7 committed Oct 8, 2024
1 parent ff3b6ed commit dba58e9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions week_06/CS_06_nocomments.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
install.packages("ncdf4")

library(terra)
library(spData)
library(tidyverse)
library(sf)

library(ncdf4)
download.file("https://crudata.uea.ac.uk/cru/data/temperature/absolute.nc","crudata.nc", method="curl")

# read in the data using the rast() function from the terra package
tmean=rast("crudata.nc")
plot(tmean)
plot(max(tmean))

data(world)
max_temp_by_country <- terra::extract(tmean, world, fun = max, na.rm=T, small=T)
head(max_temp_by_country)

world_clim <- bind_cols(world, as_tibble(max_temp_by_country)[, -1])

# Display the new combined data
head(world_clim)
Binary file added week_06/world_clim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dba58e9

Please sign in to comment.