Re: multiple line plot?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 6 Dec 2006 13:19:58 -0700 (MST)

>I would like to view an area averaged annual cycle of a variable from
>both a global model and a regional model in one figure. I have
>succeeded in creating the two variables, each having 12 values. the
>printVarSummary for each is identical, except for the name ( tsAvg and
>tsAvgr).
>When I try to put them into a 2-d array following the example:
>
> data = new((/2,12/),float) <=== I've also tried =
>new((2,dimsizes(tsAvg&month)/),float)
>
> data(0,:) = tsAvg
> data(1,:) = tsAvgr
>
> printVarSummary (data)
>
>I get this error:
>
>fatal:Assignment type mismatch, right hand side can't be coerced to
>type of left
> hand side
>^Mfatal:Execute: Error occurred at or near line 129 in file anncyc.ncl
>
>The printVarSummaries for tsAvg, tsAvgr are below and they look the
>same to me.
>Am I making another newbie error?
>
>Thank you! -Anji
>
>Variable: tsAvg
>Type: double
>Total Size: 96 bytes
> 12 values
>Number of Dimensions: 1
>Dimensions and sizes: [month | 12]
>Coordinates:
> month: [0..11]
>Number Of Attributes: 7
> info : function clmMonLLT: contributed.ncl
> time_op_ncl : Climatology: 10 years
> FORTRAN_format : e13.5
> units : m/s
> long_name : SNOWFA
> _FillValue : -9999
> wgt_areaave_op_ncl : Area Average
>
>
>Variable: tsAvgr
>Type: double
>Total Size: 96 bytes
> 12 values
>Number of Dimensions: 1
>Dimensions and sizes: [month | 12]
>Coordinates:
> month: [0..11]
>Number Of Attributes: 7
> _FillValue : -9999
> info : function clmMonLLT: contributed.ncl
> time_op_ncl : Climatology: 10 years
> FORTRAN_format : e13.5
> units : m/s
> long_name : SNOWFA
> wgt_areaave_op_ncl : Area Average
>_______________________________________________

Hi Anji

NCL is not as forgiving as, say, fortran on variable types.

If variable "x" is type float [like 'data'],
"i" is type integer and
"d" is type double [like then NCL will silently allow

        x = i ; just like fortran
        
because it knows no information is lost. In NCL lingo,
"i" is silently 'coerced' to type float.

However, if you tried

        x = d ; fortran allows this
        
then NCL will issue a fatal error like you got.

fatal:Assignment type mismatch,
      right hand side can't be coerced to <= d is double
      type of left <= x is float
      
The reason from NCL's perspective is that
information may be lost when converting
from double to float.

I guess in computer science lingo, NCL is a
strongly-typed lanhuage.
==
A simple solution, make data type double

     data = new((/2,12/),double)
     
then the above will work fine.
     

Good luck
D

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 06 2006 - 13:19:58 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 07 2006 - 16:52:37 MST