Animated Images of Arctic Sea Ice Extent Decline

[This article was first published on Climate Charts & Graphs I » RClimate Script, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This post shows how to download and animate a series of Arctic Sea Ice Extent images using R and the animation package.

In my previous post, I showed how to download the daily arctic sea ice extent  data and generate an animation of the time series plots. In this post I show how to animate the monthly images provided by NOAA’s Nation Snow and Ice Data Center.

###### RClimate Script: NSIDC_Monthly_Sea_Ice_Extent_Images.R
## Download and process 1981 to 2012 Monthly Arctic SIE Images
## Sept. 5, 2012: https://chartsgraphs.wordpress.com; DK O'Day
##############################################################
  library(animation)
## Establish work dir to place downloaded images and gif file
  setwd(getwd())
  where <- getwd()

## Monthly NSIDC Extent Immage Link
# ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/Aug/N_198108_extn.png
  part_1 <- "ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/Aug/N_"
  part_3 <- "08_extn.png"

# Specify month number for animation
  m <- "08"

# Loop through years to create link and download images
  for (y in 1981:2012) {
     file_name <- paste(part_1, y, part_3, sep="")
     copy_name <- paste(where, "//asie",y,m,".png",sep="")
     download.file(file_name, copy_name, mode="wb")
     }

## copy last file c times to extend gif animation
    for (c in 1:2)
    {
     file_name <- paste("asie2012",c, ".png",sep="")
     file.copy(from= copy_name, to = file_name, overwrite=T)
    }

## Use animation package to generate gif file
  ani.options(convert=shQuote('C:\Program Files (x86)\ImageMagick-6.7.9-Q16\convert.exe'))
  ani.options(outdir = getwd()) # direct gif output file to working dir
  ani.options(interval= 0.70)
  im.convert("asie*.png", "asie_image_animation.gif")

 

Filed under: Arctic Sea Ice, Global Warming, RClimate Script Tagged: Arctic SeaIce, Climate Trends, R scripts

To leave a comment for the author, please follow the link and comment on their blog: Climate Charts & Graphs I » RClimate Script.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)