[ncl-talk] gsn_contour_shade and debug-variable in gsn_code.ncl

Dennis Shea shea at ucar.edu
Tue Feb 18 18:03:30 MST 2020


Hi Caspar,

The 'b' variable already had a cyclic point

Variable: b
Type: float
Total Size: 261364 bytes
            65341 values
Number of Dimensions: 3
Dimensions and sizes: [time | 1] x [latitude | 181] x [longitude | 361]
Coordinates:
            time: [0..0]
            latitude: [-90..90]

* longitude: [-180..180]   <=== cyclic point already present*

Adding the following:
    *res at gsnAddCyclic    = False  *  ; cyclic point already present

See attached

On Tue, Feb 18, 2020 at 4:44 PM Caspar Ammann via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hi NCL team,
>
> I’m suddenly running into issues with gsn_contour_shade.
>
> An old script that I have used successfully many times suddenly breaks with*
> Assignment type mismatch*, even if I put the command into a new variable
> (previously undefined), Below is a ‘burnt-down’ test script for
> illustration.
>
> Error:
>
> fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be
> coerced to type of left hand side
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 12665 in
> file
> /glade/u/apps/dav/opt/ncl/6.6.2/intel/18.0.5/lib/ncarg/nclscripts/csm/gsn_code.ncl
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 18 in
> file test_shade.ncl
>
> (>> it is in the gsn_contour_shade call, see below).
>
>
> What I see in gsn_code.ncl where the error occurs is this assignment :
>
>     debug = get_res_value_keep(opt,"debug",False)
>
> But debug is not a local variable, but something that appears already
> populated and defined as an integer (for some reason).  Once I set ‘debug'
> to be a local variable inside the function (gsn_contour_shade), then it all
> works as expected. So I do have a temporary fix if I replicate the function
> from gsn_code inside my script with the local variable “debug”. Maybe
> somebody can have a look and see what a more durable solution is.
>
> Thanks,
> Caspar
>
>
>
> begin
> a = addfile("/glade/scratch/ammann/NEWMONT/pr_meanfield_DJF_2085.nc","r")
> b = a->meanfield
>
> wks   = gsn_open_wks ("x11", "coneff" )
> res   = True
> res at gsnDraw         = False    ; We're going to panel later, so don't
> res at gsnFrame        = False    ; draw or advance frame.
>     plot  = gsn_csm_contour_map(wks, b(0,:,:), res )
>
>   opt                  = True
>   opt at gsnShadeFillType = "Pattern"
>   opt at gsnShadeLow      = 3                            ; Use fill Pattern
> #3
>   plot = gsn_contour_shade(plot,0.,-999, opt)   ; should be target
> ; dummy = gsn_contour_shade(plot,0.,-999, opt)   ; dummy: also assignment
> problem
>
> draw(plot)
> frame(wks)
>
> end
>
>
>
> Caspar Ammann
> *National Center for Atmospheric Research*
> *RAL - Climate Science and Applications Program*
>
>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20200218/18f6af2e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: caspar.png
Type: image/png
Size: 203747 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200218/18f6af2e/attachment.png>


More information about the ncl-talk mailing list