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

SOcool #4

Description

@mdsumner

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions