[ncl-talk] number of subscripts

Dennis Shea shea at ucar.edu
Mon Sep 17 12:11:41 MDT 2018


@Elham Ghasemifar <elham.ghasemifar at modares.ac.ir>

Please do not post your interactive session with the 'ncl > ...' embedded.

As I suggested before, you can save all commands:

%> ncl <return>
ncl > *record *"Elham.ncl"
ncl > ....statements ...
ncl > *stop record*

You file is not available so the following is a guess.

ncl 19> data = f->$varname$

ncl 23> data1= dim_sum_n_Wrap(data ,*1*)

ncl 24> data2 = dim_avg_n_Wrap(data1,*0*)

Variable 'data' is two-dimensional  *[dim0],[dim1])*
Variable 'data1' is one-dimensional *[dim0]*
Variable 'data2' is a scalar *[1]*

ncl 52> plot(i) = gsn_csm_contour_map(wks,*data2(**{lvl(i)},:,:)*,res)

You are referencing data2 as three-dimensional

On Sun, Sep 16, 2018 at 5:48 AM Soma Roy <somaroy892 at gmail.com> wrote:

> Send a clean script with one or two sample data file(s).
> If the data file is large you may zip it.
>
> Remove all 'ncl>' from each line and send a clear and clean script for
> this issue.
>
> Soma
>
> On Sun, Sep 16, 2018, 16:12 Elham Ghasemifar <
> elham.ghasemifar at modares.ac.ir> wrote:
>
>> dear colleges
>>
>> hello
>>
>> i want to plot cloudsat 2b geoprof data using ncl example, unfortunately
>> my lat and lon have different column and i cant to relate latitude and
>> longitude to the data, in the example script , the lat and lon related to
>> data,
>>
>> any researcher can help me how i can overcome to the error, i appreciate
>> any help from the ncl-talk,
>>
>> please see the complete script:
>>
>>
>> ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>
>> ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>
>> ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>
>> ncl 3> fili =
>> "2011040011644_25451_CS_2B-GEOPROF_GRANULE_P1_R05_E03_F00.hdf"
>>
>> ncl 4> varname = "CPR_Cloud_mask_2B_GEOPROF"
>>
>> ncl 5> f = addfile (fili+".he2","r")
>>
>> dbze = f->Radar_Reflectivity_2B_GEOPROF
>>
>> ncl 6> alt40 = f->Height_2B_GEOPROF
>>
>> ncl 7> kalt = dimsizes(alt40)
>>
>> ncl 8> time = f->Profile_time_2B_GEOPROF
>>
>> ncl 9> ntime = dimsizes(time)
>>
>> ncl 10> lat = f->Latitude_2B_GEOPROF
>>
>> ncl 11> nlat = dimsizes(lat)
>>
>> ncl 12> lon = f->Longitude_2B_GEOPROF
>>
>> ncl 13> nlon = dimsizes(lon)
>>
>> ncl 14> time at units = "hours since 2011-02-10 00:00:0.0"
>>
>> ncl 15> utc_date = cd_calendar(time, 0)
>>
>> ncl 16> yyyymm = cd_calendar(time,-1)
>>
>> ncl 17> yyyyfrac= yyyymm_to_yyyyfrac(yyyymm,0)
>>
>> ncl 18> months = utc_date(:,1)
>>
>> ncl 19> data = f->$varname$
>>
>> ncl 20> lat at units = "degrees_north"
>>
>> ncl 21> lat at units = "degrees_north"
>>
>> ncl 22> data1
>>
>> ncl 23> data1= dim_sum_n_Wrap(data ,1)
>>
>> ncl 24> data2 = dim_avg_n_Wrap(data1,0)
>>
>> ncl 25> printVarSummary(data1)
>>
>> Variable: data1
>>
>> Type: byte
>>
>> Total Size: 37082 bytes
>>
>> 37082 values
>>
>> Number of Dimensions: 1
>>
>> Dimensions and sizes: [nray_2B_GEOPROF | 37082]
>>
>> Coordinates:
>>
>> Number Of Attributes: 9
>>
>> _FillValue : -9
>>
>> hdfeos_name : CPR_Cloud_mask
>>
>> factor : 1
>>
>> offset : 0
>>
>> long_name : CPR Cloud Mask
>>
>> valid_range : 0
>>
>> missing : -9
>>
>> missop : ==
>>
>> sum_op_ncl : dim_sum_n over dimension(s): nbin_2B_GEOPROF
>>
>> ncl 26> printVarSummary(data2)
>>
>> Variable: data2
>>
>> Type: float
>>
>> Total Size: 4 bytes
>>
>> 1 values
>>
>> Number of Dimensions: 1
>>
>> Dimensions and sizes: [1]
>>
>> Coordinates:
>>
>> Number Of Attributes: 11
>>
>> hdfeos_name : CPR_Cloud_mask
>>
>> factor : 1
>>
>> offset : 0
>>
>> long_name : CPR Cloud Mask
>>
>> valid_range : 0
>>
>> missing : -9
>>
>> missop : ==
>>
>> sum_op_ncl : dim_sum_n over dimension(s): nbin_2B_GEOPROF
>>
>> _FillValue_original : -9
>>
>> _FillValue : -9
>>
>> average_op_ncl : dim_avg_n over dimension(s): nray_2B_GEOPROF
>>
>> ncl 27> pltType = "png"
>>
>> ncl 28> wks = gsn_open_wks(pltType,"cloudsat")
>>
>> ncl 29> plot = new(4,graphic)
>>
>> ncl 30> res = True
>>
>> ncl 31> res at gsnDraw = False
>>
>> ncl 32> res at gsnFrame = False
>>
>> ncl 33> res at lbLabelBarOn = False
>>
>> ncl 34> res at mpFillOn = False
>>
>> ncl 36> res at cnFillOn = True
>>
>> ncl 37> res at cnFillPalette = "WhiteBlueGreenYellowRed"
>>
>> ncl 38> res at cnLinesOn = False
>>
>> ncl 39> res at cnLineLabelsOn = False
>>
>> ncl 40> resP = True
>>
>> ncl 41> resP at gsnMaximize = True
>>
>> ncl 42> resP at gsnPanelLabelBar = True
>>
>> ncl 43> res at cnLevelSelectionMode = "ManualLevels"
>>
>> ncl 44> res at cnMinLevelValF = 0.025
>>
>> ncl 45> res at cnMaxLevelValF = 0.60
>>
>> ncl 46> res at cnLevelSpacingF = 0.025
>>
>> ncl 47> lvl = (/ 1200, 5520, 10230, 14160 /)
>>
>> ncl 48> res at gsnLeftString = "total cloud fraction"
>>
>> ncl 49> do i=0,3
>>
>> ncl 50> res at gsnRightString
>>
>> ncl 51> res at gsnRightString= alt40({lvl(i)})+" "+alt40 at units
>>
>> ncl 52> plot(i) = gsn_csm_contour_map(wks,data2({lvl(i)},:,:),res)
>>
>> ncl 53> end do
>>
>> fatal:Number of subscripts do not match number of dimensions of
>> variable,(1) Subscripts used, (2) Subscripts expected
>>
>> fatal:["Execute.c":8638]:Execute: Error occurred at or near line 66
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180917/23f9058b/attachment.html>


More information about the ncl-talk mailing list