Skip to content

summer climatology MODISA L3bin #7

@mdsumner

Description

@mdsumner

Using this script to create a summer Southern Ocean climatology for MODISA using Johnson 2013:

https://github.com/mdsumner/roc/blob/master/inst/examples/calc_L3_SO.R

That script results in a large data frame of bin-values, the aggregated mean of ~1300 days of MODISA between 21 December and day 080.

The plot below was created with this code. Here the bins are all aggregated up into a 15km polar map, but we can easily bin it into a different grid.

## now the map
library(raster)
library(feather)
library(dplyr)
x <- read_feather("inst/examples/MODISA_SO_summer_355_080.feather")
map <- raster(extent(-9e6, 9e6, -9e6, 9e6), crs = "+proj=laea +ellps=WGS84 +lat_0=-90 +no_defs", res = 15e3)
bin_to_gridcell <- function(bins, gridmap, nrow = 4320) {
  xy <- do.call(cbind, roc::bin2lonlat(bins, nrows = nrow))
  cellFromXY(gridmap, rgdal::project(xy, projection(gridmap)))
} 
# 
summ <- x %>% mutate(grid_cell = bin_to_gridcell(bin_num, map))  %>% group_by(grid_cell) %>% 
  summarize(count = sum(count), chl_sum = sum(sum)) %>% mutate(mean_chl = chl_sum/count) 
summ <- summ %>% filter(!is.na(grid_cell))
map <- setValues(map, NA_real_)
map[summ$grid_cell] <- summ$mean_chl
library(palr)
pal <- chlPal(palette = TRUE)
plot(map, col =pal$cols, breaks = pal$breaks, legend = FALSE)

writeRaster(map, "L3_SO_summer.nc")

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions