JGCRI / RCMIP5

R scripts for processing CMIP5 data
Other
32 stars 10 forks source link

loadEnsemble doesn't load atmospheric 'plev' files correctly #67

Closed bpbond closed 10 years ago

bpbond commented 10 years ago

KTB - I'm going to make some big changes to loadEnsemble…if possible don't touch that today, just for merging ease later. Thanks.

ktoddbrown commented 10 years ago

Thanks for letting me know, I was just starting to poke at the 'extract dim names' issue.

ktoddbrown commented 10 years ago

FYI we may want to turn off the 'collapse_degen' flag in ncvar_get. This could solve the one time stamp issue.

ktoddbrown commented 10 years ago

The function 'nc.get.dim.names' is in the package 'ncdf4.helpers' and returns the names of the dimensions of a nc variable.

But it looks like both my suggestions break with ncdf... At this point I'm very tempted to just hack it with dimension length matching.

bpbond commented 10 years ago

Seems like a one-liner gets the dimension names reliably

    dimNames <- unlist(lapply(nc$var[[variable]]$dim, FUN=function(x) { x$name }))

…anyway thanks for holding off, I'm going to do some work on this now and will then sync up.

bpbond commented 10 years ago

collapse_degen! Missed that! Great, I'll make that change.

bpbond commented 10 years ago

…the problem is that this option is not available in the ncdf package, which we've said we want to support. So actually I'm going to leave things as is, with short snippet of code that re-inserts missing dimensions if necessary.

bpbond commented 10 years ago

loadEnsemble now handles 'plev' files correctly, as well as any other odd dimension names, by reading those names directly from the netcdf file, instead of assuming them. See commit fff554c4. There's one exception though, and I'm about open an issue.