Re: Assignment type mismatch

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 21 2012 - 12:39:17 MDT

Without seeing more of your script, I think this is what you want:

   ptw = pt ; make new array with all metadata
   ptw = pt * conform (pt, tofloat (wgt), 0))

The tofloat function could be inserted in three different places here,
to get the same effect. There are other ways to do this, but this way
is cleanest, I think. HTH.

--Dave

On Tue, Aug 21, 2012 at 10:46 AM, jagadish karmacharya
<j_karmacharya@yahoo.com> wrote:
> Hi,
>
> I have received a script to compute eof, which works fine on a demonstation
> dataset. But when I attemped the same on my datasets it gave following
> error:
>
> fatal:["NclVar.c":1376]:Assignment type mismatch, right hand side can't be
> coerc ed to type of left hand side
> fatal:Execute: Error occurred at or near line 30 in file denosing1.ncl
>
> The corresponding line of the script is as follows:
> ptw = pt*conform(pt,wgt,0)
>
> I found, in response to a query, that NCL is a "strongly typed language", it
> will not allow a float variable
> on the left hand side to be over written with a variable of type double and
> suggested solutoin was following:
> eof_ts = eof_ts/tofloat(sumWgt)
>
> When I tried the same for "ptw" on previous line ( i.e replaced ptw = pt
> with ptw =tofloat(pt) ) the script runs OK but the trouble is axes of the
> resulting file lacks latitude or longitude information.
>
> How can I solve the problem?
>
> Thanks in advance.
>
> Jagadish
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 21 12:39:31 2012

This archive was generated by hypermail 2.1.8 : Thu Aug 23 2012 - 16:16:15 MDT