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

Caspar Ammann ammann at ucar.edu
Tue Feb 18 19:51:40 MST 2020


Thanks Rick and Dennis,

Rick was correct that in one of the pre-loads that helps write out netCDF files more easily a debug integer flag was set using different debug levels. Once deleted, the shading worked just fine. Debug and other general variables that might be used in different sections of the code collection, it might be good to keep them local.

Fortunately, the positive message is that in the extensive script, I turned Cyclic off, so at least that one I caught !  ;-)

Thanks both of you for quick reply!

Caspar


Caspar Ammann
National Center for Atmospheric Research
RAL - Climate Science and Applications Program



> On Feb 18, 2020, at 6:03 PM, Dennis Shea <shea at ucar.edu> wrote:
> 
> 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 <mailto: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 <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk><caspar.png>

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


More information about the ncl-talk mailing list