[ncl-talk] number of subscripts

Mary Haley haley at ucar.edu
Tue Oct 2 08:36:04 MDT 2018


To add to Dennis' post, I suggest not running NCL the way you've been
doing, which we call the "interactive" way. NCL does not have a good
interactive interface. Once you make a mistake, it is hard to go back and
fix it.

We recommend running NCL in "batch" mode, which is described in chapter 2.2
in the NCL User Guide. Basically, you put the NCL commands in a file by
using a UNIX editor, save the file, and then you "execute" that file with
something like:

ncl myfile.ncl


To see the guide and learn more about batch mode *and* NCL in general, go
to:

http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/

Click on one of the two "NCL User Guide V1.1" links depending on your
preference. You will see a table of contents that tells you where chapter
2.2 on batch mode is.

I recommend looking over this User Guide as it is very thorough and is
tailored for beginners of NCL. It will be particularly useful in learning
about graphics.

My apologies if somebody else already pointed you to this, but it does bear
repeating.

Good luck,

--Mary





On Mon, Sep 17, 2018 at 12:11 PM, Dennis Shea <shea at ucar.edu> wrote:

> @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
>>
>
> _______________________________________________
> 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/20181002/58d1436c/attachment.html>


More information about the ncl-talk mailing list