[ncl-talk] About shapefiles

Mary Haley haley at ucar.edu
Tue Jun 21 09:59:53 MDT 2016


Soares,

When you continue to have problems, you must include the new code and the
new error messages. You referred to "line 295", but we have no idea what
this is since there's no code to look at.

As Dennis stated earlier, "printVarSummary" is just a print statement that
helps you determine what the problem might be. It does NOT fix the code for
you.

You are getting an error because you are subscripting an array with a value
that is out-of-range. Here's an example of a 2-line code that produces this
error:

    x = random_uniform(-100,100,(/10,20,30/))
    print(x(5,20,5))                           ; index '20' is invalid

The error occurs because "x" is dimensioned 10 x 20 x 30, and the "20"
of x(5,20,5) is out-of-range because dimensions start at 0.

This would work:

    x = random_uniform(-100,100,(/10,20,30/))
    print(x(5,19,5))                           ; index '19' is valid

The "printVarSummary" procedure will tell you what the dimension sizes
of the array are, and you can then compare this against how you are
trying to subscript the array.

If you continue to have problems, then I suggest that you include the
full script and the data file so we can run it here.

You can use our ftp site to upload your files:

http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP

--Mary



On Tue, Jun 21, 2016 at 2:24 AM, isakhar sakhar isakhar <
isakhar.inside13 at gmail.com> wrote:

> Hi all,
>
> I added  printVarSummary but It didn't work even if I changed to use
> variable used in line 295 like printVarSummary(geom_segIndex) or
> geom_segIndex (feature).
>
> I have also googled what kinds of variable inside line 295 but I couldn't
> see anything.
> Appreciate for your help.
>
> Soares
>
> On Mon, Jun 6, 2016 at 1:53 AM, Dennis Shea <shea at ucar.edu> wrote:
>
>> As previously suggested:
>>
>> "If you continue to have problems, please look at the error messages
>> closely."
>>
>> ==
>> The output has:
>>
>> fatal:Subscript out of range, error in subscript #0
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 295 in
>> file shapefiles_5.ncl
>>
>> ===
>> You state: "it must fix with printVarSummary"
>>
>> printVarSummary prints information about a file or variable. ... it does
>> not "fix" anything.
>> ===
>>
>> Immediately ***before*** line 295, add a printVarSummary(...)
>>
>> *not* of the file but of the variable(s) used in line 295.
>>
>> Please **look carefully** at the outputs and examine the array sizes and
>> compare with line 295 usage.
>>
>>
>> ===
>>
>>
>>
>> On Sat, Jun 4, 2016 at 6:26 AM, isakhar sakhar isakhar <
>> isakhar.inside13 at gmail.com> wrote:
>>
>>> Hi Mary,
>>>
>>> After following all your information, I get the error say:
>>>
>>>
>>> (0)    masking row 0
>>> (0)    masking row 1
>>> (0)    masking row 2
>>> (0)    masking row 3
>>> (0)    masking row 4
>>> (0)    masking row 5
>>> (0)    masking row 6
>>> (0)    masking row 7
>>> (0)    masking row 8
>>> (0)    masking row 9
>>> (0)    masking row 10
>>> (0)    masking row 11
>>> (0)    Wind Speed: 10m: min=0.102553   max=9.43881
>>> (0)    Wind Speed: 10m: min=0.102553   max=9.43881
>>> (0)    geometry
>>> (1)    segments
>>> (2)    x
>>> (3)    y
>>> (4)    ID_0
>>> (5)    ISO
>>> (6)    NAME_0
>>> (7)    ID_1
>>> (8)    NAME_1
>>> (9)    ID_2
>>> (10)    NAME_2
>>> (11)    VARNAME_2
>>> (12)    NL_NAME_2
>>> (13)    HASC_2
>>> (14)    CC_2
>>> (15)    TYPE_2
>>> (16)    ENGTYPE_2
>>> (17)    VALIDFR_2
>>> (18)    VALIDTO_2
>>> (19)    REMARKS_2
>>> (20)    Shape_Leng
>>> (21)    Shape_Area
>>>
>>> Variable: f
>>> Type: file
>>> File path:    /user/wrfout_d01_2014-01-07_18:00:00.nc
>>> Number of global attributes:     117
>>> Number of dimensions:     9
>>> Number of variables:     142
>>> fatal:Subscript out of range, error in subscript #0
>>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 295 in
>>> file shapefiles_5.ncl
>>>
>>>
>>>
>>> And according to the information of this website
>>> http://mms.dkrz.de/pdf/vis/NCL_docs/NCL_User_Guide_v1.0_kmf_20151207_Draft.pdf
>>> , it must fix with printVarSummary. So I add more the code below;
>>>
>>> printVarSummary(f)       ;which (f) is my wrfout file and it same if
>>> change to shapefile too (TLS_adm.shp)
>>>
>>>
>>>
>>> Soares
>>>
>>> On Fri, Jun 3, 2016 at 12:05 AM, Mary Haley <haley at ucar.edu> wrote:
>>>
>>>> The error messages are giving you useful information about what the
>>>> problem is.
>>>>
>>>> The first error message:
>>>>
>>>> warning:ContourPlotSetValues: Data values out of range of levels set by
>>>> EXPLICITLEVELS mode
>>>>
>>>> is telling you that the contour levels you chose are not in the same
>>>> range of your data. You chose these levels:
>>>>
>>>>   res at cnLevels              = (/ 5.4, 6.2, 6.9, 7.4, 7.8, 8.6 /)
>>>>
>>>> So you should look at your data (VERY IMPORTANT) to see what the range
>>>> is and make sure that your data intersects with this range of values.
>>>>  "printMinMax" is useful for this:
>>>>
>>>> printMinMax(maskedS(nt,:,:),0)
>>>>
>>>> The second error message:
>>>>
>>>> fatal:["Execute.c":5900]:variable (NAME_3) is not in file
>>>> (citiesShapes)
>>>>
>>>> is telling you that you are trying to reference a variable called
>>>> "NAME_3" from the "citiesShapes.shp" shapefile, but that the variable
>>>> doesn't exist on the file. You need to look at your shapefile to see what
>>>> the variable names are. You can either do this on the UNIX command line
>>>> with:
>>>>
>>>>    ncl_filedump citiesShapes.shp
>>>>
>>>> or you can do it inside the NCL script by using the "getfilevarnames"
>>>> function:
>>>>
>>>>   f = addfile("citiesShapes.shp", "r")
>>>>
>>>>   print(getfilevarnames(f))
>>>>
>>>> If you continue to have problems, please look at the error messages
>>>> closely.
>>>>
>>>> --Mary
>>>>
>>>>
>>>>
>>>> On Thu, Jun 2, 2016 at 6:01 AM, isakhar sakhar isakhar <
>>>> isakhar.inside13 at gmail.com> wrote:
>>>>
>>>>> Dear Mary,
>>>>>
>>>>> Now I am getting the error as shown below. I tried to change the name
>>>>> of NAME_3 according to name of the cities but still same.
>>>>>
>>>>>
>>>>> warning:ContourPlotSetValues: Data values out of range of levels set
>>>>> by EXPLICITLEVELS mode
>>>>> fatal:["Execute.c":5900]:variable (NAME_3) is not in file
>>>>> (citiesShapes)
>>>>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 269
>>>>> in file shapefiles_5.ncl
>>>>>
>>>>>
>>>>> Appreciate for any help,
>>>>>
>>>>> Soares
>>>>>
>>>>> On Wed, Jun 1, 2016 at 11:36 PM, Mary Haley <haley at ucar.edu> wrote:
>>>>>
>>>>>> Soares,
>>>>>>
>>>>>> The error is telling you that you have a undefined function or
>>>>>> procedure. If you have an older version of NCL, then you may need to
>>>>>> include some "load" command at the top of your script:
>>>>>>
>>>>>>  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>>>>  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>>>>
>>>>>>
>>>>>> --Mary
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sat, May 28, 2016 at 3:59 AM, isakhar sakhar isakhar <
>>>>>> isakhar.inside13 at gmail.com> wrote:
>>>>>>
>>>>>>> Dear Mr.Rick
>>>>>>>
>>>>>>> I still face the error as shown below;
>>>>>>>
>>>>>>> fatal:syntax error: line 122 in file shapefiles_5.ncl before or near
>>>>>>> \n
>>>>>>>   gsn_define_colormap(wks, cmap)
>>>>>>> ---------------------------------^
>>>>>>>
>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>> fatal:syntax error: line 329 in file shapefiles_5.ncl before or near
>>>>>>> \n
>>>>>>>   gsn_table(wks, (/ 1, 1 /), (/ ulX-.005, ulX+.255 /), (/ ulY-.21,
>>>>>>> ulY /), (/ " " /), tblRes)
>>>>>>>
>>>>>>> ---------------------------------------------------------------------------------------------^
>>>>>>>
>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>> fatal:syntax error: line 337 in file shapefiles_5.ncl before or near
>>>>>>> \n
>>>>>>>   gsn_table(wks, hdr, hdrX, hdrY, hdrText, tblRes)
>>>>>>> --------------------------------------------------^
>>>>>>>
>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>> fatal:syntax error: line 346 in file shapefiles_5.ncl before or near
>>>>>>> \n
>>>>>>>   gsn_table(wks, subHdr, hdrX, hdrY, subHdrText, tblRes)
>>>>>>> --------------------------------------------------------^
>>>>>>>
>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>> fatal:syntax error: line 380 in file shapefiles_5.ncl before or near
>>>>>>> \n
>>>>>>>   gsn_table(wks, tblBdy, tblX, tblY, tblText, tblRes)
>>>>>>> -----------------------------------------------------^
>>>>>>>
>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>> fatal:Syntax Error in block, block not executed
>>>>>>> fatal:error at line 383 in file shapefiles_5.ncl
>>>>>>>
>>>>>>>
>>>>>>> Soares
>>>>>>>
>>>>>>> On Sat, May 28, 2016 at 12:56 AM, Rick Brownrigg <brownrig at ucar.edu>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> It looks there's a syntax error at line 258 that likely cascades to
>>>>>>>> the other errors. Lines 257-258 read:
>>>>>>>>
>>>>>>>>   majorCities = (/ (/ "Dili", "Dili"     /), \
>>>>>>>>                    (/ "Hera ","Hera"/), \ /)
>>>>>>>>
>>>>>>>>                                    ^^^^^^^^
>>>>>>>> That should be:
>>>>>>>>
>>>>>>>>   majorCities = (/ (/ "Dili", "Dili"     /), \
>>>>>>>>                    (/ "Hera ","Hera"/)  /)
>>>>>>>>
>>>>>>>> Rick
>>>>>>>>
>>>>>>>> On Fri, May 27, 2016 at 3:35 AM, isakhar sakhar isakhar <
>>>>>>>> isakhar.inside13 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Dear NCL team
>>>>>>>>>
>>>>>>>>> I download the shapefiles for administrative boundaries from
>>>>>>>>> GIVA-DIS website (http://www.diva-gis.org/gdata) to run my
>>>>>>>>> wrfout. Here I got error as shown below;
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>>>> fatal:syntax error: line 258 in file shapefiles_5.ncl before or
>>>>>>>>> near \n
>>>>>>>>>
>>>>>>>>> ^
>>>>>>>>>
>>>>>>>>> fatal:syntax error: line 329 in file shapefiles_5.ncl before or
>>>>>>>>> near \n
>>>>>>>>>   gsn_table(wks, (/ 1, 1 /), (/ ulX-.005, ulX+.255 /), (/ ulY-.21,
>>>>>>>>> ulY /), (/ " " /), tblRes)
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------------------------------^
>>>>>>>>>
>>>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>>>> fatal:syntax error: line 337 in file shapefiles_5.ncl before or
>>>>>>>>> near \n
>>>>>>>>>   gsn_table(wks, hdr, hdrX, hdrY, hdrText, tblRes)
>>>>>>>>> --------------------------------------------------^
>>>>>>>>>
>>>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>>>> fatal:syntax error: line 346 in file shapefiles_5.ncl before or
>>>>>>>>> near \n
>>>>>>>>>   gsn_table(wks, subHdr, hdrX, hdrY, subHdrText, tblRes)
>>>>>>>>> --------------------------------------------------------^
>>>>>>>>>
>>>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>>>> fatal:syntax error: line 380 in file shapefiles_5.ncl before or
>>>>>>>>> near \n
>>>>>>>>>   gsn_table(wks, tblBdy, tblX, tblY, tblText, tblRes)
>>>>>>>>> -----------------------------------------------------^
>>>>>>>>>
>>>>>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>>>>> fatal:Syntax Error in block, block not executed
>>>>>>>>> fatal:error at line 383 in file shapefiles_5.ncl
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Here I attach my ncl script and ncdump file.
>>>>>>>>> Many thanks for your help.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Soares
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> 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/20160621/25b17ec9/attachment.html 


More information about the ncl-talk mailing list