[ncl-talk] sres at mpCenterLatF won't accept decimal values?

Marco Miani m.miani at cyi.ac.cy
Tue Jun 2 05:20:22 MDT 2020


Works like charm. Thank you!

________________________________
From: Rashed Mahmood <rashidcomsis at gmail.com>
Sent: 02 June 2020 13:53
To: Marco Miani <m.miani at cyi.ac.cy>
Cc: ncl-talk at ucar.edu <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] sres at mpCenterLatF won't accept decimal values?

try the reassignment operator for assigning value inside the loop:

sres at mpCenterLatF               := 25.2


Since at the beginning you assigned an integer value to the "sres at mpCenterLatF", so this variable is expected as integer afterwards.

":=" would change the type of this variable.



On Tue, Jun 2, 2020 at 2:17 AM Marco Miani via ncl-talk <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>> wrote:

Dear community,


hope this e-mail finds you all well.


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.

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.


The error message I got is: fatal:["NclAtt.c":262]:Attribute assignment type mismatch.

Any clues on how to fix it?

Thanks!

OS: Linux
Version: 6.6.2

Marco



sres at mpProjection               = "Satellite" ; choose map projection

sres at mpLimitMode                 = "angles"
sres at mpLeftAngleF                = 20.
sres at mpRightAngleF               = 20.
sres at mpTopAngleF                 = 20.
sres at mpBottomAngleF              = 20.

sres at pmTickMarkDisplayMode     = "Always"     ; turn on automatic tickmarks
sres at mpGridMaskMode            = "MaskLand"   ; Mask grid over land.
sres at mpAreaMaskingOn           = 1
sres at mpMaskAreaSpecifiers      = mask_specs

sres at mpCenterLonF               = 51       ; choose center lon
sres at mpCenterLatF               = 25       ; choose center lat

sres at mpSatelliteAngle1F         = 1.4*55.2957795130823*asin(1./1.4)/8.
sres at mpSatelliteAngle2F         = 90.
sres at mpSatelliteDistF           = 2.35     ; choose satellite view

i = 0
Nsteps= 60
   do while(i.le.Nsteps)
      ..do some magic
      sres at mpCenterLonF               = 51+i      ; Works only if "i" is integer, NOT float...
      ;sres at mpCenterLatF               = 25.2      ; This won't work! <-------------------------------------- this is the trouble maker!
      sres at mpCenterLatF               = 25        ; This does work
      ...do more magic
      print("")
      print(sprinti("Drawing frame %0.1i ",i))
      i=i+1
   end do
print("All done. Reading for merging...")        ;Next step is to call python script, to generate an animation...


_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200602/b04acdb1/attachment.html>


More information about the ncl-talk mailing list