R code: ClimateXX software output management (ASCII creation & projection files)

The following R code will take the outputs from any of the ClimateXX software packages and create clean CSV or ASCII outputs of the variables for use in ArcGIS or whatever. I tried to keep this code simple so that novice R users can process their output files quickly and easily. If you’re not familiar with ClimateXX software series, I’ve included some info at the bottom of this post.

I’ve been asked about this via e-mail a few times, so figured I would just post it here. You can find the R code and example files via my Dropbox here. I won’t reproduce all the code from the Dropbox, but the basics are this:

  • You can use the dataframe2asc() command from the {SDMTools} package for R to easily kick out individual climate variables as ASCII files. Note that you’ll need gridded coordinates for this. The attached files use Lat/Long for the ClimateXX software and also include gridded XY coordinates in Lambert Conformal Conic (LCC).
  • The code also include a function for exporting ArcGIS projection files in LCC. This is a simple test file writing function that can also be changed for alternative projections.

The only code that I’ll reproduce here is the LCC projection function (see my other post), because it’s likely the most useful tool for most people:

# Function to make a .prj file in Lambert Conformal Conic
# x is the desired name of the file (e.g. "MyData.prj")
make.prj <- function(x){
 proj.file <- file(x)
 writeLines(c("Projection LAMBERT",
 "Datum WGS84",
 "Spheroid WGS84",
 "Units METERS",
 "Zunits NO",
 "Xshift 0.0",
 "Yshift 0.0",
 "Parameters",
 "49 0 0.0 /* 1st standard parallel",
 "77 0 0.0 /* 2nd standard parallel",
 "-95 0 0.0 /* central meridian",
 "0 0 0.0 /* latitude of projection's origin",
 "0.0 /* false easting (meters)",
 "0.0 /* false northing (meters)"), 
 proj.file)
 close(proj.file)
}


ClimateXX Software

This set of freely-available GUI software packages produces interpolated climate data for various regions of the globe, both for historic observed climates (based on weather station data) or future climate projections based on GCM data. I’ve also used it for palaeoclimate reconstructions that incorporate palaeo GCMs. Downscaling is based on PRISM.

The geographic areas covered are:

Andreas Hamann at the University of Alberta has nice overviews of all the software (included some pre-generated surfaces) on his data website. For more info on the software, see Tongli Wang’s website at the University of British Columbia. The latest publication is:

Hamann, A., T. Wang, D. L. Spittlehouse, and T. Q. Murdock. 2013. A comprehensive, high-resolution database of historical and projected climate surfaces for western North America. Bulletin of the American Meteorological Society 94: 13071309. PDF

Advertisements
This entry was posted in R and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s