[ncl-talk] Wondering Why I Get This Error

Guido Cioni guidocioni at gmail.com
Fri Sep 8 02:48:43 MDT 2017


dbz is byte type -> wrap_around thus is byte type.

256. will be a floating point variable. In fortran, and thus NCL, if you write 256 you will get an integer variable, 256. (with the point) a float variable.

Thus when making wrap_around=256. you are forcing an assignment between byte and float type, which NCL cannot do without spitting out a warning or and error. Imagine if this would happen without noticing...it could lead to all sort of weird errors.

You have to convert wrap_around to float (for example with the function tofloat) before attempting that.
Cheers 

> On 8. Sep 2017, at 10:11, Barry Lynn <barry.h.lynn at gmail.com> wrote:
> 
> Hi:
> 
> I have some simple code, copied below.
> 
> I cannot add the value of 256 to dbz or the value of wrap_around after
> setting it to 256.
> 
>   wrap_around = dbz
> 
>   wrap_around = 256.
> 
> 
> 
>   do j = 0,dims2d(0)-1
> 
>   do i = 0,dims2d(1)-1
> 
>   check = ismissing(dbz(j,i))
> 
>    if (check.eq.False)then
> 
>    if (dbz(j,i).lt.0)then
> 
>     dbz(j,i) = dbz(j,i) + wrap_around(j,i)
> 
>    end if
> 
>    end if
> 
>   end do
> 
>   end do
> 
> 
> fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
> 
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 35 in file ./ra
> 
> PrintVarSummary gives:
> 
> Variable: dbz
> 
> Type: byte
> 
> Total Size: 480960 bytes
> 
>             480960 values
> 
> Number of Dimensions: 2
> 
> Dimensions and sizes:	[radialR | 360] x [gateR | 1336]
> 
> Coordinates: 
> 
> Number Of Attributes: 14
> 
>   units :	dBz
> 
>   long_name :	Reflectivity
> 
>   missing_value :	0
> 
>   signal_below_threshold :	0
> 
>   scale_factor :	0.5
> 
>   add_offset :	-33
> 
>   _Unsigned :	true
> 
>   range_folding_threshold :	50
> 
>   _CoordinateAxes :	timeR elevationR azimuthR distanceR
> 
>   scale_factor_metadata :	0.5
> 
>   add_offset_metadata :	-33
> 
>   range_folded_value_packed :	1
> 
>   range_folded_value :	-32.5
> 
>   _FillValue :	0
> 
> -- 
> Barry H. Lynn, Ph.D
> Senior Lecturer,
> The Institute of the Earth Science, 
> The Hebrew University of Jerusalem, 
> Givat Ram, Jerusalem 91904, Israel 
> Tel: 972 547 231 170
> Fax: (972)-25662581
> 
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com <http://weather-it-is.com/>
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk


Guido Cioni
http://guidocioni.altervista <http://guidocioni.altervista/>.org

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


More information about the ncl-talk mailing list