Comments (2)
I've added mfe_average_sst
but the projection looks wrong. Needs some work.
Jim got me some different SST data for the PHC project. See the files ERA5_data_script.R
etc for how to get and plot these data. I used this code:
library(ecmwfr)
library(raster)
library("ncdf4")
library("ncdf.tools")
library(ggplot2)
library(ggthemes)
library(sf)
library(nzsf)
ncfile <- "era5-nz_sst_to_2020.nc"
rr <- brick(x = ncfile)
rr <- stack(x = ncfile)
nlayers(rr)
rr
raster::plot(rr)
df <- rasterToPoints(rr) %>%
data.frame() %>%
pivot_longer(cols = c(-x, -y)) %>%
separate(col = name, into = c("year", "month", "day", "hr", "min", "sec"), sep = "\.") %>%
mutate(year = gsub("X", "", year), value = value - 273.15)
p <- ggplot(data = df %>% filter(year == "2000")) +
geom_raster(aes(x = .data$x, y = .data$y, fill = .data$value)) +
facet_wrap(year ~ month)
p
r1 <- rr[[1]]
sf_stat <- get_statistical_areas("CRA") %>%
filter(area %in% c(901:907)) %>%
st_transform(crs = crs(rr), check = TRUE) %>%
dplyr::select(MFISH_ID, area)
average_temperature <- raster::extract(x = rr, y = sf_stat, df = TRUE) %>%
full_join(data.frame(sf_stat), by = c("ID" = "MFISH_ID")) %>%
dplyr::select(-geometry, -ID) %>%
pivot_longer(-area) %>%
separate(col = name, into = c("year", "month", "day", "hr", "min", "sec"), sep = "\.") %>%
mutate(year = gsub("X", "", year), value = value - 273.15) %>%
group_by(year, month, area) %>%
summarise(temp = mean(value, na.rm = TRUE))
save(average_temperature, file = "average_temperature.rda")
from nzsf.
Not sure what is wrong with the MFE raster. Think I will drop it as the projection looks buggered.
from nzsf.
Related Issues (20)
- Make a hex sticker and add to pkg
- Error in building package from source without rmarkdown and other packages HOT 1
- create a set of grids/rasters based on spec HOT 1
- LIN QMA polygons don't line up with statistical areas HOT 1
- get_standard_grid_origin ymin is wrong HOT 2
- CRS definition HOT 2
- Build a shiny front end for building maps
- inset maps HOT 1
- CRA
- Implement facet_zoom
- ggmap rasters HOT 5
- Show different annotations
- Final plot in nzsf.Rmd looks wrong
- Add sticker.png to the help files
- Reduce the size of the data files
- JMA statistical areas look wrong
- Issue with scales and north arrow
- File size issues HOT 3
- New vignettes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nzsf.