Spectral derivative in 2-d

That is an odd looking expression. It is equivalent to

ny = int( real(n) / 2.0 ) + 1

I’m not seeing why the conversion to real and then converting back to integer is necessary.