<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Ali, your code is trying to assign type double values to a type float array.  Float is lower precision than double.  That error is a guard against losing numeric precision when you try to automatically convert one data type to another type with lower precision or smaller range.  Some languages allow you to do this, but not NCL.  Please read this section in the NCL manual.</div><div><a href="http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclDataTypes.shtml#Coercion">http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclDataTypes.shtml#Coercion</a><br></div><div><br></div><div>I can think of several ways to fix this.  One is to read the original array as type float, rather than type double.  I do not see any reason why you chose to read the original ascii file as type double.</div><div><br></div><div>However, if there is a reason to read the original as type double, then you could change "Array" to also be type double.  Another approach would be to use the type conversion function "tofloat" in the assignment in line 14.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 11, 2021 at 10:50 PM ali mughal via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear Ncl community <div><br></div><div>I have written a short script to read the file </div><div><a href="https://we.tl/t-T5PZMRFStX" target="_blank">https://we.tl/t-T5PZMRFStX</a></div><div> and write it to an array. I am having trouble at  line 14 where I get the following error. </div><div><br></div><div><div><div>filename = "Basecase.txt"</div><div>nvar=24</div><div>data = readAsciiTable(filename, nvar, "double", -1)</div><div>temp=reshape(data,(/24,27090/))</div><div><br></div><div>Array = new((/24,129,210/),float)</div><div><br></div><div>do it = 0, nvar-1,24</div><div>temp1=temp(it,:)</div><div><br></div><div>temp2=reshape(temp1,(/129,210/))</div><div><br></div><div>Array(:,:,it)=temp2</div><div>end do</div></div><div><br></div><div><b>Error<br></b></div><div>fatal:Assignment type mismatch, right hand side can't be coerced to type of left hand side<br></div><div>fatal:["Execute.c":8578]:Execute: Error occurred at or near line 13 in file test2.ncl</div></div></div></div></div></blockquote></div></div></div></div>