ikeshwani / HorizontalConvection

2 stars 1 forks source link

Make array operations in analysis scripts and notebooks label-aware #21

Open hdrake opened 2 months ago

hdrake commented 2 months ago

There are many places where there an operation needs to be done in some dimension (x,y,z, or t), which are specified by the index of the dimension in the N-dimensional array, e.g.

bb = b_bottom[:,n] # indexing the time dimension
nanmean(bb, dims=1) # averaging the x dimension

It would be much more convenient to be able to make these operations label aware, e.g. something like

bb = sel(b_bottom, time=n)
nanmean(bb, dims=x)

It looks like the Rasters.jl package allows just that. And it already supports reading in netCDF files as Raster("filename.nc").