[ncl-talk] Error in shape file script

Mary Haley haley at ucar.edu
Thu Nov 13 15:47:50 MST 2014


Jagan,

I don't recognize the script that you sent, so it may be an older version.

You may want to look at the newer "shapefile_mask_data.ncl" script, which
allows you to mask various types of data against a shapefile outline.

To see an example of using this function, go to:

http://www.ncl.ucar.edu/Applications/shapefiles.shtml

and look at examples 4, 11, 12, 14, or 16.

--Mary

On Wed, Nov 12, 2014 at 6:04 PM, jagan TNAU <jagan at tnau.ac.in> wrote:

> Thanks Rick.
>
> The entire script was provided to me by Mary. I have used it for producing
> 2x4 panel plot. Now I have planned to go for  3x4 panel plots and modified
> it. The script reads a shape file and select a particular region
> (districts) for plotting. I have not changed anything related to the shape
> file reading.
>
> On Wed, Nov 12, 2014 at 10:08 PM, Rick Brownrigg <brownrig at ucar.edu>
> wrote:
>
>> Hi,
>>
>> I don't fully understand your script, but at line 249, you are looping
>> over the number of lat/lon values in the shapefile:
>>
>>         do iltn=0,nlatlon_shp-1
>>         ;---gc_inout returns True if point is inside lat/lon area.
>>             if(ismissing(tmax1_mask(iltn))) then
>>
>> and indexing into tmax1_mask based upon "iltn".  But tmax1_mask was
>> dimensioned as:
>>
>>   values = asciiread("tmax-had45.txt",-1,"float")
>> ...
>>   ncols = 15
>> ...
>>   tmax1 = values(2::ncols)
>> ...
>>   tmax1_mask = new(dimsizes(tmax1),typeof(tmax1),tmsg)
>>
>> So its dimensions would seem to be unrelated to the number of points in
>> the shapefile (?)
>>
>> In any case, the error message means what it says -- an attempt to access
>> an array outside its bounds.
>>
>> Hope that helps pinpoint your problem...
>> Rick
>>
>>
>> On Wed, Nov 12, 2014 at 8:22 AM, jagan TNAU <jagan at tnau.ac.in> wrote:
>>
>>> Hello,
>>>
>>> Please find attached a shape file script for which I am receiving the
>>> error below. Kindly help me to correct it.
>>> ---------------
>>>  NCAR Command Language Version 6.0.0
>>>  The use of this software is governed by a License Agreement.
>>>  See http://www.ncl.ucar.edu/ for more details.
>>> (0)
>>> (0) numFeatures = 132
>>> (0) numSegments = 202
>>> (0) size of lat/lon arrays in shapefile = 192128
>>> (0) minlat_reg = 12.2281
>>> (0) maxlat_reg = 13.5628
>>> (0) minlon_reg = 79.2832
>>> (0) maxlon_reg = 80.3488
>>> (0) Number of line segments to draw = 2
>>> (0) Largest line segment length     = 8691
>>> (0) Number of areas to mask         = 200
>>> (0) Larkest mask segment length     = 10255
>>> fatal:Subscript out of range, error in subscript #0
>>> fatal:An error occurred reading tmax1_mask
>>> fatal:Execute: Error occurred at or near line 249 in file
>>> tmax-tn-mask.ncl
>>> --------------------
>>>
>>> --
>>> With regards
>>>
>>> Dr.R.Jagannathan
>>> Professor of Agronomy
>>> Agro Climate Research Centre
>>> Tamil Nadu Agricultural University
>>> Coimbatore - 641 003 India
>>>
>>> PHONE:  Mob: +91 94438 89891
>>>
>>> DO NOT PRINT THIS E-MAIL UNLESS NECESSARY. THE ENVIRONMENT CONCERNS US
>>> ALL.
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
>
> --
> With regards
>
> Dr.R.Jagannathan
> Professor of Agronomy
> Agro Climate Research Centre
> Tamil Nadu Agricultural University
> Coimbatore - 641 003 India
>
> PHONE:  Mob: +91 94438 89891
>
> DO NOT PRINT THIS E-MAIL UNLESS NECESSARY. THE ENVIRONMENT CONCERNS US ALL.
>
> _______________________________________________
> ncl-talk mailing list
> 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/20141113/f1342ff1/attachment.html 


More information about the ncl-talk mailing list