Hello
There is a built-in centered finite difference function:
http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/cntfindiff.html
===
Further, NCLs arrays syntax can be used just like f90/95, IDL, Matlab, ...
Consider t(N), p(N): compute dt/dp
dtdp = new ( dimsizes(t), typeof(t) )
or, perhaps, better
dtdp = t
; one sided differences
dtdp(0) = (t(1)-t(0)) / (p(1)-p(0))
dtdp(N-1) = (t(N-1)-t(N-2)) / (p(N-1)-p(N-2))
; centered finite difference
dtdp(1:N-2) = (t(2:N-1)-t(0:N-3)) / (p(2:N-1)-p(0:N-3))
dtdp@long_name = "..."
dtdp@units = "..."
Consider t(ntim,klev,ny,nx)), p(ntim,klev,ny,nx): compute dt/dp
dtdp = new ( dimsizes(t), typeof(t))
or
dtdp = t
dtdp(:, 0 ,:,:) = (t(:,1,:,:)-t(:,0,:,:)) \
/ (p(:,1,:,:)-p(:,0,:,:))
dtdp(:, N-1 ,:,:) = (t(:,N-1,:,:)-t(:,N-2,:,:)) \
/ (p(:,N-1,:,:)-p(:,N-2,:,:))
dtdp(:,1:N-2,:,:) = (t(:,2:N-1,:,:)-t(:,0:N-3,:,:)) \
/ (p(:,2:N-1,:,:)-p(:,0:N-3,:,:))
Consider t(ntim,klev,ny,nx)), P(klev): compute dt/dp
p = conform(t,P,1) ; make P conformant to t
[same as above]
delete (p)
Regards
Dennis Shea
=======================================
>Delivered-To: shea AT ucar.edu
>Delivered-To: ncl-talk AT ucar.edu
>Date: Sun, 8 Feb 2004 11:16:05 -0800 (PST)
>From: liping deng <lipingdengff AT yahoo.com>
>To: ncl-talk AT ucar.edu
>MIME-Version: 1.0
>Subject: hello!----questions
>>
>hello!
>Do anyone know whether in NCL have a function just for
> partial v/ partial y(central, forward or backward),or
>how can I do that in NCL?
>Thank you very much!
>Liping
_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Mon Feb 09 2004 - 10:26:34 MST