Re: meta data is

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 23 2010 - 09:33:21 MDT

I would speculate that "evap" is type "short", hence:

     evap = f[:]->evap ; short
     x = evap(::ntJump,:,:) ; short

The dim_avg)n will return a "float"
     x(nt/2,:,:) = (dim_avg_n(evap(ntStrt:ntLast,:,:), 0))
Thus, you have a
"fatal:Assignment type mismatch, right hand side can't be coerced to
type of left hand side"

The rhs dim_avg_n type float is being assigned to a short.
NCL is a 'strongly typed language'. It will not perform operation
where information will be lost.

The solution is simple. Use the contributed.ncl "short2flt" function.

     evap = short2flt( f[:]->evap ) ; evap will be "float"

All other steps can be used as you have them.

Good luck

On 04/23/2010 04:20 AM, samir pokhrel wrote:
> Dear NCL users,
>
> I am trying to do daily average from 12hrly data (5844,160,360). If
> I am defining a new array x for daily average values using my old 12hry
> array x = evap(::2,:,:) it is showing the folloing error
>
> fatal:Assignment type mismatch, right hand side can't be coerced to type
> of left hand side
>
> but however instead if i am defining new array of same dimension
> x=new((/2922,160,360/),float) and thereafter copy the attributes
> copy_VarCoords (y,x) It is doing fine
>
> the script is attatched herewith
>
> could you please help me out
>
> thanking in advance
>
>
> ;--------------------------------------------------------------
>
> setfileoption("nc","SuppressClose",False) ; for reading large number of
> files
>
> fils = systemfunc ("ls -1
> /data5/data/HOAPS/evaporation/daily/HOAPS3_DAILY_EVAP_???.nc") ; file paths
> f = addfiles (fils, "r")
>
> ListSetType (f, "cat")
>
> evap = f[:]->evap
>
> NTIM = dimx3(0) ; TOTAL number of time steps
>
> ntJump = 2 ;two time steps per day (12 hrly files)
>
> x = evap(::ntJump,:,:) ; create array with metadata
>
> ; y = evap(::ntJump,:,:) ; create array with metadata
>
> ntStrt = 0
> ntLast = ntJump-1
>
> ;x=new((/2922,160,360/),float)
>
> do nt=0,NTIM-1,2
> ; x(nt/2,:,:) = (dim_avg_n_Wrap(evap(ntStrt:ntLast,:,:), 0))
> x(nt/2,:,:) = (dim_avg_n(evap(ntStrt:ntLast,:,:), 0))
>
> ntStrt = ntStrt + ntJump
> ntLast = ntLast + ntJump
> end do
> ; copy_VarCoords (y,x)
>
>
> x@info_tag = "daily average"
> x@units = "mm/day
>
> system("/bin/rm -f daily_output.nc <http://daily_output.nc>")
> fout = addfile("daily_output.nc <http://daily_output.nc>","c")
> filedimdef(fout,"time",-1,True)
> fout->evp = x
>
>
>
>
> --
> Samir Pokhrel
> Climate and Global Modelling Division
> Indian Institute of Tropical Meteorology
> NCL Post, Pashan
> Pune-411008
> INDIA
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 23 09:33:32 2010

This archive was generated by hypermail 2.1.8 : Fri Apr 23 2010 - 14:40:07 MDT