Re: EOF - gaussian grid

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 17 2013 - 06:57:16 MDT

I speculate that the clat (derived fron 'lat') is type double.

    printVarSummary(lat) ; note the 'type'
    printVarSummary(clat)

     wSLP = SLP ; type float
     wSLP = SLP*conform(SLP, clat, 1)

In the above 'conform(SLP, clat, 1)' creates an array that is
the same size and shape as SLP (wSLP) but is populated with
entries of clat which is type double. The product of a
float*double is a double.

NCL is a strongly typed language it will not let you lose information.
Hence, the error message

"Assignment type mismatch, right hand side can't
  be coerced to type of left hand side"

refers to the fact you are trying to force a double to a float.

The easiest way to address this is to concert the lat the float

      clat = tofloat(f->lat) ; convert to float
      clat = sqrt( cos(rad*clat) )

Good luck

On 4/17/13 6:26 AM, Renata Tedeschi wrote:
> When I use the eof_1.ncl script the following message appears:
>
> "fatal:["NclVar.c":1382]:Assignment type mismatch, right hand side can't
> be coerced to type of left hand side
> fatal:["Execute.c":7743]:Execute: Error occurred at or near line 91 in
> file eof_NAO.ncl"
>
> Line 91: wSLP = SLP*conform(SLP, clat, 1)
> _____________________________________________________________________________________________
> - printVarSummary(SLP) [where SLP is: SLP = month_to_season (slp,
> season)]:
> Variable: SLP
> Type: float
> Total Size: 2211840 bytes
> 552960 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 30] x [lat | 96] x [lon | 192]
> Coordinates:
> time: [ 0..254232]
> lat: [-88.57217..88.57217]
> lon: [-180..178.125]
> Number Of Attributes: 6
> lonFlip : longitude coordinate variable has been reordered via lonFlip
> grid_type : gaussian
> long_name : DJF: ** msl SEA LEVEL PRESSURE (HPA)
> lev : 1000
> _FillValue : 9.999e+20
> NMO : 0
>
> - printVarSummary(wSLP) [where wSLP=SLP]:
> Variable: wSLP
> Type: float
> Total Size: 2211840 bytes
> 552960 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 30] x [lat | 96] x [lon | 192]
> Coordinates:
> time: [ 0..254232]
> lat: [-88.57217..88.57217]
> lon: [-180..178.125]
> Number Of Attributes: 6
> NMO : 0
> _FillValue : 9.999e+20
> lev : 1000
> long_name : DJF: ** msl SEA LEVEL PRESSURE (HPA)
> grid_type : gaussian
> lonFlip : longitude coordinate variable has been reordered via lonFlip
> _________________________________________________________________________________________________
>
> Sorry for inconvenience and thanks for your help
> Renata
>
>
>
> 2013/4/16 Dennis Shea <shea@ucar.edu>
>
>> You never said what your problem is.
>> It certainly is *not* related using 'clat' rather than 'gw'
>>
>> ==
>> Did you get an error message?
>> What does the following show?
>>
>> printVarSummary(SLP)
>>
>> -
>> FYI: You can use the NCL function 'gaus' to generate
>> the gaussian weights, if desired.
>>
>> On 4/16/13 11:05 AM, Renata Tedeschi wrote:
>>> Hi everyone.
>>>
>>> I'm using the eof_1.ncl script, but I have one problem. The problem occur
>>> in these commands:
>>>
>>> ;==========================================================
>>> ; create weights: sqrt(cos(lat)) [or sqrt(gw) ]
>>> ;==========================================================
>>> rad = 4.*atan(1.)/180.
>>> clat = f->lat
>>> clat = sqrt( cos(rad*clat) ) ; gw for gaussian grid
>>>
>>> ;==========================================================
>>> ; weight all observations
>>> ;==========================================================
>>> wSLP = SLP ; copy meta data
>>> wSLP = SLP*conform(SLP, clat, 1)
>>>
>>> I can believe that the problem is because my grid is gaussian, and I do
>> not
>>> use gw, but I do not know what is gw.
>>>
>>> Renata Tedeschi
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 17 06:57:26 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 23 2013 - 12:54:13 MDT