Re: EOF - gaussian grid

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 17 2013 - 08:26:36 MDT

   lat = f->lat
   if (typeof(lat).eq."double") then
       clat = sqrt( cos(rad*tofloat(lat)) )
   else
       clat = sqrt( cos(rad*lat) )
   end if
   copy_VarCoords(lat, clat) ; contributed
   printVarSummary(clat)

On 4/17/13 7:49 AM, Renata Tedeschi wrote:
> Dennis,
>
> The script ran, but did not generate the figure.
>
> The problem is: "fatal:(lat) is not a dimension name in variable (clat),
> could not determine dimension number
> fatal:["Execute.c":7743]:Execute: Error occurred at
> or near line 113 in file eof_NAO.ncl"
>
> - line 113: eof_ts = eof_ts/sumWgt [where sumWgt = mln*sum(
> clat({lat|latS:latN}) )]
>
> _____________________________________________________________________________________________
> This occur because clat do not have the characteristics of lat.
>
> printVarSummary(lat):
> Variable: lat
> Type: double
> Total Size: 768 bytes
> 96 values
> Number of Dimensions: 1
> Dimensions and sizes: [lat | 96]
> Coordinates:
> lat: [-88.57217..88.57217]
> Number Of Attributes: 4
> standard_name : latitude
> long_name : latitude
> units : degrees_north
> axis : Y
>
> printVarSummary(clat) - where clat = tofloat(f->lat)
> Variable: clat
> Type: float
> Total Size: 384 bytes
> 96 values
> Number of Dimensions: 1
> Dimensions and sizes: [96]
> Coordinates:
> _____________________________________________________________________________________________
>
> How I can repair this?
>
> Renata
>
>
>
> 2013/4/17 Renata Tedeschi <rgtedeschi@gmail.com>
>
>> Thanks for your help Dennis, now the script ran correctly.
>>
>> Renata
>>
>>
>> 2013/4/17 Dennis Shea <shea@ucar.edu>
>>
>>> 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<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<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 08:26:36 2013

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