detrend in NCL with ignoring nan value option
detrend in Python with scipy detrend with fill_value option
My data shape is (time, latitude, longitude). I tried