Good day code knights,
I have a tricky problem that I cannot see a simple solution for. And the history of the humankind states that there is a simple solution for everything (excluding buying presents)
Here is the problem:
I need an algorithm that takes multidimensional lists and a filter dictionary, processes them and returns lists based on the filters.
For example:
Bathymetry ('x', 'y')=(182, 149) #notation for (dimensions)=(size)
Chl ('time', 'z', 'y', 'x')=(4, 31, 149, 182)
filters {'x':(0,20), 'y':(3), 'z':(1,2), time:()} #no filter stands for all values
Would return:
readFrom.variables['Bathymetry'][0:21, 3]
readFrom.variables['Chl'][:, 1:3, 3, 0:21]
I was thinking about a for loop for the dimensions, reading the filters from the filter list but I cannot get my head around actually passing the attributes to the slicing machine.
Any help much appreciated.