<div dir="ltr">
<pre><code><span><span>":=" would change the type of this variable because it essentially deletes the existing variable.</span></span></code></pre>

</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 2, 2020 at 3:53 AM Rashed Mahmood <<a href="mailto:rashidcomsis@gmail.com">rashidcomsis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>try the reassignment operator for assigning value inside the loop:</div><div></div><div>
<pre><code><span>sres<span>@</span>mpCenterLatF               := <span>25.2<br><br></span></span></code></pre><pre><code><span><span>Since at the beginning you assigned an integer value to the "sres<span>@</span>mpCenterLatF", so this variable is expected as integer afterwards.<br><code><span><span></span><span></span></span></code></span></span></code></pre><pre><code><span><span>":=" would change the type of this variable.<br></span></span></code></pre><pre><code><span><span><br><br></span></span></code></pre>

</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 2, 2020 at 2:17 AM Marco Miani via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<p>Dear community,</p>
<p><br>
</p>
<p>hope this e-mail finds you all well. <br>
</p>
<p><br>
</p>
<p>I am working on animating NCL-produced png figures, using satellite view, showing how my tracers travel around the world. To do it, I am observing on board of my satellite and, inside a while loop (looping over every time-step), I update center latitude
 and longitude (mpCenterLatF) by increasing the value (either linearly, or with a sine function...). Once all the frames (png) are output, I use a python script to stitch them together and get my nice animation in *.avi.</p>
<p>Now, the problem arises when adding a given value to lat, lon to mpCenterLatF inside the loop. It seems that if the added value is an integer (no decimals), all works well. IF, otherwise, I add a float (with decimals) NCL refuses to go on, stops, and complains.
 Here below, a snippet of my code. This is working in Python (PyNGL), but would crash in "pure" NCL.</p>
<p><br>
</p>
<p>The error message I got is:<code><span><span> fatal:</span>[<span><span>"</span><span>NclAtt.c</span><span>"</span></span>:<span>262</span>]:Attribute assignment type mismatch.</span></code><br>
</p>
<p>Any clues on how to fix it?</p>
<p>Thanks!<br>
</p>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
OS: Linux<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Version: <span>6.6.2<br>
</span><span></span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Marco <br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<pre><code><span>sres<span>@</span>mpProjection               = <span><span>"</span><span>Satellite</span><span>"</span></span> ; choose map projection

sres<span>@</span>mpLimitMode                 = <span><span>"</span><span>angles</span><span>"</span></span> 
sres<span>@</span>mpLeftAngleF                = <span>2</span><span>0</span>.
sres<span>@</span>mpRightAngleF               = <span>2</span><span>0</span>.
sres<span>@</span>mpTopAngleF                 = <span>2</span><span>0</span>.
sres<span>@</span>mpBottomAngleF              = <span>2</span><span>0</span>.

sres<span>@</span>pmTickMarkDisplayMode     = <span><span>"</span><span>Always</span><span>"</span></span>     ; turn on automatic tickmarks
sres<span>@</span>mpGridMaskMode            = <span><span>"</span><span>MaskLand</span><span>"</span></span>   ; Mask grid over land.
sres<span>@</span>mpAreaMaskingOn           = <span>1</span>
sres<span>@</span>mpMaskAreaSpecifiers      = mask_specs

sres<span>@</span>mpCenterLonF               = <span>51</span>       ; choose center lon
sres<span>@</span>mpCenterLatF               = <span>25</span>       ; choose center lat

sres<span>@</span>mpSatelliteAngle1F         = <span>1</span><span>.4</span>*<span>5</span><span>5</span><span>.2957795130823</span>*asin(<span>1</span>./<span>1</span><span>.4</span>)/<span>8</span>.
sres<span>@</span>mpSatelliteAngle2F         = <span>9</span><span>0</span>.
sres<span>@</span>mpSatelliteDistF           = <span>2</span><span>.35</span>     ; choose satellite view

i = <span>0</span>
Nsteps= <span>60</span>
   <span>do</span> <span>while</span>(i.le.Nsteps)
      ..<span>do</span> some magic
      sres<span>@</span>mpCenterLonF               = <span>51</span>+i      ; Works only <span>if</span> <span><span>"</span><span>i</span><span>"</span></span> is integer, NOT <span>float</span>...
      ;sres<span>@</span>mpCenterLatF               = <span>2</span><span>5</span><span>.2</span>      ; This won<span>'t</span> work! <-------------------------------------- this is the trouble maker! 
      sres<span>@</span>mpCenterLatF               = <span>25</span>        ; This does work
      ...<span>do</span> more magic
      print(<span><span>"</span><span>"</span></span>)
      print(sprinti(<span><span>"</span><span>Drawing frame %0.1i </span><span>"</span></span>,i))  
      i=i+<span>1</span>
   end <span>do</span>
print(<span><span>"</span><span>All done. Reading for merging...</span><span>"</span></span>)        ;Next step is to call python script, to generate an animation... </span></code></pre>
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
</div>

_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>