Re: convert array to scalar for subtraction?

From: <debasish_at_nyahnyahspammersnyahnyah>
Date: Mon, 21 Sep 2009 20:15:32 -0800

Dear Jeanne,

you can use a do loop to do the substraction

example:

diff= new((/199,64,128/), float) ; assume, x and y are float

do t=0,198
diff(t,:,:)=x(t,:,:)-y(0,:,:)
end do

thanks

Debasish

Quoting Jeanne Thibeault <jeanne.thibeault_at_uconn.edu>:

> Dear NCL,
>
> I would like to subtract one array from another: x-y
>
> x has dimensions [time | 199] x [lat | 64] x [lon | 128]
> y has dimensions [time | 1] x [lat | 64] x [lon | 128]
>
> fatal:Minus: Dimension size, for dimension number 0, of operands does
> not match, can't continue
>
> I understand why I get the error. How can I convert the time
> dimension of y to a scalar so that I can subtract it from each time
> dimension of x? Or is there a better way?
>
> Thank you for your help.
>
> Jeanne
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 21 2009 - 22:15:32 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 24 2009 - 13:55:09 MDT