[ncl-talk] Wondering Why I Get This Error
Barry Lynn
barry.h.lynn at gmail.com
Fri Sep 8 02:50:27 MDT 2017
The where statement did the trick for *that* problem -- thank you.
If you want to check the elements of an array of any dimension and replace
that element with a scalar of the same type, then consider the where()
Statement:
Dbz = where(dbz.lt.0.0, dbz+256.0,dbz)
Is there a similar approach for adding two numbers to the array?
dbz = dbz*0.5 - 0.33
Thanks -- this should be the last of my questions abou this.
On Fri, Sep 8, 2017 at 11:46 AM, Marston Johnston <shejo284 at gmail.com>
wrote:
> Try the where() statement and then printout the meta data on all variables
> involved in the problem.
>
>
>
> /M
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Marston S. Ward, PhD
>
> Department of Earth Sciences
>
> University of Gothenburg, Sweden
>
> Email: marston.johnston at gu.se
>
> SkypeID: marston.johnston
>
> Phone: +46-31-7864901 <+46%2031%20786%2049%2001>
>
> Only the fruitful thing is true!
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
> *From: *Barry Lynn <barry.h.lynn at gmail.com>
> *Date: *Friday, 8 September 2017 at 10:44
> *To: *Marston Johnston <shejo284 at gmail.com>
> *Cc: *ncl-talk <ncl-talk at ucar.edu>
> *Subject: *Re: [ncl-talk] Wondering Why I Get This Error
>
>
>
> Of course I read the error statement.
>
>
>
> I don't understand why I can add dbz (which is a 2 dimensional array) to a
> scalar value. This is a pretty basic thing to do.
>
>
>
> Moreover, when I defined "wrap_around" as dbz, and then set wrap_around to
> zero, I still can't coerce the variables.
>
>
>
> fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't
> be coerced to type of left hand side
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 35 in
> file ./radar_2.ncl
>
> Is the answer to this problem obvious? It seems to me that it should be,
> which I am (at the moment) frustrated.
>
>
>
> wrap_around = dbz
>
> wrap_around = 256.
>
>
>
> do j = 0,dims2d(0)-1
>
> do i = 0,dims2d(1)-1
>
> check = ismissing(dbz(j,i))
>
> if (check.eq.False)then
>
> if (dbz(j,i).lt.0)then
>
> dbz(j,i) = dbz(j,i) + wrap_around(j,i)
>
> end if
>
> end if
>
> end do
>
> end do
>
>
>
>
>
>
>
> On Fri, Sep 8, 2017 at 11:37 AM, Marston Johnston <shejo284 at gmail.com>
> wrote:
>
> Again, read the error statement and try to understand what it is telling
> you:
>
> atal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be
> coerced to type of left hand side
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 35 in
> file ./ra
>
>
>
> You have a TYPE mismatch between your variables and NCL cannot coerce one
> to the other. Make sure you are adding the same types of variables…
>
> For example, you cannot do 1 + “help”, that would be a type mismatch!
>
> /M
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Marston S. Ward, PhD
>
> Department of Earth Sciences
>
> University of Gothenburg, Sweden
>
> Email: marston.johnston at gu.se
>
> SkypeID: marston.johnston
>
> Phone: +46-31-7864901 <+46%2031%20786%2049%2001>
>
> Only the fruitful thing is true!
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
> *From: *ncl-talk <ncl-talk-bounces at ucar.edu> on behalf of Barry Lynn <
> barry.h.lynn at gmail.com>
> *Date: *Friday, 8 September 2017 at 10:11
> *To: *ncl-talk <ncl-talk at ucar.edu>
> *Subject: *[ncl-talk] Wondering Why I Get This Error
>
>
>
> atal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be
> coerced to type of left hand side
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 35 in
> file ./ra
>
>
>
>
>
> --
>
> Barry H. Lynn, Ph.D
>
> Senior Lecturer,
>
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
>
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
>
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108 <(914)%20432-3108>
>
--
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581
C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170908/850bccd4/attachment.html>
More information about the ncl-talk
mailing list