[ncl-talk] Issue with Masking with shapefile
Guido Cioni
guidocioni at gmail.com
Wed Aug 3 05:31:47 MDT 2016
Just judging from what you are saying (I didn’t read the script), you had some error regarding the shape file which was blocking the execution of the script at line xxx, but then you fixed that error and now you have another error at line yyy (with yyy > xxx likely to be) that wasn’t detected before since you didn’t actually reach that line while executing the script.
Please mark the line where the error (subscripts) is happening and go into the code to see all the assignments that you made at that point. Usually a few print statements (printVarSummary) before that line can lead you the way..
Without the line where the error is happening you are forcing people to read your code entirely, which many be time consuming :)
Guido Cioni
http://guidocioni.altervista.org <http://guidocioni.altervista.org/>
> On 03 Aug 2016, at 13:26, Amit Kumar <amitkumar.777 at hotmail.com> wrote:
>
>
> Hi,
>
> I'm truing to do masking using shapefile, script is attached.
>
> I'm getting following error:
>
> (0) shapefile_mask_data: Error: not a valid rectilinear, curvilinear, or unstructured grid
>
> so I made following changes:
>
> opt = True
> opt at return_mask = True
> shp_mask = shapefile_mask_data(var(0,:,:),filename,opt)
> shp_mask_3d = conform_dims(dimsizes(var),shp_mask,(/1,2/))
>
> var_shp_mask = where(shp_mask_3d.eq.1,var,var at _FillValue)
> copy_VarMeta(var,var_shp_mask)
>
> ;---For shapefile plot, use the shapefile outlines.
> res at mpOutlineOn = False
>
> ;---Create plot of original data masked by shapefile outlines
> res at tiMainString = "Original data masked by shapefile outlines"
> var_shp_plot = gsn_csm_contour_map(wks,var_shp_mask,res)
> dum = gsn_add_shapefile_polylines(wks,var_shp_plot,filename,False)
> draw(plot)
> frame(wks)
> end
>
> after these changes earlier error is rectified but now I'm getting following error:
>
> fatal:Number of subscripts do not match number of dimensions of variable,(3) Subscripts used, (2) Subscripts expected
>
> Please suggest how to proceed further.
>
> <hem_shp_mask_1.ncl>_______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160803/7c42218c/attachment.html
More information about the ncl-talk
mailing list