Project

General

Profile

Announcment: R package wrapping CDO

Added by Mark Payne over 4 years ago

Dear all,

For those of you that use R, you may be interested in this R package that I have developed to make it easier to work with CDO (and NCO) directly from the command line. It is now available on GitHub:

https://github.com/markpayneatwork/ClimateOperators

Hope it helps!

Mark


Replies (4)

RE: Announcment: R package wrapping CDO - Added by Ralf Mueller over 4 years ago

hi Mark,

thx for the work! I am not a big user of R, didn't found the occasion to dive into it,yet. took a moment to realize, that I hade to call library(ClimateOperators) before being able to execute your examples ;-)

It there any way to get the field data in to an array structure (or dataframe? - no idea how R calls this)?

cheers
ralf

RE: Announcment: R package wrapping CDO - Added by Mark Payne over 4 years ago

The package is mainly intended to work with external files via cdo, rather than loading them directly into memory (this can be handled by the raster package, amongst others). I should probably add that to the documentation - the idea is that R can be used more as a scripting language, with cdo doing the heavy lifting, rather than doing any processing directly in R.

Mark

RE: Announcment: R package wrapping CDO - Added by Ralf Mueller over 4 years ago

For python and ruby I added a netcdf-based reader, that returns numpy/narray structures instead of filenames. This way it can be integrated a bit easier into python/ruby scripts. Does R have a netcdf-binding?

RE: Announcment: R package wrapping CDO - Added by Mark Payne over 4 years ago

Yes, the "ncdf4" package wraps the full NetCDF api, so you can always get the information that you need directly that way - this would be closely analogous to what you have in Python. "ClimateOperators" is more of a wrapped to the CDO tools, to streamline their use from R.

Here's an example for using netcdf4:

library(ncdf4)
ncid <- nc_open("~/HadISST.nc") #Opens the file for reading
dat <- ncvar_get() #Reads entire contents into an array
nc_close(ncid) #Tidys up afterwards

    (1-4/4)