Re: Execute: Error occurred

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sun Jan 31 2010 - 07:15:53 MST

You do not indicate the units of "time".
You are treating this as "yyyymm". I speculate this is not correct.

The 1st rule of data processing is "look at the data".
If you use 'ncdump -h' or 'ncl_filedum' on the file, I speculate
you will see:

         double time(time) ;
                 time:units = "hours since 1-1-1 00:00:0.0" ;

You could use
     time = f->time
     yyyymm = ut_calendar(time, 1)
     yrfrac = yyyymm_to_yyyyfrac(yyyymm, 0.0) ; x (time) axis

Please look at:

http://www.ncl.ucar.edu/Document/Functions/index.shtml

the "Date" category

Good luck

Kim wrote:
> Dear ncl users, anyone could help me to fix the problem given below.
>
> Thanks in advance,
>
> Kim
>
> ………………………………
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
>
>
> begin
>
> ;************************************************
>
> ; Read in data
>
> ;************************************************
>
> f = addfile ("precip.mon.mean.nc","r")
>
> u = f->precip
>
> u1 = f->precip
>
> printVarSummary(u)
>
> ; ***********************************************
>
> ; create new date array for use on the plot
>
> ; ***********************************************
>
> date = f->time
>
> dimDate = dimsizes(date)
>
> dateF = new (dimDate,float)
>
> do n=0,dimDate-1
>
> yyyy = date(n)/100
>
> mon = date(n)-yyyy*100
>
> dateF(n) = yyyy + (mon-1)/12
>
> end do
>
> ;*********************************
>
> ; plot parameters
>
> ;*********************************
>
> wks = gsn_open_wks ("x11","xy")
>
>
>
> res = True
>
> res@gsnFrame = False
>
>
>
> res@vpHeightF= 0.4 ; change aspect ratio of plot
>
> res@vpWidthF = 0.8
>
>
>
> res@trYMinF = -30.0 ; min value on y-axis
>
> res@trYMaxF = 100.0 ; max value on y-axis
>
> res@tiYAxisString = "Precipitation(mm)" ; y-axis label
>
> res@tiMainString = "Average Monthly Rate of Precipitation"
>
>
>
> res@gsnYRefLine = 0.0 ; create a reference line
>
> polyres = True
>
> polyres@gsLineThicknessF = 3.0
>
>
>
> res@gsnAboveYRefLineColor = "red" ; above ref line fill red
>
> res@gsnBelowYRefLineColor = "blue" ; below ref line fill blue
>
> plot = gsn_csm_xy (wks,dateF,u(:,{20:50},{30:120}),res)
>
> gsn_polyline(wks,plot,dateF,(/u1/),polyres)
>
> frame(wks)
>
> end
>
> *******************
>
> Variable: u
>
> Type: float
>
> Total Size: 15178752 bytes
>
> 3794688 values
>
> Number of Dimensions: 3
>
> Dimensions and sizes: [time | 366] x [lat | 72] x [lon | 144]
>
> Coordinates:
>
> time: [101902..113011]
>
> lat: [88.75..-88.75]
>
> lon: [1.25..358.75]
>
> Number Of Attributes: 15
>
> long_name : Average Monthly Rate of Precipitation
>
> valid_range : ( 0, 100 )
>
> units : mm/day
>
> add_offset : 0
>
> scale_factor : 1
>
> actual_range : ( 0, 85.967 )
>
> missing_value : -9.96921e+36
>
> precision : 32767
>
> least_significant_digit : 2
>
> var_desc : Precipitation
>
> dataset : GPCP Version 2.1 Combined Precipitation Dataset
>
> level_desc : Surface
>
> statistic : Mean
>
> parent_stat : Mean
>
> _FillValue : -9.96921e+36
>
> fatal:Assignment type mismatch, right hand side can't be coerced to type
> of left hand side
>
> fatal:Execute: Error occurred at or near line 22 in file x1.ncl
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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 Sun Jan 31 07:15:59 2010

This archive was generated by hypermail 2.1.8 : Mon Feb 01 2010 - 08:05:34 MST