Mateus approach will work file.
Another approach:
http://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml
  diff = A - conform(A, B, (/1,2/) )
  diff_at_long_name = "Difference"   ; meta data
  diff_at_units     = A_at_units
  copy_VarCoords(A, diff)
  printVarSummary(diff)
Mateus Teixeira wrote:
> Hi Chen,
> 
> You can use a do...end do loop for this task:
> 
> newArray = new( dimsizes(A), typeof(A), A@_FillValue )
> do i=0,dimsizes(time)-1
>     newArray( i, :, : ) = A( i, :, : ) - B
> end do
> 
> 
> Best regards,
> 
> Mateus
> 
>     
> 
> 2009/8/4 Changlin Chen <clchen_at_ouc.edu.cn <mailto:clchen_at_ouc.edu.cn>>
> 
>     Hi,
> 
>     I have a three-dimensional array A(time,lat,lon) and a
>     two-dimensional array B(lat,lon) .
>     The number of dimensions do not match.
>     How can I calculate the anomaly of A by subtracting B from A?
>     Thanks!
>             clchen
>     _______________________________________________
>     ncl-talk mailing list
>     List instructions, subscriber options, unsubscribe:
>     http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> 
> 
> 
> 
> -- 
> Mateus da Silva Teixeira
> 
> Registered Linux User #466740
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 03 2009 - 21:40:10 MDT
This archive was generated by hypermail 2.2.0 : Wed Aug 05 2009 - 20:36:03 MDT