Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

SOcool #4

Open
mdsumner opened this issue Sep 5, 2018 · 0 comments
Open

SOcool #4

mdsumner opened this issue Sep 5, 2018 · 0 comments

Comments

@mdsumner
Copy link
Collaborator

mdsumner commented Sep 5, 2018

Prototype:

library(sospatial)  ## devtools::install_github("AustralianAntarcticDivision/sospatial")
library(SOmap)
SOcool <- function(xs, ys, icedate = "2017-09-01") {
  ice <-  tibble::tibble(lon = rep_len(seq(-180, 179), length.out = length(packed_lats)), 
                lat = packed_lats/10,
                day = as.Date(rep(ice_dates, each = 360)))
  icedate <- as.Date(icedate)
  f <- "%Y-%m-%d"
  if (icedate < min(ice$day) || icedate > max(ice$day)) {
    stop(sprintf("sorry, available range of icedate is %s : %s", format(min(icedate), f), format(max(icedate), f)))
  }
                                                                
                                                                
  ind <- which(icedate == ice$day)
  x <- default_somap(xs, ys)
  ice <- dplyr::slice(ice, ind)
  ice[c("x", "y")] <- rgdal::project(as.matrix(ice[c("lon", "lat")]), projection(x$bathy))
  ix <- which(ice$x >= xmin(x$bathy) & ice$x <= xmax(x$bathy) &
                ice$y >= ymin(x$bathy) & ice$y <= ymax(x$bathy))
  ice <- dplyr::slice(ice, ix)
  lines(ice[c("x", "y")], lty = 2)
  x$ice <- ice
  invisible(x)
}

SOcool(xs, ys)

image

I expect sospatial will get incorporated into this package, though first we need a way to keep the ice data up to date - it's about a year out atm.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant