RCMIP5 icon indicating copy to clipboard operation
RCMIP5 copied to clipboard

Extracting month values

Open cahartin opened this issue 11 years ago • 3 comments

Is there a convenient way to extract out the months? After the file loads, d$year ends up a fraction of year 2006.042 etc. Could we possibly add a month output (d$month) for the files that have months?

cahartin avatar Nov 04 '14 14:11 cahartin

On a similar note I just got a request for a way to extract 'day' from the decimal year. Bumping this up the queue. This is hard since each of the simulations use their own calendars. We may need to see if any of the netcdf functions deals with this better then we do.

For now you can try something like:

year <- floor(time) month <- floor((time - year-1) * 12) day <- (((time - year-1) * 12) - month)*30

ktoddbrown avatar Nov 04 '14 23:11 ktoddbrown

thanks kathe.

cahartin avatar Nov 05 '14 20:11 cahartin

Rather than writing month/year extraction functions, maybe we should just store the time dimensions as…a date! Seems simpler and easier.

bpbond avatar Dec 12 '14 02:12 bpbond