Re: Execute: Error occurred

From: Kim <r4rid_at_nyahnyahspammersnyahnyah>
Date: Mon Feb 01 2010 - 00:28:10 MST

Hi,
Thank you for your reply but I face another problem given below. Please could you guide me how to fix it? Actually I want to plot it as like example (xy_5.ncl) & my code is also attached, any help will be appreciated.
Thanks again
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
fatal:Number of subscripts do not match number of dimensions of variable,(2) Subscripts used, (3) Subscripts expected
fatal:Execute: Error occurred at or near line 3922 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
 
fatal:Execute: Error occurred at or near line 38 in file x1.ncl
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
netcdf precip.mon.mean {
dimensions:
        lat = 72 ;
        lon = 144 ;
        time = UNLIMITED ; // (366 currently)
variables:
        float lat(lat) ;
                lat:units = "degrees_north" ;
                lat:actual_range = 88.75f, -88.75f ;
                lat:long_name = "Latitude" ;
        float lon(lon) ;
                lon:units = "degrees_east" ;
                lon:long_name = "Longitude" ;
                lon:actual_range = 1.25f, 358.75f ;
        float precip(time, lat, lon) ;
                precip:long_name = "Average Monthly Rate of Precipitation" ;
                precip:valid_range = 0.f, 100.f ;
                precip:units = "mm/day" ;
                precip:add_offset = 0.f ;
                precip:scale_factor = 1.f ;
                precip:actual_range = 0.f, 85.967f ;
                precip:missing_value = -9.96921e+36f ;
                precip:precision = 32767s ;
                precip:least_significant_digit = 2s ;
                precip:var_desc = "Precipitation" ;
                precip:dataset = "GPCP Version 2.1 Combined Precipitation Dataset" ;
                precip:level_desc = "Surface" ;
                precip:statistic = "Mean" ;
                precip:parent_stat = "Mean" ;
        double time(time) ;
                time:units = "days since 1700-1-1 00:00:0.0" ;
                time:long_name = "Time" ;
                time:delta_t = "0000-01-00 00:00:00" ;
                time:actual_range = 101902., 113011. ;
                time:avg_period = "0000-01-00 00:00:00" ;
 
// global attributes:
                :Conventions = "COARDS" ;
                :title = "GPCP Version 2.1 Combined Precipitation Dataset" ;
                :history = "created jul 2009 by CAS at NOAA/ESRL PSD" ;
                :platform = "Observation" ;
                :source = "GPCP Polar Satellite Precipitation Data Centre - Emission (SSM/I emission estimates).\n",

--- On Sun, 1/31/10, Dennis Shea <shea@ucar.edu> wrote:

From: Dennis Shea <shea@ucar.edu>
Subject: Re: Execute: Error occurred
To: "Kim" <r4rid@yahoo.com>
Cc: ncl-talk@ucar.edu
Date: Sunday, January 31, 2010, 6:15 AM

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 Mon Feb 1 00:28:18 2010

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