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

Caspar Ammann ammann at ucar.edu
Tue Feb 18 16:43:56 MST 2020


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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200218/b489e74b/attachment.html>


More information about the ncl-talk mailing list