Hi Yury, If the interpolation should be performed only for the first dimension, and this is always true, then you can use reshape to change the dimensions of your data before passing it to interpND. Then interpND will only interpolate on the first dimension, and you can reshape your data back to [1,2,2,2] afterwards:
pdl> p $in #prints your piddle below pdl> $in->reshape(2,2*2*2) #note that this changes $in inplace! pdl> p $in [ [200 173] [BAD BAD] [BAD BAD] [BAD BAD] [BAD BAD] [BAD BAD] [BAD BAD] [BAD BAD] ] pdl> $out = $in->interpND( pdl(0.5)->dummy(1) ) #if you use NiceSlice, this could be: #$out = $in->interpND( pdl(0.5)->(,*1) ) pdl> p $out [ [186.5] [ BAD] [ BAD] [ BAD] [ BAD] [ BAD] [ BAD] [ BAD] ] pdl> $out->reshape(1,2,2,2) #if you want to recover the dimensions of the original data best, Derek > On Dec 6, 2022, at 6:59 AM, Yury Pakhomov <pakho...@inasan.ru> wrote: > > Hi all! > > I fill piddle by grid data to then interpolate with interpND(). Piddle has > the dimension [2,2,2,2]. But the grid is incomplete, some cells have BAD > value. I use linear interpolation. > If piddle has values like this: > [ > [ > [ > [200 173] > [BAD BAD] > ] > [ > [BAD BAD] > [BAD BAD] > ] > ] > [ > [ > [BAD BAD] > [BAD BAD] > ] > [ > [BAD BAD] > [BAD BAD] > ] > ] > ] > Then interpND function for index (0.5,0,0,0) return BAD value, although > values of indexes (0,0,0,0) and (1,0,0,0) are defined. I.e. interpolation > should be performed only for first dimension, others may be excluded. The > simple way ismay be truncate the piddle to > [ > [ > [ > [200 173] > ] > ] > ] > How to implement it? Or is there other way? > Thank you in advance!!! > > > > > _______________________________________________ > pdl-general mailing list > pdl-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pdl-general _______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general